As I noticed class from google library com.google.common.net.InternetDomainName
containts the following constant:
private static final int MAX_LENGTH = 253;
Code below, checks length during creation of InternetDomainName instance:
checkArgument(name.length() <= MAX_LENGTH, "Domain name too long: '%s':", name);
But RFC-2181 says that:
A full domain name is limited to 255 octets (including the separators).
So, what is valid max length for domain name?
Advertisement
Answer
This is straight from wikipedia:
The full domain name may not exceed the length of 253 characters in its textual representation. In the internal binary representation of the DNS the maximum length requires 255 octets of storage, since it also stores the length of the name.
And this is from RFC 1035:
Each label is represented as a one octet length field followed by that number of octets. Since every domain name ends with the null label of the root, a domain name is terminated by a length byte of zero.