0

I am building a validation function for domains and was wondering.

Can a valid domain consist of only TLD (or one word domain)?

Example - net com exit museum

Is that a valid domain?

sprunknwn
  • 37
  • 8
  • 1
    `D` in `TLD` means domain, you know. Any node in the DNS tree is a domain, even including root. It all depends what you define by "validation function". For the DNS, on syntax and protocol grounds, a TLD is not a domain different from any other, so yes it is valid. But not necessarily something one might want to use for various reasons explained by some ICANN papers. You should have a look at "Public Suffix List", it may help you in your endeavour, which is for now too vague and without code, so potentially offtopic here. – Patrick Mevzek Oct 18 '21 at 16:13
  • Hi There Patrick, thank you for the feedback. What I meant by Valid is - can a website such as "htt p://com/" exist? or any other TLD on its' own without any subdomain? – sprunknwn Oct 19 '21 at 14:52
  • "can a website such as "htt p://com/" exist?". Technically, yes. In practice, probably no. But some exists, as shown in the answer below. I recommend you look at https://www.icann.org/en/system/files/files/sac-053-en.pdf for further context. ICANN is against those and prohibits gTLDs to publish A/AAAA records at apex, hence making the above not possible (in gTLDs). But those are "administrative" rules. Technically, for the DNS protocol, any name at any level of the tree, including the top, is a domain and can have services attached to it. – Patrick Mevzek Oct 19 '21 at 16:51

1 Answers1

1

Yes. Quick and dirty check:

$ for tld in $(wget -O- -q https://data.iana.org/TLD/tlds-alpha-by-domain.txt); do result=$(dig +short ${tld}. a); if [ -n "$result" ]; then echo "$tld $result"; fi; done

then, for example: http://ai/

Dusan Bajic
  • 10,249
  • 3
  • 33
  • 43
  • Or just look at Wikipedia as the point is fully described there: https://en.wikipedia.org/wiki/Top-level_domain#Dotless_domains or the reference https://datatracker.ietf.org/doc/html/rfc7085 (of course some domains/TLDs may have stopped this practice or others starting it). – Patrick Mevzek Oct 18 '21 at 16:15