Documentation
¶
Overview ¶
Package rootdomain provides the ability to extract gTLD or ccTLD(generic or country code top-level domain), the registered domain and subdomain from a url according to the Public Suffix List.
A simple usage:
package main
import (
"fmt" "github.com/AYM1607/rootdomain"
)
func main() { urls := []string{"git+ssh://www.github.com:8443/", "http://media.forums.theregister.co.uk", "http://218.15.32.76", "http://google.com?q=cats"} cache := "/tmp/tld.cache" extract := rootdomain.New(cache,false) for _, u := range (urls) { result:=extract.Extract(u) fmt.Printf("%+v;%s\n",result,u) } }
Index ¶
Constants ¶
View Source
const ( Malformed = iota Domain )
used for Result.Flag
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) GetRootDomain ¶
func (*Result) GetSubDomain ¶
func (*Result) GetTopLevelDomain ¶
type TLDExtract ¶
type TLDExtract struct {
// contains filtered or unexported fields
}
func New ¶
func New(debug bool) (*TLDExtract, error)
New creates a new *TLDExtract, it may be shared between goroutines, we usually need a single instance in an application.
Click to show internal directories.
Click to hide internal directories.