mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 11:44:38 +03:00
add more documentation, examples with tests to illustrate reusable components
This commit is contained in:
18
publicsuffix/examples_test.go
Normal file
18
publicsuffix/examples_test.go
Normal file
@ -0,0 +1,18 @@
|
||||
package publicsuffix_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
|
||||
"github.com/mjl-/mox/dns"
|
||||
"github.com/mjl-/mox/publicsuffix"
|
||||
)
|
||||
|
||||
func ExampleLookup() {
|
||||
// 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
|
||||
}
|
Reference in New Issue
Block a user