Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedResolver ¶
type CachedResolver struct {
// contains filtered or unexported fields
}
CachedResolver provides DNS resolution with an in-memory cache and custom upstream DNS.
func NewCachedResolver ¶
func NewCachedResolver(nameserver string, ttl time.Duration) *CachedResolver
NewCachedResolver creates a new resolver. If nameserver is empty, it uses the system default. Example nameserver: "1.1.1.1:53"
func (*CachedResolver) DialContext ¶
func (r *CachedResolver) DialContext(ctx context.Context, network, address string) (net.Conn, error)
DialContext acts like net.DialContext but uses the cache for DNS resolution. It resolves the hostname and dials the first available IP.
func (*CachedResolver) ResolveIPAddr ¶
ResolveIPAddr caches and resolves a host to its IP addresses.
func (*CachedResolver) ResolveUDPAddr ¶
func (r *CachedResolver) ResolveUDPAddr(network, address string) (*net.UDPAddr, error)
ResolveUDPAddr acts like net.ResolveUDPAddr but uses the cache.
Click to show internal directories.
Click to hide internal directories.