···33import (
44 "context"
55 "fmt"
66+ "net"
77+ "net/http"
6879 "github.com/bluesky-social/indigo/atproto/syntax"
810)
9111212+// The zero value ('BaseDirectory{}') is a usable Directory.
1013type BaseDirectory struct {
1414+ // if non-empty, this string should have URL method, hostname, and optional port; it should not have a path or trailing slash
1115 PLCURL string
1616+ // HTTP client used for did:web, did:plc, and HTTP (well-known) handle resolution
1717+ HTTPClient http.Client
1818+ // DNS resolver used for DNS handle resolution. Calling code can use a custom Dialer to query against a specific DNS server, or re-implement the interface for even more control over the resolution process
1919+ Resolver net.Resolver
1220}
13211422var _ Directory = (*BaseDirectory)(nil)
1515-1616-func NewBaseDirectory(plcURL string) BaseDirectory {
1717- if plcURL == "" {
1818- plcURL = DefaultPLCURL
1919- }
2020- return BaseDirectory{
2121- PLCURL: plcURL,
2222- }
2323-}
24232524func (d *BaseDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) {
2625 did, err := d.ResolveHandle(ctx, h)