network

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

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

func (r *CachedResolver) ResolveIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL