Documentation
¶
Index ¶
- func AddEntry(hostsFilePath, ip string, fqdn string) error
- func Contains(slice []string, item string) bool
- func EnsureHeader(hostsFilePath string) error
- func GetEntriesByHostname(hostsFilePath, fqdn string) ([]string, error)
- func GetEntriesByIP(hostsFilePath, ip string) ([]string, error)
- func RemoveAllHostname(hostsFilePath, fqdn string) error
- func RemoveAllIP(hostsFilePath, ip string) error
- func RemoveEntry(hostsFilePath, ip string, fqdn string) error
- type IPOrHost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureHeader ¶
EnsureHeader ensures the header line exists in the hosts file
func GetEntriesByHostname ¶
GetEntriesByHostname returns all entries in the hosts file that contains the specified FQDN
func GetEntriesByIP ¶
GetEntriesByIP returns all entries in the hosts file that contains the specified IP address
func RemoveAllHostname ¶
RemoveAllHostname removes all entries with the specified FQDN from the hosts file
func RemoveAllIP ¶
RemoveAllIP removes all entries with the specified IP from the hosts file
func RemoveEntry ¶
RemoveEntry removes an entry from the hosts file, skip if the entry pair does not exist
Types ¶
Click to show internal directories.
Click to hide internal directories.