Documentation ¶
Index ¶
- Constants
- Variables
- func AddPrefix(b []byte) (m []byte)
- func NewDomainFilter(domains []string) *domainFilter
- func NewGeoSite(group string) (fallbackDomainFilter, error)
- func NewHandler(resolver *Resolver, mapper *ResolverEnhancer) handler
- func ReCreateServer(addr string, resolver *Resolver, mapper *ResolverEnhancer)
- func UpdateIsolateHandler(resolver *Resolver, mapper *ResolverEnhancer)
- type Config
- type FallbackFilter
- type LocalServer
- type NameServer
- type Resolver
- func (r *Resolver) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error)
- func (r *Resolver) Invalid() bool
- func (r *Resolver) LookupIP(ctx context.Context, host string) (ips []netip.Addr, err error)
- func (r *Resolver) LookupIPPrimaryIPv4(ctx context.Context, host string) (ips []netip.Addr, err error)
- func (r *Resolver) LookupIPv4(ctx context.Context, host string) ([]netip.Addr, error)
- func (r *Resolver) LookupIPv6(ctx context.Context, host string) ([]netip.Addr, error)
- type ResolverEnhancer
- func (h *ResolverEnhancer) FakeIPEnabled() bool
- func (h *ResolverEnhancer) FindHostByIP(ip netip.Addr) (string, bool)
- func (h *ResolverEnhancer) FlushFakeIP() error
- func (h *ResolverEnhancer) InsertHostByIP(ip netip.Addr, host string)
- func (h *ResolverEnhancer) IsExistFakeIP(ip netip.Addr) bool
- func (h *ResolverEnhancer) IsFakeBroadcastIP(ip netip.Addr) bool
- func (h *ResolverEnhancer) IsFakeIP(ip netip.Addr) bool
- func (h *ResolverEnhancer) MappingEnabled() bool
- func (h *ResolverEnhancer) PatchFrom(o *ResolverEnhancer)
- func (h *ResolverEnhancer) StoreFakePoolState()
- type Server
Constants ¶
View Source
const ( // QUICCodeNoError is used when the connection or stream needs to be closed, // but there is no error to signal. QUICCodeNoError = quic.ApplicationErrorCode(0) // QUICCodeInternalError signals that the DoQ implementation encountered // an internal error and is incapable of pursuing the transaction or the // connection. QUICCodeInternalError = quic.ApplicationErrorCode(1) // QUICKeepAlivePeriod is the value that we pass to *quic.Config and that // controls the period with with keep-alive frames are being sent to the // connection. We set it to 20s as it would be in the quic-go@v0.27.1 with // KeepAlive field set to true This value is specified in // https://pkg.go.dev/github.com/metacubex/quic-go/internal/protocol#MaxKeepAliveInterval. // // TODO(ameshkov): Consider making it configurable. QUICKeepAlivePeriod = time.Second * 20 DefaultTimeout = time.Second * 5 )
View Source
const ( SystemDnsFlushTime = 5 * time.Minute SystemDnsDeleteTimes = 12 // 12*5 = 60min )
View Source
const (
MaxMsgSize = 65535
)
View Source
const NextProtoDQ = "doq"
Variables ¶
View Source
var DefaultHTTPVersions = []C.HTTPVersion{C.HTTPVersion11, C.HTTPVersion2}
View Source
var ParseNameServer func(servers []string) ([]NameServer, error) // define in config/config.go
Functions ¶
func NewDomainFilter ¶
func NewDomainFilter(domains []string) *domainFilter
func NewGeoSite ¶
func NewHandler ¶
func NewHandler(resolver *Resolver, mapper *ResolverEnhancer) handler
func ReCreateServer ¶
func ReCreateServer(addr string, resolver *Resolver, mapper *ResolverEnhancer)
func UpdateIsolateHandler ¶
func UpdateIsolateHandler(resolver *Resolver, mapper *ResolverEnhancer)
Types ¶
type Config ¶
type Config struct {
Main, Fallback []NameServer
Default []NameServer
ProxyServer []NameServer
IPv6 bool
IPv6Timeout uint
EnhancedMode C.DNSMode
FallbackFilter FallbackFilter
Pool *fakeip.Pool
Hosts *trie.DomainTrie[resolver.HostValue]
Policy *orderedmap.OrderedMap[string, []NameServer]
RuleProviders map[string]provider.RuleProvider
CacheAlgorithm string
}
type FallbackFilter ¶
type LocalServer ¶
type LocalServer struct {
// contains filtered or unexported fields
}
func NewLocalServer ¶
func NewLocalServer(resolver *Resolver, mapper *ResolverEnhancer) *LocalServer
type NameServer ¶
type NameServer struct { Net string Addr string Interface string ProxyAdapter C.ProxyAdapter ProxyName string Params map[string]string PreferH3 bool }
func (NameServer) Equal ¶
func (ns NameServer) Equal(ns2 NameServer) bool
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) ExchangeContext ¶
ExchangeContext a batch of dns request with context.Context, and it use cache
func (*Resolver) LookupIPPrimaryIPv4 ¶
func (*Resolver) LookupIPv4 ¶
LookupIPv4 request with TypeA
type ResolverEnhancer ¶
type ResolverEnhancer struct {
// contains filtered or unexported fields
}
func NewEnhancer ¶
func NewEnhancer(cfg Config) *ResolverEnhancer
func (*ResolverEnhancer) FakeIPEnabled ¶
func (h *ResolverEnhancer) FakeIPEnabled() bool
func (*ResolverEnhancer) FindHostByIP ¶
func (h *ResolverEnhancer) FindHostByIP(ip netip.Addr) (string, bool)
func (*ResolverEnhancer) FlushFakeIP ¶
func (h *ResolverEnhancer) FlushFakeIP() error
func (*ResolverEnhancer) InsertHostByIP ¶
func (h *ResolverEnhancer) InsertHostByIP(ip netip.Addr, host string)
func (*ResolverEnhancer) IsExistFakeIP ¶
func (h *ResolverEnhancer) IsExistFakeIP(ip netip.Addr) bool
func (*ResolverEnhancer) IsFakeBroadcastIP ¶
func (h *ResolverEnhancer) IsFakeBroadcastIP(ip netip.Addr) bool
func (*ResolverEnhancer) MappingEnabled ¶
func (h *ResolverEnhancer) MappingEnabled() bool
func (*ResolverEnhancer) PatchFrom ¶
func (h *ResolverEnhancer) PatchFrom(o *ResolverEnhancer)
func (*ResolverEnhancer) StoreFakePoolState ¶
func (h *ResolverEnhancer) StoreFakePoolState()
Click to show internal directories.
Click to hide internal directories.