tailscale.comtailscale.com/net/dns/resolvconffile Index | Files

package resolvconffile

import "tailscale.com/net/dns/resolvconffile"

Package resolvconffile parses & serializes /etc/resolv.conf-style files.

It's a leaf package so both net/dns and net/dns/resolver can depend on it and we can unify a handful of implementations.

The package is verbosely named to disambiguate it from resolvconf the daemon, which Tailscale also supports.

Index

Constants

const Path = "/etc/resolv.conf"

Path is the canonical location of resolv.conf.

Types

type Config

type Config struct {
	// Nameservers are the IP addresses of the nameservers to use.
	Nameservers []netip.Addr

	// SearchDomains are the domain suffixes to use when expanding
	// single-label name queries. SearchDomains is additive to
	// whatever non-Tailscale search domains the OS has.
	SearchDomains []dnsname.FQDN
}

Config represents a resolv.conf(5) file.

func Parse

func Parse(r io.Reader) (*Config, error)

Parse parses a resolv.conf file from r.

func ParseFile

func ParseFile(name string) (*Config, error)

ParseFile parses the named resolv.conf file.

func (*Config) Write

func (c *Config) Write(w io.Writer) error

Write writes c to w. It does so in one Write call.

Source Files

resolvconffile.go

Version
v1.84.0 (latest)
Published
May 21, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
1 day ago

Tools for package owners.