Documentation ¶
Index ¶
- Variables
- func CopyCtxValues(parent context.Context) context.Context
- func FakeIPEnabled() bool
- func FindHostByIP(ip netip.Addr) (string, bool)
- func FlushFakeIP() error
- func GetProxy(ctx context.Context) (string, bool)
- func InsertHostByIP(ip netip.Addr, host string)
- 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 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 ResolveIPv4(host string) (netip.Addr, error)
- func ResolveIPv4ProxyServerHost(host string) (netip.Addr, error)
- func ResolveIPv6(host string) (netip.Addr, error)
- func ResolveIPv6ProxyServerHost(host string) (netip.Addr, error)
- func ResolveProxyServerHost(host string) (netip.Addr, error)
- func ServeMsg(msg *D.Msg) (*D.Msg, error)
- func SetDisableIPv6(v bool)
- func StoreFakePoolState()
- func WithProxy(ctx context.Context, proxy string) 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 )
Functions ¶
func CopyCtxValues ¶
CopyCtxValues returns a new context with parent's values
func FakeIPEnabled ¶
func FakeIPEnabled() bool
func FlushFakeIP ¶
func FlushFakeIP() error
func InsertHostByIP ¶
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 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 ResolveIPv4 ¶
ResolveIPv4 with a host, return ipv4
func ResolveIPv4ProxyServerHost ¶
ResolveIPv4ProxyServerHost proxies server host only
func ResolveIPv6 ¶
ResolveIPv6 with a host, return ipv6
func ResolveIPv6ProxyServerHost ¶
ResolveIPv6ProxyServerHost proxies server host only
func ResolveProxyServerHost ¶
ResolveProxyServerHost proxies server host only
func SetDisableIPv6 ¶
func SetDisableIPv6(v bool)
SetDisableIPv6 set DisableIPv6 & needProxyHostIPv6 value
func StoreFakePoolState ¶
func StoreFakePoolState()
Types ¶
type Enhancer ¶
type Enhancer interface { FakeIPEnabled() bool MappingEnabled() bool IsFakeIP(netip.Addr) bool IsFakeBroadcastIP(netip.Addr) bool IsExistFakeIP(netip.Addr) bool FindHostByIP(netip.Addr) (string, bool) FlushFakeIP() error InsertHostByIP(netip.Addr, string) 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) 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) }