hosts

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileContent added in v0.24.0

func FileContent() string

func FilePath added in v0.20.0

func FilePath() string

FilePath returns the path to the hosts file.

func IPs

func IPs(host string) ([]string, error)

IPs ...

func IPv4

func IPv4(host string) string

IPv4 ...

func IPv6

func IPv6(host string) string

IPv6 ...

func LocalIP added in v0.17.0

func LocalIP() string

func Writable

func Writable() bool

Writable is the hosts file writable.

Types

type ChangeResult

type ChangeResult struct {
	Success   bool
	Altered   bool
	Content   string
	WriteFile string
}

ChangeResult result of changing the hosts file.

func AddHosts

func AddHosts(ip string, toAdd []string, tryWrite bool) ChangeResult

AddHosts attempts to add requested hosts to the system hosts file, and gives you the new content, a tmp file and success.

func RemoveHostsWithSuffix

func RemoveHostsWithSuffix(ip string, hostSuffix string, tryWrite bool) ChangeResult

RemoveHostsWithSuffix attempts to remove all hosts with a suffix from the system hosts file, and gives you the new content, a tmp file and success.

Jump to

Keyboard shortcuts

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