Versions in this module Expand all Collapse all v1 v1.9999.9999 Jul 8, 2025 v1.75.6 Jul 8, 2025 Changes in this version + const DoQCodeInternalError + const DoQCodeNoError + const DoQCodeProtocolError + const ErrEmptyHost + const LogPrefix + const NAT64PrefixLength + const NextProtoDQ + const ServFailMaxCacheTTL + const UnqualifiedNames + func ValidatePrivateConfig(uc *UpstreamConfig, privateSubnets netutil.SubnetSet) (err error) + type BeforeRequestError struct + Err error + Response *dns.Msg + func (e *BeforeRequestError) Error() (msg string) + func (e *BeforeRequestError) Unwrap() (unwrapped error) + type BeforeRequestHandler interface + HandleBefore func(p *Proxy, dctx *DNSContext) (err error) + type BindRetryConfig struct + Count uint + Enabled bool + Interval time.Duration + type Config struct + BeforeRequestHandler BeforeRequestHandler + BindRetryConfig *BindRetryConfig + BogusNXDomain []netip.Prefix + CacheEnabled bool + CacheMaxTTL uint32 + CacheMinTTL uint32 + CacheOptimistic bool + CacheSizeBytes int + DNS64Prefs []netip.Prefix + DNSCryptProviderName string + DNSCryptResolverCert *dnscrypt.Cert + DNSCryptTCPListenAddr []*net.TCPAddr + DNSCryptUDPListenAddr []*net.UDPAddr + EDNSAddr net.IP + EnableEDNSClientSubnet bool + Fallbacks *UpstreamConfig + FastestPingTimeout time.Duration + HTTP3 bool + HTTPSListenAddr []*net.TCPAddr + HTTPSServerName string + Logger *slog.Logger + MaxGoroutines uint + MessageConstructor MessageConstructor + PendingRequests *PendingRequestsConfig + PreferIPv6 bool + PrivateRDNSUpstreamConfig *UpstreamConfig + PrivateSubnets netutil.SubnetSet + QUICListenAddr []*net.UDPAddr + Ratelimit int + RatelimitSubnetLenIPv4 int + RatelimitSubnetLenIPv6 int + RatelimitWhitelist []netip.Addr + RefuseAny bool + RequestHandler RequestHandler + ResponseHandler ResponseHandler + TCPListenAddr []*net.TCPAddr + TLSConfig *tls.Config + TLSListenAddr []*net.TCPAddr + TrustedProxies netutil.SubnetSet + UDPBufferSize int + UDPListenAddr []*net.UDPAddr + UpstreamConfig *UpstreamConfig + UpstreamMode UpstreamMode + UseDNS64 bool + UsePrivateRDNS bool + Userinfo *url.Userinfo + type CustomUpstreamConfig struct + func NewCustomUpstreamConfig(u *UpstreamConfig, cacheEnabled bool, cacheSize int, ...) (c *CustomUpstreamConfig) + func (c *CustomUpstreamConfig) ClearCache() + func (c *CustomUpstreamConfig) Close() (err error) + type DNSContext struct + Addr netip.AddrPort + Conn net.Conn + CustomUpstreamConfig *CustomUpstreamConfig + DNSCryptResponseWriter dnscrypt.ResponseWriter + DoQVersion DoQVersion + HTTPRequest *http.Request + HTTPResponseWriter http.ResponseWriter + IsPrivateClient bool + Proto Proto + QUICConnection quic.Connection + QUICStream quic.Stream + Req *dns.Msg + ReqECS *net.IPNet + RequestID uint64 + RequestedPrivateRDNS netip.Prefix + Res *dns.Msg + Upstream upstream.Upstream + func (dctx *DNSContext) QueryStatistics() (s *QueryStatistics) + type DoQVersion int + const DoQv1 + const DoQv1Draft + type MessageConstructor = dnsmsg.MessageConstructor + type ParseError struct + Idx int + func (e *ParseError) Error() (msg string) + func (e *ParseError) Unwrap() (unwrapped error) + type PendingRequestsConfig struct + Enabled bool + type Proto string + const ProtoDNSCrypt + const ProtoHTTPS + const ProtoQUIC + const ProtoTCP + const ProtoTLS + const ProtoUDP + type Proxy struct + func New(c *Config) (p *Proxy, err error) + func (p *Proxy) Addr(proto Proto) (addr net.Addr) + func (p *Proxy) Addrs(proto Proto) (addrs []net.Addr) + func (p *Proxy) ClearCache() + func (p *Proxy) LookupNetIP(ctx context.Context, _ string, host string) (addrs []netip.Addr, err error) + func (p *Proxy) Resolve(dctx *DNSContext) (err error) + func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (p *Proxy) Shutdown(ctx context.Context) (err error) + func (p *Proxy) Start(ctx context.Context) (err error) + type QueryStatistics struct + func (s *QueryStatistics) Fallback() (us []*UpstreamStatistics) + func (s *QueryStatistics) Main() (us []*UpstreamStatistics) + type RequestHandler func(p *Proxy, dctx *DNSContext) (err error) + type ResponseHandler func(dctx *DNSContext, err error) + type UpstreamConfig struct + DomainReservedUpstreams map[string][]upstream.Upstream + SpecifiedDomainUpstreams map[string][]upstream.Upstream + SubdomainExclusions *container.MapSet[string] + Upstreams []upstream.Upstream + func ParseUpstreamsConfig(lines []string, opts *upstream.Options) (conf *UpstreamConfig, err error) + func (uc *UpstreamConfig) Close() (err error) + type UpstreamMode string + const UpstreamModeFastestAddr + const UpstreamModeLoadBalance + const UpstreamModeParallel + func (m *UpstreamMode) UnmarshalText(b []byte) (err error) + func (m UpstreamMode) MarshalText() (text []byte, err error) + type UpstreamStatistics struct + Address string + Error error + IsCached bool + QueryDuration time.Duration