开发者

Universal list of domain endings?

开发者 https://www.devze.com 2023-04-02 23:03 出处:网络
Does anyone know where I could find a list of all publicly available domain endings? By \"domain endings\", I\'m not necessarily referring to TLDs as I\'m not interested in the .uk part of .co.uk sinc

Does anyone know where I could find a list of all publicly available domain endings? By "domain endings", I'm not necessarily referring to TLDs as I'm not interested in the .uk part of .co.uk since (AFAIK) individuals cannot register sites without having the .co preceding it.

If it helps to make things more concrete, here's my specific problem: given a domain name I want to return both t开发者_高级运维he version of the domain preceded by www and the version not preceded by www. The input domain may or may not contain www.

The complication comes from the existence of domain names such as "www.com" or "www.info"; what I initially implemented would take www.info and return info and www.info.


I don't think you actually need to have a list of domain names:

given a domain name I want to return both the version of the domain preceded by www and the version not preceded by www

Pseudocode:

input name
does it begin with "www."?
  if yes, strip out "www."
there's your domain name, save it
prepend "www." to domain name
save the result
lookup in DNS both the saved entries
if they exist, output them


You can get the list of current TLDs in many ways, slightly differently.

For example:

  1. Going to IANA website at https://www.iana.org/domains/root/db (this is frequently updated after a new TLD got delegated in root zone)
  2. Or just download the root zone file through the appropriate links: http://www.internic.net/domain/root.zone or ftp://rs.internic.net/domain/root.zone
  3. You could also just query one of the current root nameservers that allow AXFR requests to just download the current root zonefile, such as dig @f.root-servers.net . AXFR with the added benefit that this is protected by DNSSEC (where the previous HTTP URL has no protection against tampering)

Of course this gives you only "Top Level Domains" not all "suffixes" under which a registry exists to allow the public (in general or part of it) to register domain names. Having the list of those is currently still an unsolved problems, if you take into account the needs of automated process, freshness, decentralization of updates, etc.

The best solution is to use the Public Suffix List at https://publicsuffix.org/list/public_suffix_list.dat but first make sure to go to main site at https://publicsuffix.org/learn/ to learn in details about what it is, how to use it and its shortcomings. You will find co.uk there.

But as for your:

in the .uk part of .co.uk since (AFAIK) individuals cannot register sites without having the .co preceding it.

This is not true anymore, showing that eligibility requirements in TLDs, or even structure, change over time. .UK is open to direct registrations now, see https://www.nominet.uk/domains/our-domains/uk-domains/

And also, side rant, when you work with domain names/TLDs please do not forget about IDNs, that could happen in any label in the DNS.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号