add more documentation, examples with tests to illustrate reusable components

This commit is contained in:
Mechiel Lukkien
2023-12-12 15:47:26 +01:00
parent 810cbdc61d
commit d1b66035a9
40 changed files with 973 additions and 119 deletions

View 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
}