域名后缀的通用列表?

发布于 2024-12-03 03:39:50 字数 277 浏览 2 评论 0原文

有谁知道我在哪里可以找到所有公开可用的域名后缀的列表?我所说的“域名后缀”不一定是指 TLD,因为我对 .co.uk 的 .uk 部分不感兴趣,因为(据我所知)个人无法在前面没有 .co 的情况下注册网站。

如果它有助于使事情变得更具体,这是我的具体问题:给定一个域名,我想返回以 www 开头的域版本和不以 www 开头的版本。输入域可能包含也可能不包含 www。

复杂性来自于“www.com”或“www.info”等域名的存在;我最初实现的是 www.info 并返回 info 和 www.info。

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 the 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉殇 2024-12-10 03:39:50

我认为您实际上不需要拥有域名列表:

给定一个域名,我想返回以 www 开头的域名版本和以 www 开头的域名版本

伪代码:

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

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
つ低調成傷 2024-12-10 03:39:50

您可以通过多种方式获取当前 TLD 列表,但略有不同。

例如:

  1. 访问 IANA 网站 https://www.iana.org/domains/root/ db(在根区域中委派新 TLD 后会经常更新)
  2. 或者只需通过相应的链接下载根区域文件:http://www.internic.net/domain/root.zoneftp://rs.internic.net/domain/root.zone
  3. 您还可以查询当前根名称服务器之一,该服务器允许 AXFR 请求仅下载当前根区域文件,例如挖掘@f.root-servers.net 。 AXFR 的另一个好处是受 DNSSEC 保护(之前的 HTTP URL 没有防篡改保护)。

当然,这只会为您提供“顶级域名”,而不是注册表允许的所有“后缀”公众(总体或部分公众)注册域名。
如果考虑到自动化流程、新鲜度、更新分散化等需求,拥有这些列表目前仍然是一个未解决的问题。

最好的解决方案是使用公共后缀列表 https://publicsuffix.org/list/public_suffix_list.dat 但首先确保去到主网站 https://publicsuffix.org/learn/ 详细了解它是什么,如何使用它以及它的缺点。
您会在那里找到 co.uk

但至于你的:

在 .co.uk 的 .uk 部分,因为(据我所知)个人无法在前面没有 .co 的情况下注册网站。

现在情况已不再如此,这表明顶级域名 (TLD) 的资格要求甚至结构会随着时间的推移而发生变化。 .UK 现已开放直接注册,请参阅 https://www.nominet.uk/domains/our-domains/uk-domains/

另外,顺便说一句,当您使用域名/TLD 时,请不要忘记 IDN,这可能发生在任何地方标签在域名系统。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文