Open drahoslavzan opened 1 month ago
Thank you very much for your interest and contribution to this package.
According to domain name specifications RFC 1035:
2.3.4. Size limits
names 255 octets or less
According to the SMTP RFC 5321:
4.5.3.1.2. Domain
The maximum total length of a domain name or number is 255 octets.
I’m not sure if a domain with a final dot is a valid domain. It doesn’t seam so considering the "preferred syntax" described in section 2.3.1 of RFC 1035. It might be a DNS internal specific thing.
Do you have any references to share to help clarify this ?
domain name ending with a dot is a valid domain, absolute domain name I think it is even mentioned in the RFC you are referring to.
but I just found an article that explains domain name length constraints with references. There is also a leading byte for each label, thus the maximum name is only 253 octets (hidden leading byte for the first label and null label or the dot at the end).
https://www.directedignorance.com/blog/maximum-length-of-domain-name
For now I will stick to the 255 octet upper limit. The reason to do so are
I leave the issue open as further inputs are welcome.
Here is a new relevant input on this matter. It is a superuser answer. In summary:
_minecraft._tcp.example.com
is a valid domain name, not a valid host name registered as A/AAAA record.
Thanks for the useful library.
I think there should be a check if the domain name has a dot at the end, if not then the length should not go over 254.
https://github.com/chmike/domain/blob/f6a50c133799ad801336e9049a55bc9b90ce7d7e/check.go#L16