dns

package
v2.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultExcludeSuffixes = client.DefaultExcludeSuffixes //nolint:gochecknoglobals // constant

Functions

This section is empty.

Types

type ConnPool added in v2.5.4

type ConnPool struct {
	// contains filtered or unexported fields
}

func NewConnPool added in v2.5.4

func NewConnPool(addr netip.Addr, poolSize int) (*ConnPool, error)

func (*ConnPool) Close added in v2.5.4

func (cp *ConnPool) Close()

func (*ConnPool) Exchange added in v2.5.4

func (cp *ConnPool) Exchange(ctx context.Context, client *dns.Client, msg *dns.Msg) (r *dns.Msg, rtt time.Duration, err error)

func (*ConnPool) LocalAddrs added in v2.5.4

func (cp *ConnPool) LocalAddrs() []*net.UDPAddr

func (*ConnPool) RemoteAddr added in v2.5.4

func (cp *ConnPool) RemoteAddr() netip.Addr

type FallbackPool added in v2.5.4

type FallbackPool interface {
	Exchange(context.Context, *dns.Client, *dns.Msg) (*dns.Msg, time.Duration, error)
	RemoteAddr() netip.Addr
	LocalAddrs() []*net.UDPAddr
	Close()
}

type Resolver

type Resolver func(context.Context, *dns.Question) (dnsproxy.RRs, int, error)

type Server

type Server struct {
	sync.RWMutex
	client.DNS
	// contains filtered or unexported fields
}

Server is a DNS server which implements the github.com/miekg/dns Handler interface.

func NewServer

func NewServer(config *client.DNS, clusterLookup Resolver) *Server

NewServer returns a new dns.Server.

func (*Server) GetConfig

func (s *Server) GetConfig() *client.DNS

func (*Server) Ready added in v2.8.0

func (s *Server) Ready() <-chan struct{}

func (*Server) RequestCount

func (s *Server) RequestCount() int

RequestCount returns the number of requests that this server has received.

func (*Server) Run

func (s *Server) Run(c context.Context, initDone chan<- struct{}, listeners []net.PacketConn, fallbackPool FallbackPool, resolve Resolver) error

Run starts the DNS server(s) and waits for them to end.

func (*Server) ServeDNS

func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS is an implementation of github.com/miekg/dns Handler.ServeDNS.

func (*Server) SetClusterDNS added in v2.8.0

func (s *Server) SetClusterDNS(dns *manager.DNS, remoteIP netip.Addr)

func (*Server) SetExcludes added in v2.14.0

func (s *Server) SetExcludes(excludes []string)

SetExcludes sets the excludes list in the config.

func (*Server) SetMappings added in v2.14.0

func (s *Server) SetMappings(mappings []*rpc.DNSMapping)

SetMappings sets the Mappings list in the config.

func (*Server) SetTopLevelDomainsAndSearchPath added in v2.19.0

func (s *Server) SetTopLevelDomainsAndSearchPath(ctx context.Context, domains []string, namespace string)

SetTopLevelDomainsAndSearchPath updates the DNS top level domains and the search path used by the resolver.

func (*Server) Stop added in v2.8.0

func (s *Server) Stop()

func (*Server) Worker

func (s *Server) Worker(c context.Context, dev vif.Device, configureDNS func(netip.Addr, *net.UDPAddr)) error

Notes

Bugs

  • I have no idea why a lookup for localhost even makes it to here on my home WiFi when connecting to a k3sctl cluster (but not a kubernaut.io cluster). But it does, so I need this in order to be productive at home. We should really root-cause this, because it's weird.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL