Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 932 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 932 Bytes

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