Home > database >  Is gov.uk a tld or a domain?
Is gov.uk a tld or a domain?

Time:10-13

Background

Running this snippet of code in python's interpreter, we get an IP address for gov.uk.

>>> import socket
>>> socket.gethostbyname('gov.uk')
'151.101.64.144'

gov.uk is a TLD according to Wikipedia and the Public Suffix List. Similar TLDs that are also domains include gov.au, gov.br, and s3.amazonaws.com.

In trying to answer this question with python, I tried using urlparse, but I just get a domain blob:

>>> from urllib.parse import urlparse
>>> urlparse('http://gov.uk')
ParseResult(scheme='http', netloc='gov.uk', 
    path='', params='', query='', fragment='')

Using tldextract, it looks like there's no domain or subdomain.

>>> import tldextract
>>> tldextract.extract('https://gov.uk')
ExtractResult(subdomain='', domain='', suffix='gov.uk')

Question

For https://gov.uk, which part is the domain and which part is the TLD?

CodePudding user response:

gov.uk, like .uk, is an Effective TLD or eTLD.

I picked this up from the go package public suffix and the wikipedia page for Public Suffix List.

Mozilla created the Public Suffix List, which is now managed by https://publicsuffix.org/list/. It can be found in Mozilla's Documentation, but this term does not appear anywhere on https://publicsuffix.org/list/ at the time of writing.

  • Related