Documentation
¶
Index ¶
- Variables
- func FakeIP4Prefix() *netip.Prefix
- func FakeIP6Prefix() *netip.Prefix
- func FakeIPEnabled() bool
- func FindHostByIP(ip netip.Addr) (string, bool)
- func FlushFakeIP() error
- func GetProxy(ctx context.Context) (string, bool)
- func IsExistFakeIP(ip netip.Addr) bool
- func IsFakeBroadcastIP(ip netip.Addr) bool
- func IsFakeIP(ip netip.Addr) bool
- func IsProxyServer(ctx context.Context) bool
- func IsRemote(ctx context.Context) bool
- func LookupECHForProxyServer(host string) ([]byte, error)
- func LookupIP(ctx context.Context, host string) ([]netip.Addr, error)
- func LookupIPByProxy(ctx context.Context, host, proxy string) ([]netip.Addr, error)
- func LookupIPByResolver(ctx context.Context, host string, r Resolver) ([]netip.Addr, error)
- func LookupIPv4(ctx context.Context, host string) ([]netip.Addr, error)
- func LookupIPv4ByProxy(ctx context.Context, host, proxy string) ([]netip.Addr, error)
- func LookupIPv6(ctx context.Context, host string) ([]netip.Addr, error)
- func LookupIPv6ByProxy(ctx context.Context, host, proxy string) ([]netip.Addr, error)
- func MappingEnabled() bool
- func RemoveCache(host string)
- func ResolveIP(host string) (netip.Addr, error)
- func ResolveIPWithContext(ctx context.Context, host string) (netip.Addr, error)
- func ResolveIPv4(host string) (netip.Addr, error)
- func ResolveIPv4ProxyServerHost(host string) (netip.Addr, error)
- func ResolveIPv4ProxyServerHostWithContext(ctx context.Context, host string) (netip.Addr, error)
- func ResolveIPv4WithContext(ctx context.Context, host string) (netip.Addr, error)
- func ResolveIPv6(host string) (netip.Addr, error)
- func ResolveIPv6ProxyServerHost(host string) (netip.Addr, error)
- func ResolveIPv6ProxyServerHostWithContext(ctx context.Context, host string) (netip.Addr, error)
- func ResolveIPv6WithContext(ctx context.Context, host string) (netip.Addr, error)
- func ResolveProxyServerHost(host string) (netip.Addr, error)
- func ResolveProxyServerHostWithContext(ctx context.Context, host string) (netip.Addr, error)
- func ServeMsg(msg *D.Msg) (*D.Msg, error)
- func SetDisableIPv6(v bool)
- func SetECHConfigList(cfg *tls.Config) bool
- func SniffingEnabled() bool
- func StoreFakePoolState()
- func WithProxy(ctx context.Context, proxy string) context.Context
- func WithoutProxy(ctx context.Context) context.Context
- func WithoutProxyServer(ctx context.Context) context.Context
- type Enhancer
- type LocalServer
- type Resolver
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultResolver aim to resolve ip DefaultResolver Resolver // DisableIPv6 means don't resolve ipv6 host // default value is true DisableIPv6 = true // RemoteDnsResolve reports whether TCP/UDP handler should be remote resolve DNS // default value is true RemoteDnsResolve = true // DefaultHosts aim to resolve hosts DefaultHosts = trie.New[netip.Addr]() // DefaultDNSTimeout defined the default dns request timeout DefaultDNSTimeout = time.Second * 5 )
var ( ErrIPNotFound = errors.New("can not find ip") ErrIPVersion = errors.New("ip version error") ErrIPv6Disabled = errors.New("ipv6 disabled") ErrECHNotFound = errors.New("can not find ECH") ErrECHNotSupport = errors.New("can not lookup ECH by unsafe client") ErrECHServerReject = errors.New("tls: server rejected ECH") )
Functions ¶
func FakeIP4Prefix ¶ added in v1.70.0
func FakeIP6Prefix ¶ added in v1.70.0
func FakeIPEnabled ¶
func FakeIPEnabled() bool
func FlushFakeIP ¶
func FlushFakeIP() error
func IsExistFakeIP ¶
func IsFakeBroadcastIP ¶
func IsProxyServer ¶
IsProxyServer reports whether the DefaultResolver should be exchanged by proxyServer DNS client
func IsRemote ¶
IsRemote reports whether the DefaultResolver should be exchanged by remote DNS client
func LookupECHForProxyServer ¶ added in v1.68.0
LookupECHForProxyServer with a host, return ECH config list
func LookupIPByProxy ¶
LookupIPByProxy with a host and proxy, reports force combined ipv6 list whether the DisableIPv6 value is true
func LookupIPByResolver ¶
LookupIPByResolver same as ResolveIP, but with a resolver
func LookupIPv4 ¶
LookupIPv4 with a host, return ipv4 list
func LookupIPv4ByProxy ¶
LookupIPv4ByProxy with a host and proxy, reports ipv4 list
func LookupIPv6 ¶
LookupIPv6 with a host, return ipv6 list
func LookupIPv6ByProxy ¶
LookupIPv6ByProxy with a host and proxy, reports ipv6 list whether the DisableIPv6 value is true
func MappingEnabled ¶
func MappingEnabled() bool
func ResolveIPWithContext ¶ added in v1.81.0
ResolveIPWithContext with a host, return ip
func ResolveIPv4 ¶
ResolveIPv4 with a host, return ipv4
func ResolveIPv4ProxyServerHost ¶
ResolveIPv4ProxyServerHost proxies server host only
func ResolveIPv4ProxyServerHostWithContext ¶ added in v1.81.0
ResolveIPv4ProxyServerHostWithContext proxies server host only
func ResolveIPv4WithContext ¶ added in v1.81.0
ResolveIPv4WithContext with a host, return ipv4
func ResolveIPv6 ¶
ResolveIPv6 with a host, return ipv6
func ResolveIPv6ProxyServerHost ¶
ResolveIPv6ProxyServerHost proxies server host only
func ResolveIPv6ProxyServerHostWithContext ¶ added in v1.81.0
ResolveIPv6ProxyServerHostWithContext proxies server host only
func ResolveIPv6WithContext ¶ added in v1.81.0
ResolveIPv6WithContext with a host, return ipv6
func ResolveProxyServerHost ¶
ResolveProxyServerHost proxies server host only
func ResolveProxyServerHostWithContext ¶ added in v1.81.0
ResolveProxyServerHostWithContext proxies server host only
func SetDisableIPv6 ¶
func SetDisableIPv6(v bool)
SetDisableIPv6 set DisableIPv6 & needProxyHostIPv6 value
func SetECHConfigList ¶ added in v1.68.0
func SniffingEnabled ¶
func SniffingEnabled() bool
func StoreFakePoolState ¶
func StoreFakePoolState()
func WithoutProxy ¶ added in v1.81.0
WithoutProxy returns a new context without proxy name
Types ¶
type Enhancer ¶
type Enhancer interface {
FakeIPEnabled() bool
MappingEnabled() bool
SniffingEnabled() bool
IsFakeIP(netip.Addr) bool
IsFakeBroadcastIP(netip.Addr) bool
IsExistFakeIP(netip.Addr) bool
FindHostByIP(netip.Addr) (string, bool)
FakeIP4Prefix() *netip.Prefix
FakeIP6Prefix() *netip.Prefix
FlushFakeIP() error
StoreFakePoolState()
}
var DefaultHostMapper Enhancer
type LocalServer ¶
var DefaultLocalServer LocalServer
type Resolver ¶
type Resolver interface {
LookupIP(ctx context.Context, host string) ([]netip.Addr, error)
LookupIPv4(ctx context.Context, host string) ([]netip.Addr, error)
LookupIPv6(ctx context.Context, host string) ([]netip.Addr, error)
LookupECH(ctx context.Context, host string) ([]byte, error)
ResolveIP(host string) (ip netip.Addr, err error)
ResolveIPv4(host string) (ip netip.Addr, err error)
ResolveIPv6(host string) (ip netip.Addr, err error)
ExchangeContext(ctx context.Context, m *dns.Msg) (msg *dns.Msg, source string, err error)
ExchangeContextWithoutCache(ctx context.Context, m *dns.Msg) (msg *dns.Msg, source string, err error)
RemoveCache(host string)
}