Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMemoryResolver ¶
func NewMemoryResolver(r *MemResolver) *net.Resolver
MemoryResolver returns an in-memory resolver that can override golang Lookup functions.
Types ¶
type MemResolver ¶
type MemResolver struct { LookupAddr func(ctx context.Context, addr string) (names []string, err error) LookupCNAME func(ctx context.Context, host string) (cname string, err error) LookupHost func(ctx context.Context, host string) (addrs []string, err error) LookupIP func(ctx context.Context, network, host string) ([]net.IP, error) LookupMX func(ctx context.Context, name string) ([]*net.MX, error) LookupNS func(ctx context.Context, name string) ([]*net.NS, error) LookupPort func(ctx context.Context, network, service string) (port int, err error) LookupSRV func(ctx context.Context, service, proto, name string) (cname string, addrs []*net.SRV, err error) LookupTXT func(ctx context.Context, name string) ([]string, error) }
MemResolver implement an in memory resolver that receives DNS questions and executes the corresponding Lookup functions. If the corresponding Lookup function is not present, it uses the DefaultResolver ones.
func (*MemResolver) ProcessDNSRequest ¶
func (r *MemResolver) ProcessDNSRequest(id uint16, q dnsmessage.Question) []byte
ProcessDNSRequest implements dnsHandlerFunc so it can be used in a MemResolver transforming a DNS request to the corresponding Golang Lookup functions.
Click to show internal directories.
Click to hide internal directories.