Documentation
¶
Index ¶
- Constants
- type Hosts
- func (h *Hosts) Add(ip string, hosts ...string) error
- func (h Hosts) Flush() error
- func (h Hosts) Has(ip string, host string) bool
- func (h Hosts) HasHostname(host string) bool
- func (h Hosts) HasIp(ip string) bool
- func (h *Hosts) IsWritable() bool
- func (h *Hosts) Load() error
- func (h *Hosts) Remove(ip string, hosts ...string) error
- func (h *Hosts) RemoveByHostname(host string) error
- func (h *Hosts) RemoveByIp(ip string) error
- type HostsLine
Constants ¶
View Source
const HostsFilePath = "/etc/hosts"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hosts ¶
func NewCustomHosts ¶
Return a new instance of “Hosts“ using a custom hosts file path.
func (Hosts) HasHostname ¶
Return a bool if hostname in hosts file.
func (*Hosts) IsWritable ¶
Return ```true``` if hosts file is writable.
func (*Hosts) Load ¶
Load the hosts file into ```l.Lines```. ```Load()``` is called by ```NewHosts()``` and ```Hosts.Flush()``` so you generally you won't need to call this yourself.
func (*Hosts) RemoveByHostname ¶
Remove entries by hostname from the hosts file.
func (*Hosts) RemoveByIp ¶
type HostsLine ¶
func NewHostsLine ¶
Return a new instance of ```HostsLine```.
func (*HostsLine) HasComment ¶ added in v0.0.3
func (*HostsLine) IsMalformed ¶
Click to show internal directories.
Click to hide internal directories.