local

package
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerActivator added in v0.75.0

type PeerActivator interface {
	// ActivatePeersByIP triggers wake-up for the peer(s) owning addrs and blocks
	// until one is connected or ctx (a short per-query budget) expires. It is a
	// fast no-op for unknown or already-connected addresses.
	ActivatePeersByIP(ctx context.Context, addrs []netip.Addr)
}

PeerActivator wakes lazy-connection peers on demand. The local resolver calls it with the tunnel IPs an answer points at, so a peer that is idle (lazily disconnected) starts connecting at DNS-resolution time rather than racing the client's first request packet. nil disables warm-up.

type PeerConnectivity added in v0.72.0

type PeerConnectivity interface {
	IsConnectedByIP(ip netip.Addr) (known, connected bool)
}

PeerConnectivity reports whether a tunnel IP belongs to a peer the client knows about and whether that peer is currently connected. The local resolver uses this to suppress A/AAAA answers whose RDATA points at a disconnected peer (typical case: a synthesized private-service record pointing at an embedded proxy peer that just went offline).

known=false means the IP isn't in the local peerstore at all — the record is left alone (it points at something outside our mesh, e.g. a non-peer upstream).

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver() *Resolver

func (*Resolver) ID

func (d *Resolver) ID() types.HandlerID

ID returns the unique handler ID

func (*Resolver) MatchSubdomains

func (d *Resolver) MatchSubdomains() bool

func (*Resolver) RegisterRecord

func (d *Resolver) RegisterRecord(record nbdns.SimpleRecord) error

RegisterRecord stores a new record by appending it to any existing list

func (*Resolver) ServeDNS

func (d *Resolver) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS handles a DNS request

func (*Resolver) SetPeerActivator added in v0.75.0

func (d *Resolver) SetPeerActivator(a PeerActivator)

SetPeerActivator wires the DNS-time lazy-connection warm-up. Pass nil to disable. Safe to call multiple times; the latest value wins.

func (*Resolver) SetPeerConnectivity added in v0.72.0

func (d *Resolver) SetPeerConnectivity(p PeerConnectivity)

SetPeerConnectivity wires the per-IP connectivity check used to filter out A/AAAA answers pointing at disconnected peers. Pass nil to disable. Safe to call multiple times; the latest value wins.

func (*Resolver) Stop

func (d *Resolver) Stop()

func (*Resolver) String

func (d *Resolver) String() string

String returns a string representation of the local resolver

func (*Resolver) Update

func (d *Resolver) Update(customZones []nbdns.CustomZone)

Update replaces all zones and their records

Jump to

Keyboard shortcuts

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