hostsfile

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Location = "/etc/hosts"

OS-specific default hosts-file location.

Functions

This section is empty.

Types

type Hostsfile

type Hostsfile struct {
	// contains filtered or unexported fields
}

Represents a hosts file. Records match a single line in the file.

func Decode

func Decode(rdr io.Reader) (Hostsfile, error)

Decodes the raw text of a hostsfile into a Hostsfile struct. If a line contains both an IP address and a comment, the comment will be lost.

Interface example from the image package.

func (*Hostsfile) Records

func (h *Hostsfile) Records() []*Record

Records returns an array of all entries in the hostsfile.

type Record

type Record struct {
	IpAddress net.IPAddr
	Hostnames []string
	// contains filtered or unexported fields
}

A single line in the hosts file

func (*Record) Matches added in v0.14.0

func (r *Record) Matches(hostname string) bool

Jump to

Keyboard shortcuts

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