Documentation ¶
Index ¶
- Constants
- type AddressLocations
- type HostFileLine
- type HostFileLines
- type HostLocations
- type Hosts
- func (h *Hosts) AddHost(addressRaw string, hostRaw string)
- func (h *Hosts) AddHosts(address string, hosts []string)
- func (h *Hosts) GetHostFileLines() *HostFileLines
- func (h *Hosts) HostAddressLookup(host string) (bool, string, int)
- func (h *Hosts) Reload() error
- func (h *Hosts) RemoveAddress(address string)
- func (h *Hosts) RemoveAddresses(addresses []string)
- func (h *Hosts) RemoveFirstAddress(address string) bool
- func (h *Hosts) RemoveFirstHost(host string) bool
- func (h *Hosts) RemoveHost(host string)
- func (h *Hosts) RemoveHosts(hosts []string)
- func (h *Hosts) RenderHostsFile() string
- func (h *Hosts) Save() error
- func (h *Hosts) SaveAs(fileName string) error
- type HostsConfig
Constants ¶
const ADDRESS = 30
const COMMENT = 20
const EMPTY = 10
const UNKNOWN = 0
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressLocations ¶
AddressLocations the location of an address in the HFL
type HostFileLine ¶
type HostFileLine struct { OriginalLineNum int LineType int Address string Parts []string Hostnames []string Raw string Trimed string Comment string }
HostFileLine
type HostLocations ¶
HostLocations maps a hostname to an original line number
type Hosts ¶
type Hosts struct { sync.Mutex *HostsConfig // contains filtered or unexported fields }
Hosts
func NewHostsDefault ¶
NewHostsDefault returns a hosts object with default configuration
func (*Hosts) AddHost ¶
AddHost adds a host to an address and removes the host from any existing address is may be associated with
func (*Hosts) AddHosts ¶
AddHosts adds an array of hosts to the first matching address it finds or creates the address and adds the hosts
func (*Hosts) HostAddressLookup ¶
HostAddressLookup returns true is the host is found, a string containing the address and the index of the hfl
func (*Hosts) RemoveAddress ¶
RemoveAddress removes all entries (lines) with the provided address.
func (*Hosts) RemoveAddresses ¶
RemoveAddresses removes all entries (lines) with the provided address.
func (*Hosts) RemoveFirstAddress ¶
RemoveFirstAddress removed the first entry (line) found with the provided address.
func (*Hosts) RemoveFirstHost ¶
RemoveHost the first hostname entry found and returns true if successful
func (*Hosts) RemoveHost ¶
RemoveHost removes all hostname entries of provided host
func (*Hosts) RemoveHosts ¶
RemoveHosts removes all hostname entries of the provided host slice