dnshosts

package
v1.0.0-beta.24 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dnshosts edits the hosts file that the dnsname CNI plugin keeps for a network's dnsmasq, which resolves container hostnames.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reload

func Reload(pidfile string) error

Reload signals dnsmasq to reload its hosts file, if it is running.

func Remove

func Remove(path, hostname string, ips []net.IP) (found bool, rerr error)

Remove removes the lines of the hosts file at path that name hostname at one of ips, and reports whether it found any. The caller holds the lock.

Types

type Files

type Files struct {
	// Hosts is dnsmasq's additional hosts file: one "IP<TAB>name[<TAB>alias...]"
	// line per container address.
	Hosts string
	// Lockfile serializes every edit of Hosts.
	Lockfile string
	// Pidfile holds dnsmasq's PID, to signal it to reload Hosts.
	Pidfile string
}

Files are the dnsname plugin's files for one network.

func (Files) RemoveHost

func (f Files) RemoveHost(hostname string, ips []net.IP) error

RemoveHost removes the entries naming hostname at one of ips, and makes dnsmasq reload the hosts file. Entries for the same hostname at other addresses belong to another container and are kept.

Jump to

Keyboard shortcuts

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