validationdnssubdomaintld

Can a domain consist of only TLD (top level domain)?


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?


Solution

  • 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/