Search code examples
validationdnsmozillatldpublic-suffix-list

Mozilla's publicsuffix -- does it contains _all_ currently available LTD's?


There's a Mozilla's project "https://publicsuffix.org/". I think it'll come in handy for my library where I want to validate URIs, particularly the ltd part. Does publicsuffix contain all possible ltd's in the word which are currently available in the Internet and is always up to date? Can it be used in production?

Note that my question isn't about suggesting me a library or service for validating URIs.


Solution

  • Note this part from the documentation on the site you just linked to:

    Some people use the PSL to determine what is a valid domain name and what isn't. This is dangerous, particularly in these days where new gTLDs are arriving at a rapid pace, if your software does not regularly receive PSL updates, because it will erroneously think new gTLDs are not valid. The DNS is the proper source for this information. If you must use it for this purpose, please do not bake static copies of the PSL into your software with no update mechanism.

    That's pretty much a "no" to your question, or at least a "maybe, if you're really careful".

    If you want a list of all current TLDs, there is an authoritative list at https://data.iana.org/TLD/tlds-alpha-by-domain.txt (it gets updated along with the root zone).