Documentation
¶
Index ¶
- func Check(tld string) (bool, error)
- func ConfigureResolver() error
- func InstallSudoers() error
- func ReadContainerDNS() []string
- func ReadUpstreamDNS() []string
- func ResolverHint() string
- func Setup() errordeprecated
- func Teardown()
- func WaitReady(timeout time.Duration) error
- func WriteDnsmasqConfig(dir string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check resolves test-lerd-probe.{tld} and checks if 127.0.0.1 is in the results. Returns (true, nil) if DNS is working correctly for the given TLD.
func ConfigureResolver ¶ added in v0.1.53
func ConfigureResolver() error
ConfigureResolver configures the system DNS resolver to forward .test to the lerd-dns dnsmasq container on port 5300. Call this after lerd-dns is running so that any immediate resolvectl changes don't break DNS before dnsmasq is up.
func InstallSudoers ¶ added in v0.3.0
func InstallSudoers() error
InstallSudoers writes a sudoers drop-in granting the current user passwordless access to resolvectl commands. This is required for the autostart service which runs non-interactively and cannot prompt for a sudo password.
func ReadContainerDNS ¶ added in v1.0.4
func ReadContainerDNS() []string
ReadContainerDNS returns the DNS servers to configure as aardvark-dns upstreams for the lerd Podman bridge network. It reads DnsForwardIps from the pasta rootless-netns info.json (typically 169.254.1.1), which chains through systemd-resolved and therefore resolves both .test domains (via lerd-dns) and internet domains. Falls back to ReadUpstreamDNS if the file is unavailable (e.g. before Podman initialises the netns).
func ReadUpstreamDNS ¶ added in v1.0.3
func ReadUpstreamDNS() []string
ReadUpstreamDNS returns upstream DNS server IPs from the running system. Sources tried in order:
- /run/systemd/resolve/resolv.conf — real upstreams on systemd-resolved systems
- /etc/resolv.conf — fallback
- nmcli — DHCP-provided DNS from NetworkManager
Returns nil if nothing is found; callers should omit no-resolv in that case.
func ResolverHint ¶ added in v1.6.0
func ResolverHint() string
ResolverHint returns a user-facing hint for restarting the active DNS resolver.
func Setup
deprecated
func Setup() error
Setup writes DNS configuration for .test resolution and restarts the resolver. On systemd-resolved + NetworkManager systems (Ubuntu etc.) it uses an NM dispatcher script. On pure systemd-resolved systems it uses a resolved drop-in. On NetworkManager-only systems it uses NM's embedded dnsmasq.
Deprecated: prefer calling WriteDnsmasqConfig then ConfigureResolver separately so that the dnsmasq container can be started between the two steps.
func Teardown ¶ added in v0.1.55
func Teardown()
Teardown removes all lerd DNS configuration from the system and restores normal resolution.
func WaitReady ¶ added in v0.4.3
WaitReady blocks until lerd-dns is accepting TCP connections on port 5300 (dnsmasq supports DNS over TCP), or until the timeout elapses. Returns nil when ready, error on timeout.
func WriteDnsmasqConfig ¶
WriteDnsmasqConfig writes the lerd dnsmasq config to the given directory. Upstream DNS servers are detected from the running system (DHCP / systemd-resolved). If no upstreams are detected, no-resolv is omitted so dnsmasq falls back to the container's /etc/resolv.conf (populated by Podman from the host's DNS config).
Types ¶
This section is empty.