Versions in this module Expand all Collapse all v1 v1.0.2 Apr 25, 2024 v1.0.1 Apr 24, 2024 Changes in this version + const DefaultDnsReadTimeout + const DefaultDnsRelayTimeout + const SafeDnsPacketSize + var DefaultDNSTimeout = time.Second * 5 + var DefaultHosts = NewHosts(trie.New[HostValue]()) + var DefaultResolver Resolver + var DisableIPv6 = true + var DisableSystemHosts = strconv.ParseBool(os.Getenv("DISABLE_SYSTEM_HOSTS")) + var ErrIPNotFound = errors.New("couldn't find ip") + var ErrIPVersion = errors.New("ip version error") + var ErrIPv6Disabled = errors.New("ipv6 disabled") + var ProxyServerHostResolver Resolver + func AddSystemDnsBlacklist(names ...string) + func FakeIPEnabled() bool + func FindHostByIP(ip netip.Addr) (string, bool) + func FlushFakeIP() error + 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 IsSystemDnsBlacklisted(names ...string) bool + func LookupIP(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPProxyServerHost(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPWithResolver(ctx context.Context, host string, r Resolver) ([]netip.Addr, error) + func LookupIPv4(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPv4ProxyServerHost(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPv4WithResolver(ctx context.Context, host string, r Resolver) ([]netip.Addr, error) + func LookupIPv6(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPv6ProxyServerHost(ctx context.Context, host string) ([]netip.Addr, error) + func LookupIPv6WithResolver(ctx context.Context, host string, r Resolver) ([]netip.Addr, error) + func MappingEnabled() bool + func RelayDnsConn(ctx context.Context, conn net.Conn, readTimeout time.Duration) error + func RelayDnsPacket(ctx context.Context, payload []byte, target []byte) ([]byte, error) + func RemoveSystemDnsBlacklist(names ...string) + func ResolveIP(ctx context.Context, host string) (netip.Addr, error) + func ResolveIPWithResolver(ctx context.Context, host string, r Resolver) (netip.Addr, error) + func ResolveIPv4(ctx context.Context, host string) (netip.Addr, error) + func ResolveIPv4ProxyServerHost(ctx context.Context, host string) (netip.Addr, error) + func ResolveIPv4WithResolver(ctx context.Context, host string, r Resolver) (netip.Addr, error) + func ResolveIPv6(ctx context.Context, host string) (netip.Addr, error) + func ResolveIPv6ProxyServerHost(ctx context.Context, host string) (netip.Addr, error) + func ResolveIPv6WithResolver(ctx context.Context, host string, r Resolver) (netip.Addr, error) + func ResolveProxyServerHost(ctx context.Context, host string) (netip.Addr, error) + func ServeMsg(ctx context.Context, msg *D.Msg) (*D.Msg, error) + func SortationAddr(ips []netip.Addr) (ipv4s, ipv6s []netip.Addr) + func StoreFakePoolState() + type Enhancer interface + FakeIPEnabled func() bool + FindHostByIP func(netip.Addr) (string, bool) + FlushFakeIP func() error + InsertHostByIP func(netip.Addr, string) + IsExistFakeIP func(netip.Addr) bool + IsFakeBroadcastIP func(netip.Addr) bool + IsFakeIP func(netip.Addr) bool + MappingEnabled func() bool + StoreFakePoolState func() + var DefaultHostMapper Enhancer + type HostValue struct + Domain string + IPs []netip.Addr + IsDomain bool + func NewHostValue(value any) (HostValue, error) + func NewHostValueByDomain(domain string) (HostValue, error) + func NewHostValueByIPs(ips []netip.Addr) (HostValue, error) + func (hv HostValue) RandIP() (netip.Addr, error) + type Hosts struct + func NewHosts(hosts *trie.DomainTrie[HostValue]) Hosts + func (h *Hosts) Search(domain string, isDomain bool) (*HostValue, bool) + type LocalServer interface + ServeMsg func(ctx context.Context, msg *D.Msg) (*D.Msg, error) + var DefaultLocalServer LocalServer + type Resolver interface + ExchangeContext func(ctx context.Context, m *dns.Msg) (msg *dns.Msg, err error) + Invalid func() bool + LookupIP func(ctx context.Context, host string) (ips []netip.Addr, err error) + LookupIPv4 func(ctx context.Context, host string) (ips []netip.Addr, err error) + LookupIPv6 func(ctx context.Context, host string) (ips []netip.Addr, err error)