dns

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenLoopbackUDP

func ListenLoopbackUDP(pid int, port uint16) (net.PacketConn, error)

ListenLoopbackUDP returns a UDP socket bound to 127.0.0.1:port in the network namespace of the process pid.

The main thread of the process must be locked to the main goroutine.

func StartServer

func StartServer(conn net.PacketConn, resolver Resolver) (func(), error)

StartServer answers queries arriving on conn until the returned shutdown function is called. Names are resolved with resolver.

Takes ownership of conn, closing it when the server fails to start or the shutdown function is called.

Types

type Resolver

type Resolver interface {
	LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error)
}

Resolver resolves names for the server.

nxdomain must be reported with a *net.DNSError with IsNotFound set, other errors are answered with SERVFAIL.

Jump to

Keyboard shortcuts

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