Versions in this module Expand all Collapse all v0 v0.0.1 May 8, 2026 Changes in this version + const DefaultOptimisticAnswerTTL + const DefaultOptimisticMaxAge + const DoQCodeInternalError + const DoQCodeNoError + const DoQCodeProtocolError + const ErrDrop + const ErrEmptyHost + const LogPrefix + const NAT64PrefixLength + const NextProtoDQ + const ServFailMaxCacheTTL + const UnqualifiedNames + func ValidatePrivateConfig(uc *UpstreamConfig, privateSubnets netutil.SubnetSet) (err error) + type BindRetryConfig struct + Count uint + Enabled bool + Interval time.Duration + type Config struct + BindRetryConfig *BindRetryConfig + BogusNXDomain []netip.Prefix + CacheEnabled bool + CacheMaxTTL uint32 + CacheMinTTL uint32 + CacheOptimistic bool + CacheOptimisticAnswerTTL time.Duration + CacheOptimisticMaxAge time.Duration + CacheSizeBytes int + DNS64Prefs []netip.Prefix + DNSCryptProviderName string + DNSCryptResolverCert *dnscrypt.Cert + DNSCryptTCPListenAddr []*net.TCPAddr + DNSCryptUDPListenAddr []*net.UDPAddr + DNSSECEnabled bool + EDNSAddr net.IP + EnableEDNSClientSubnet bool + Fallbacks *UpstreamConfig + FastestPingTimeout time.Duration + HTTPConfig *HTTPConfig + Logger *slog.Logger + MaxGoroutines uint + MessageConstructor MessageConstructor + PendingRequests *PendingRequestsConfig + PreferIPv6 bool + PrivateRDNSUpstreamConfig *UpstreamConfig + PrivateSubnets netutil.SubnetSet + ProxyProtocolV2ReadTimeout time.Duration + QUICListenAddr []*net.UDPAddr + RefuseAny bool + RequestContext contextutil.Constructor + RequestHandler Handler + TCPListenAddr []*net.TCPAddr + TCPProxyProtocolV2Enabled bool + TLSConfig *tls.Config + TLSListenAddr []*net.TCPAddr + TLSProxyProtocolV2Enabled bool + TrustedProxies netutil.SubnetSet + UDPBufferSize int + UDPListenAddr []*net.UDPAddr + UpstreamConfig *UpstreamConfig + UpstreamMode UpstreamMode + UseDNS64 bool + UsePrivateRDNS bool + 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.Conn + 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 DefaultHandler struct + func (DefaultHandler) ServeDNS(ctx context.Context, p *Proxy, proxyCtx *DNSContext) (err error) + type DoQVersion int + const DoQv1 + const DoQv1Draft + type HTTPConfig struct + HTTP3Enabled bool + InsecureEnabled bool + ListenAddresses []netip.AddrPort + ReadTimeout time.Duration + Routes []string + ServerHeader string + Userinfo *url.Userinfo + WriteTimeout time.Duration + type Handler interface + ServeDNS func(ctx context.Context, p *Proxy, dctx *DNSContext) (err error) + func PassThrough(h Handler) (wrapped Handler) + type HandlerFunc func(ctx context.Context, p *Proxy, dctx *DNSContext) (err error) + func (f HandlerFunc) ServeDNS(ctx context.Context, p *Proxy, dctx *DNSContext) (err error) + type MessageConstructor = dnsmsg.MessageConstructor + type Middleware interface + Wrap func(handler Handler) (wrapped Handler) + type MiddlewareFunc func(h Handler) (wrapped Handler) + func (f MiddlewareFunc) Wrap(h Handler) (wrapped Handler) + 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(ctx context.Context, 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 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