Documentation
¶
Index ¶
- Variables
- func LookupIP(ctx context.Context, host string) ([]net.IP, error)
- func LookupIPWithResolver(ctx context.Context, host string, r Resolver) ([]net.IP, error)
- func LookupIPv4(ctx context.Context, host string) ([]net.IP, error)
- func LookupIPv6(ctx context.Context, host string) ([]net.IP, error)
- func ResolveIP(host string) (net.IP, error)
- func ResolveIPv4(host string) (net.IP, error)
- func ResolveIPv6(host string) (net.IP, error)
- type Resolver
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultResolver aim to resolve ip DefaultResolver Resolver // DefaultHosts aim to resolve hosts DefaultHosts = trie.New() // DefaultDNSTimeout defined the default dns request timeout DefaultDNSTimeout = time.Second * 5 )
View Source
var ( ErrIPNotFound = errors.New("couldn't find ip") ErrIPVersion = errors.New("ip version error") )
Functions ¶
func LookupIPWithResolver ¶
LookupIPWithResolver same as ResolveIP, but with a resolver
func LookupIPv4 ¶
LookupIPv4 with a host, return ipv4 list
func LookupIPv6 ¶
LookupIPv6 with a host, return ipv6 list
func ResolveIPv4 ¶
ResolveIPv4 with a host, return ipv4
Types ¶
type Resolver ¶
type Resolver interface { LookupIP(ctx context.Context, host string) ([]net.IP, error) LookupIPv4(ctx context.Context, host string) ([]net.IP, error) LookupIPv6(ctx context.Context, host string) ([]net.IP, error) ResolveIP(host string) (ip net.IP, err error) ResolveIPv4(host string) (ip net.IP, err error) ResolveIPv6(host string) (ip net.IP, err error) ExchangeContext(ctx context.Context, m *dns.Msg) (msg *dns.Msg, err error) }
Click to show internal directories.
Click to hide internal directories.