Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

dns - Is it possible to have one (single) character top level domain name?

I'm writing a Regex to validate email. The only one thing confuse me is:

Is it possible to have single character for top level domain name? (e.g.: lockevn.c)

Background: I knew top level domain name can be from 2 characters to anything (.uk, .us to .canon, .museum). I read some documents but I can't figure out does it allow 1 character or not.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is technically possible, however, there are no single character tlds that have been accepted into the root (as of the moment) so the answer is:

Yes, it is possible to have single character for top level domain name, however, there are currently no single character TLDs in the root.

You can see the list of TLDs that are currently in the root at this URL:

RFC-952 shows what a "name" is, this includes what is valid as a top level domain:

A "name" (Net, Host, Gateway, or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
sign (-), and period (.).

Additionally, the grammar from RFC-952 shows:

 <name>  ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]

RFC-1123 section 2.1 specifically allowed single letter domains & subdomains, changing the initial grammar of RFC-952 from starting with just a letter to being more relaxed, so now you are allowed to have single letter top level domains that are a number:

2.1  Host Names and Numbers

   The syntax of a legal Internet host name was specified in RFC-952.
   One aspect of host name syntax is hereby changed: the
   restriction on the first character is relaxed to allow either a
   letter or a digit.  Host software MUST support this more liberal
   syntax.

EDIT: As per @mr.spuratic's comment, RFC-3696 section 2 tightened the rules for top level domains, stating:

     There is an additional rule that essentially requires
     that top-level domain names not be all-numeric.

This means that:

  • a. is a valid top level domain
  • 1. is not a valid top level domain

A very unscientific test of this shows that if I add "a" into my hosts file pointing to my local machine, going to http://a in my address bar does show my Apache welcome page.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...