Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInMemoryResolver ¶
func NewInMemoryResolver(d *ResolverStub) *net.Resolver
NewInMemoryResolver receives a ResolverStub object with the override functions and returns a resolver that can be used as custom Resolver implementation
Types ¶
type HairpinListener ¶
type HairpinListener struct { PacketHandler packetHandlerFn // contains filtered or unexported fields }
Listener
func (*HairpinListener) Addr ¶
func (h *HairpinListener) Addr() net.Addr
func (*HairpinListener) Close ¶
func (h *HairpinListener) Close() error
type ResolverStub ¶
type ResolverStub 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) }
ResolverStub process dns packets executing the corresponding functions overrides if set
func (*ResolverStub) ProcessDNSRequest ¶
func (r *ResolverStub) ProcessDNSRequest(b []byte) []byte
ProcessDNSRequest is used by the MemoryConn to process the packets Transform a DNS request to the corresponding Golang Lookup function
Click to show internal directories.
Click to hide internal directories.