dns

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dns implements the wildcard DNS server and the host-resolver wiring that route the configured TLD to the local proximo.

Index

Constants

This section is empty.

Variables

View Source
var DefaultUpstream = []string{"1.1.1.1:53", "8.8.8.8:53"}

DefaultUpstream is used when no upstream resolver is configured.

Functions

func CheckPortFree

func CheckPortFree() error

CheckPortFree verifies that the DNS publish port (127.0.0.1:<DNSPort>/udp) is not already bound by another process, so install can abort before making any host changes.

func ConfigureResolver

func ConfigureResolver(tld string) error

ConfigureResolver wires the host resolver so that lookups for the TLD are sent to the local DNS server on 127.0.0.1:<DNSPort>.

func RemoveResolver

func RemoveResolver(tld string) error

RemoveResolver removes the host resolver configuration created by ConfigureResolver and reloads the resolver.

Types

type Server

type Server struct {
	// TLD is the routed top-level domain without a leading dot (e.g. "test").
	TLD string
	// Addr is the listen address (e.g. ":5353").
	Addr string
	// Upstream is the list of upstream resolvers as host:port.
	Upstream []string
	// contains filtered or unexported fields
}

Server answers wildcard queries for a TLD with a loopback address and forwards every other query to an upstream resolver.

func (*Server) Run

func (s *Server) Run() error

Run starts the UDP and TCP listeners and blocks until one of them fails.

Jump to

Keyboard shortcuts

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