Documentation
¶
Overview ¶
Package magicdns is the agent's DNS resolver. It answers names of mesh nodes (<node>.<domain>) from the netmap and forwards split-DNS domains to their configured resolvers. In TUN mode the agent serves it at Addr, intercepting queries before they reach WireGuard, so no socket needs to be bound and nothing leaves the machine for mesh names.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Addr = netip.MustParseAddr("100.100.100.100")
Addr is where the resolver answers. It lies inside the default mesh prefix and is never assigned to a node.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Domain is the suffix of node names, e.g. "mesh.internal"; empty
// disables answering for nodes.
Domain string
// Nodes maps node names to addresses.
Nodes map[string]netip.Addr
Split []Split
}
Config is the resolver's view of the mesh.
type Resolver ¶
type Resolver struct {
// Dial connects to upstream resolvers of split domains; nil uses the
// host network.
Dial func(ctx context.Context, network, address string) (net.Conn, error)
// contains filtered or unexported fields
}
Resolver answers DNS queries. It is safe for concurrent use.
func (*Resolver) Domains ¶
Domains returns the domains the resolver is authoritative for or forwards, for configuring the OS: queries for these should be sent to Addr.
func (*Resolver) Handle ¶
Handle answers one DNS message (UDP wire format). It returns nil for messages that are not worth answering (not a query, unparseable).