mafintosh / multicast-dns

Low level multicast-dns implementation in pure javascript
MIT License
512 stars 91 forks source link

Should ANY be the default query type? #15

Closed watson closed 9 years ago

watson commented 9 years ago

Today A is the default query type, e.g. mdns.query('foo') is equivalent to mdns.query('foo', 'A'). Wouldn't it make more sense that ANY was the default?

I'll happily make a PR if this is the case :smiley:

mafintosh commented 9 years ago

i'm ignorant. whats the difference?

watson commented 9 years ago

@mafintosh ANY is not a normal record type like A, SRV etc - it's only used when querying and functions as a wildcard question.

I would normally query for an A record to get only the ipv4 for the given hostname, eg mdns.query('brunhilde.local', 'A'). But if I want to get all records for a given hostname I can issue an ANY query which basically means that mDNS servers should respond with all the records they have for the given hostname (be it A, AAAA, SRV, PTR etc).

watson commented 9 years ago

More info: https://tools.ietf.org/html/rfc6762#section-6.5

mafintosh commented 9 years ago

Ah okay. Yea guess it makes sense then but we should document any records as supported then (and this would be a major bump)

watson commented 9 years ago

I'm not sure if this will require the module to officially support all record types. Just returning a response of type x isn't the same as adding query support for type x, right?

Today I can write mdns.query('brunhilde.local', 'ANY') and the module sends the correct query and hence responds with the expected responses as far as I can see - though maybe that's just a coincidence?