Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
UDPListenAddr *net.UDPAddr // if nil, then it does not listen for UDP
TCPListenAddr *net.TCPAddr // if nil, then it does not listen for TCP
TLSListenAddr *net.TCPAddr // if nil, then it does not listen for TLS (DoT)
TLSConfig *tls.Config // necessary for listening for TLS
Ratelimit int // max number of requests per second from a given IP (0 to disable)
RatelimitWhitelist []string // a list of whitelisted client IP addresses
RefuseAny bool // if true, refuse ANY requests
CacheEnabled bool // cache status
Upstreams []upstream.Upstream // list of upstreams
Fallback upstream.Upstream // fallback resolver (which will be used if regular upstream failed to answer)
Handler Handler // custom middleware (optional)
}
Config contains all the fields necessary for proxy configuration
type DNSContext ¶
type DNSContext struct {
Proto string // "udp", "tcp", "tls", "https"
Req *dns.Msg // DNS request
Res *dns.Msg // DNS response from an upstream
Conn net.Conn // underlying client connection
Addr net.Addr // client address
StartTime time.Time // processing start time
Upstream upstream.Upstream // upstream that was chosen
UpstreamIdx int // upstream index
}
DNSContext represents a DNS request message context
type Handler ¶
type Handler func(p *Proxy, d *DNSContext) error
Handler is an optional custom handler for DNS requests It is called instead of the default method (Proxy.Resolve()) See handler_test.go for examples
type Proxy ¶
Proxy combines the proxy server state and configuration
func (*Proxy) Addr ¶ added in v0.9.1
Addr returns the listen address for the specified proto or null if the proxy does not listen to it
func (*Proxy) Resolve ¶ added in v0.9.1
func (p *Proxy) Resolve(d *DNSContext) error
Resolve is the default resolving method used by the DNS proxy to query upstreams
Click to show internal directories.
Click to hide internal directories.