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
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
Upstream upstream.Upstream // upstream that was chosen
UpstreamIdx int // upstream index
}
DNSContext represents a DNS request message context
type Handler ¶
type Handler interface {
// ServeDNS can modify the DNSContext instance in any way
// and should call next.ServeDNS to continue the execution
ServeDNS(d *DNSContext, next Handler) error
}
Handler is an optional middleware interface
type Proxy ¶
Proxy combines the proxy server state and configuration
func (*Proxy) ServeDNS ¶
func (p *Proxy) ServeDNS(d *DNSContext, next Handler) error
ServeDNS is a Handler implementation. If there is a custom middleware supplied, *p will be passed to it
Click to show internal directories.
Click to hide internal directories.