etchosts

package
v26.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(path string, recs []Record) error

Add adds an arbitrary number of Records to an already existing /etc/hosts file

func Build

func Build(path string, extraContent []Record) error

Build function path is path to host file string required extraContent is an array of extra host records.

func BuildNoIPv6

func BuildNoIPv6(path string, extraContent []Record) error

BuildNoIPv6 is the same as Build, but will not include IPv6 entries.

func Delete

func Delete(path string, recs []Record) error

Delete deletes an arbitrary number of Records already existing in /etc/hosts file

func Drop

func Drop(path string)

Drop drops the path string from the path cache

func Update

func Update(path, IP, hostname string) error

Update all IP addresses where hostname matches. path is path to host file IP is new IP address hostname is hostname to search for to replace IP

Types

type Record

type Record struct {
	Hosts string
	IP    string
}

Record Structure for a single host record

func (Record) WriteTo

func (r Record) WriteTo(w io.Writer) (int64, error)

WriteTo writes record to file and returns bytes written or error

Jump to

Keyboard shortcuts

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