Documentation ¶
Overview ¶
Package publicsuffix implements a public suffix list to look up the organizational domain for a given host name. Organizational domains can be registered, one level below a top-level domain.
Example.com has a public suffix ".com", and example.co.uk has a public suffix ".co.uk". The organizational domain of sub.example.com is example.com, and the organization domain of sub.example.co.uk is example.co.uk.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Lookup ¶
Lookup calls Lookup on the builtin public suffix list, from https://publicsuffix.org/list/.
Example ¶
package main import ( "context" "fmt" "log/slog" "github.com/mjl-/mox/dns" "github.com/mjl-/mox/publicsuffix" ) func main() { // Lookup the organizational domain for sub.example.org. orgDom := publicsuffix.Lookup(context.Background(), slog.Default(), dns.Domain{ASCII: "sub.example.org"}) fmt.Println(orgDom) }
Output: example.org
Types ¶
Click to show internal directories.
Click to hide internal directories.