Documentation
¶
Index ¶
Constants ¶
View Source
const ( BlockStart = "#### hostfile >>>>>" BlockEnd = "#### hostfile <<<<<" DisableIPPrefix = "#[disable-ip]" DisableDomainPrefix = "#[disable-domain]" )
Variables ¶
This section is empty.
Functions ¶
func FormatBlock ¶
func FormatBlock(block *ManagedBlock) string
FormatBlock formats a ManagedBlock back to string including the marker lines.
func FormatEntry ¶
FormatEntry formats a single HostEntry back to a hosts file line.
func ValidDomain ¶ added in v1.5.3
ValidDomain checks if a string is a valid domain name for hosts file use.
Types ¶
type DisableType ¶
type DisableType int
const ( DisableNone DisableType = iota DisableIP // entire line disabled DisableDomain // single domain disabled )
type HostEntry ¶
type HostEntry struct {
IP string
Domains []string
DisableType DisableType
}
HostEntry represents a single entry in the managed block. For normal and disable-ip entries: IP + Domains. For disable-domain entries: IP + Domains (single domain that was disabled).
type ManagedBlock ¶
ManagedBlock holds all entries within the managed block, plus any lines that failed to parse (stored as warnings).
func ParseBlock ¶
func ParseBlock(content string) *ManagedBlock
ParseBlock parses the content inside a managed block (without the marker lines).
Click to show internal directories.
Click to hide internal directories.