Closed dubo-dubon-duponey closed 1 year ago
Note that this service above ^ is properly recognized and used by other software (it's an airplay receiver).
eg:
It looks like a dot "." in a host name is not recommended because it is used as a separator.
From RFC1033
The domain system allows a label to contain any 8-bit character. Although the domain system has no restrictions, other protocols such as SMTP do have name restrictions. Because of other protocol restrictions, only the following characters are recommended for use in a host name (besides the dot separator):
"A-Z", "a-z", "0-9", dash and underscore
I see. Thanks for the clarification.
Would you still welcome a PR that would handle that case (albeit not recommended)?
Not sure if it is a good idea to allow hostnames, which are actually not valid.
Mmm... "dots" do not appear in "labels" (as defined in the extract you quoted above), but a serie of dot separated labels form a valid domain name right?
SRV records do not seem to be limited to one level domain names, nor are A record, right? (https://en.wikipedia.org/wiki/SRV_record)
Specifically, Apple implementation (for Airplay), and other mDNS stacks seem to be happy with multi level domain names in SRV / A records.
Again I'm not exactly on top of my game with mDNS ;-), so, maybe I'm unaware of another RFC that would further limit this.
Either way, not opinionated one way or the other here, just curious about the bottom line :-).
From wikipedia
The Internet standards (Requests for Comments) for protocols specify that labels may contain only the ASCII letters a through z (in a case-insensitive manner), the digits 0 through 9, and the hyphen-minus character ('-'). The original specification of hostnames in RFC 952 disallowed labels from starting with a digit or with a hyphen character, and could not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted. Internationalized domain names are stored in the Domain Name System as ASCII strings using Punycode transcription.[4]
To me this sounds like dots should not be included in hostnames.
The accepted answer for Can I have dots in a hostname? states that as well.
Using a hostname with a dot in it will cause inconsistent results from any system that consumes DNS. [...] Don't use dotted name.
To me this sounds like dots should not be included in hostnames.
This is where I'm struggling... From that same wikipedia page: "Hostnames are composed of a sequence of labels concatenated with dots. For example, "en.wikipedia.org" is a hostname."
To me, this reads as "a hostname may contain any number of labels separated by dots".
Either way, it's fine :-)
Thanks for taking the time to discuss this - I'll just rename these services.
Browsing services with multiple dots in their domain name fails to read A records.
Consider the following answer:
While parsing the srv record: https://github.com/brutella/dnssd/blob/7335cb43c5600dcddd3ce2656ef06517673788b9/cache.go#L63
ParseHostName will apparently fail to set the hostname https://github.com/brutella/dnssd/blob/7335cb43c5600dcddd3ce2656ef06517673788b9/service.go#L175
In turn, when parsing the A record, it will fail to recognize the entry as valid: https://github.com/brutella/dnssd/blob/7335cb43c5600dcddd3ce2656ef06517673788b9/cache.go#L70
... ultimately not listing the service IP.
The above works well if the service name contains just one level (eg: "foobar.local.")
Maybe I'm missing something here - plus I'm not familiar with the spec...
What are your thoughts?
Thanks.