Use Go and Public Suffix List stored in a Trie to extract top level domain
Run the following code
go get github.com/qwerty22121998/tld
Struct of an URL
type URL struct {
Domain string // domain
Subdomain string // sub domain
TLD string // top level domain
Port string // port
*url.URL // net/url
}
To show the progress
tld.SetDebugMode(true/false) //Default False
To auto update before parse
tld.SetAutoUpdate(true/false) //Default True
To force update the lastest tld list
tld.Update()
To create new Parser
parse := tld.NewParser()
To parse an url
url, err := parse.Parse("http://github.com")