Skip to content

qwerty22121998/tld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

tld

Use Go and Public Suffix List stored in a Trie to extract top level domain

Installation

Run the following code

go get github.com/qwerty22121998/tld

Usage

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")

Reference

go-tld

Trie

Public Suffix List

About

Use Go and https://publicsuffix.org/list/ to extract top level domain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages