Documentation
¶
Index ¶
- Constants
- Variables
- func ClashDefaultCacheMaxSize() int
- func ClashSetDefaultCacheMaxSize(n int)
- func IsLocalZone(name string) bool
- func MarkSystemSubstitutes(servers []string)
- func ReCreateServer(addr string, lc C.InboundListenConfig, service resolver.Service)
- func RegisterEasyTierDnsClient(name string, client dnsClient) func()
- func RegisterTailscaleDnsClient(name string, client dnsClient) func()
- func SSIDPoliciesInForce() bool
- func SetLocalZoneExchanger(exchange func(context.Context, *D.Msg) (*D.Msg, error))
- func SetSystemResolverDefaults(servers []string)
- func SetSystemSubstituteRefresh(refresh func())
- func SetSystemSubstituteServers(servers []string) bool
- func SetSystemSubstitutesStale(stale bool) bool
- func SystemResolverDefaultAddresses() []string
- func SystemSubstituteServers() []string
- func SystemSubstitutes() []string
- func SystemSubstitutesStale() bool
- type Config
- type EnhancerConfig
- type Explanation
- type NameServer
- type Policy
- type QueryTypes
- type Resolver
- func (r *Resolver) ClearCache()
- func (r *Resolver) CloseQueries()
- func (r *Resolver) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error)
- func (r *Resolver) Explain(ctx context.Context, m *D.Msg, probe bool) Explanation
- func (r *Resolver) HoldsAnswer(q D.Question) bool
- 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)
- func (r *Resolver) ResetConnection()
- func (r *Resolver) ResolveECH(ctx context.Context, host string) ([]byte, error)
- type ResolverEnhancer
- func (h *ResolverEnhancer) AnswersSVCB() bool
- func (h *ResolverEnhancer) FakeIPEnabled() bool
- func (h *ResolverEnhancer) FindHostByIP(ip netip.Addr) (string, bool)
- func (h *ResolverEnhancer) FlushFakeIP() error
- func (h *ResolverEnhancer) IPv6() bool
- 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) ShouldSkipFakeIP(host string) bool
- func (h *ResolverEnhancer) StoreFakePoolState()
- func (h *ResolverEnhancer) UseHosts() bool
- type Resolvers
- type SSIDPolicy
- type Server
- type Service
- type StandaloneClient
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 ( ExplainSourceCache = "cache" ExplainSourceRcode = "rcode" ExplainSourcePolicy = "policy" ExplainSourceFallback = "fallback" ExplainSourceMain = "main" ExplainSourceHosts = "hosts" ExplainSourceFakeIP = "fake-ip" ExplainSourceIPv6Disabled = "ipv6-disabled" ExplainSourceIPStack = "ip-stack" )
View Source
const ( SystemDnsFlushTime = 5 * time.Minute SystemDnsDeleteTimes = 12 // 12*5 = 60min )
View Source
const (
MaxMsgSize = 65535
)
View Source
const NextProtoDQ = "doq"
View Source
const RespectRules = tunnel.DnsRespectRules
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 ClashDefaultCacheMaxSize ¶
func ClashDefaultCacheMaxSize() int
func ClashSetDefaultCacheMaxSize ¶
func ClashSetDefaultCacheMaxSize(n int)
func IsLocalZone ¶
func MarkSystemSubstitutes ¶
func MarkSystemSubstitutes(servers []string)
func ReCreateServer ¶
func ReCreateServer(addr string, lc C.InboundListenConfig, service resolver.Service)
func RegisterEasyTierDnsClient ¶
func RegisterEasyTierDnsClient(name string, client dnsClient) func()
func RegisterTailscaleDnsClient ¶
func RegisterTailscaleDnsClient(name string, client dnsClient) func()
func SSIDPoliciesInForce ¶
func SSIDPoliciesInForce() bool
func SetLocalZoneExchanger ¶
func SetSystemResolverDefaults ¶
func SetSystemResolverDefaults(servers []string)
func SetSystemSubstituteRefresh ¶
func SetSystemSubstituteRefresh(refresh func())
func SystemResolverDefaultAddresses ¶
func SystemResolverDefaultAddresses() []string
func SystemSubstituteServers ¶
func SystemSubstituteServers() []string
func SystemSubstitutes ¶
func SystemSubstitutes() []string
func SystemSubstitutesStale ¶
func SystemSubstitutesStale() bool
Types ¶
type Config ¶
type Config struct {
Main, Fallback []NameServer
Default []NameServer
ProxyServer []NameServer
DirectServer []NameServer
DirectFollowPolicy bool
IPv6 bool
IPv6Timeout uint
FallbackIPFilter []C.IpMatcher
FallbackDomainFilter []C.DomainMatcher
FallbackLazyQuery bool
Policy []Policy
ProxyServerPolicy []Policy
SSIDPolicy []SSIDPolicy
CacheAlgorithm string
CacheMaxSize int
}
type EnhancerConfig ¶
type Explanation ¶
type NameServer ¶
type NameServer struct {
Net string
Addr string
ProxyAdapter C.ProxyAdapter
ProxyName string
Params map[string]string
PreferH3 bool
}
func (NameServer) Equal ¶
func (ns NameServer) Equal(ns2 NameServer) bool
type Policy ¶
type Policy struct {
Domain string
Matcher C.DomainMatcher
NameServers []NameServer
}
type QueryTypes ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolverFromClient ¶
func NewResolverFromClient(client dnsClient) *Resolver
func (*Resolver) ClearCache ¶
func (r *Resolver) ClearCache()
func (*Resolver) CloseQueries ¶
func (r *Resolver) CloseQueries()
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
func (*Resolver) LookupIPv6 ¶
LookupIPv6 request with TypeAAAA
func (*Resolver) ResetConnection ¶
func (r *Resolver) ResetConnection()
type ResolverEnhancer ¶
type ResolverEnhancer struct {
// contains filtered or unexported fields
}
func NewEnhancer ¶
func NewEnhancer(cfg EnhancerConfig) *ResolverEnhancer
func (*ResolverEnhancer) AnswersSVCB ¶
func (h *ResolverEnhancer) AnswersSVCB() bool
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) IPv6 ¶
func (h *ResolverEnhancer) IPv6() bool
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) ShouldSkipFakeIP ¶
func (h *ResolverEnhancer) ShouldSkipFakeIP(host string) bool
func (*ResolverEnhancer) StoreFakePoolState ¶
func (h *ResolverEnhancer) StoreFakePoolState()
func (*ResolverEnhancer) UseHosts ¶
func (h *ResolverEnhancer) UseHosts() bool
type Resolvers ¶
func NewResolver ¶
func (Resolvers) ClearCache ¶
func (rs Resolvers) ClearCache()
func (Resolvers) CloseQueries ¶
func (rs Resolvers) CloseQueries()
func (Resolvers) ResetConnection ¶
func (rs Resolvers) ResetConnection()
type SSIDPolicy ¶
type SSIDPolicy struct {
SSID string
NameServers []NameServer
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) SetService ¶
func (*Server) TCPHandler ¶
func (*Server) UDPHandler ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(resolver resolver.Resolver, mapper *ResolverEnhancer) *Service
type StandaloneClient ¶
type StandaloneClient interface {
ExchangeContext(ctx context.Context, m *D.Msg) (*D.Msg, error)
ResetConnection()
}
func NewStandaloneClient ¶
func NewStandaloneClient(server NameServer, r resolver.Resolver) StandaloneClient
Source Files
¶
- clash_cache_default.go
- clash_local_zone.go
- clash_query_types.go
- clash_ssid_policy.go
- clash_standalone.go
- clash_system_substitute.go
- client.go
- dhcp.go
- dialer.go
- doh.go
- doq.go
- dot.go
- easytier.go
- edns0_subnet.go
- enhancer.go
- explain.go
- middleware.go
- policy.go
- rcode.go
- resolver.go
- server.go
- service.go
- system.go
- system_common.go
- system_posix.go
- tailscale.go
- util.go
Click to show internal directories.
Click to hide internal directories.