resolvconf

package
v0.59.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Overview

Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf. Originally from github.com/docker/libnetwork/resolvconf but heavily modified to better work with podman.

Index

Constants

View Source
const (
	// DefaultResolvConf points to the default file used for dns configuration on a linux machine.
	DefaultResolvConf = "/etc/resolv.conf"
)

Variables

This section is empty.

Functions

func Add

func Add(path string, nameservers []string) error

Add will add the given nameservers to the given resolv.conf file. It will add the nameserver in front of the existing ones.

func New

func New(params *Params) error

New creates a new resolv.conf file with the given params.

func Remove

func Remove(path string, nameservers []string) error

Remove the given nameserver from the given resolv.conf file.

Types

type Params

type Params struct {
	// Path is the path to new resolv.conf file which should be created.
	Path string
	// Namespaces is the list of container namespaces.
	// This is required to fist check for a resolv.conf under /etc/netns,
	// created by "ip netns". Also used to check if the container has a
	// netns in which case localhost nameserver must be filtered.
	Namespaces []specs.LinuxNamespace
	// IPv6Enabled will filter ipv6 nameservers when not set to true.
	IPv6Enabled bool
	// KeepHostServers can be set when it is required to still keep the
	// original resolv.conf content even when custom Nameserver/Searches/Options
	// are set. In this case they will be appended to the given values.
	KeepHostServers bool
	// Nameservers is a list of nameservers the container should use,
	// instead of the default ones from the host.
	Nameservers []string
	// Searches is a list of dns search domains the container should use,
	// instead of the default ones from the host.
	Searches []string
	// Options is a list of dns options the container should use,
	// instead of the default ones from the host.
	Options []string
	// contains filtered or unexported fields
}

Params for the New() function.

Jump to

Keyboard shortcuts

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