Documentation ¶
Overview ¶
Package statichost is a host (ip) matching model.
Index ¶
Constants ¶
View Source
const ( StaticNil = iota StaticDirect StaticBlocked )
The strategies the hosts will be processed with.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type StaticHosts ¶
StaticHosts struct.
func MapStaticFiles ¶
func MapStaticFiles(blocked, direct string) StaticHosts
MapStaticFiles loads all settings from files. Priority: StaticDirect > StaticBlocked
func (StaticHosts) GetHostStrategy ¶
func (sh StaticHosts) GetHostStrategy(host string) Strategy
GetHostStrategy gets the strategy of an hostname. Right to left, match sufix after the separator first.
func (StaticHosts) GetIPStrategy ¶
func (sh StaticHosts) GetIPStrategy(ip string) Strategy
GetIPStrategy gets the strategy of an ip. Left to right. IP syntax: a.b.c.d, 127.0.0.*, 192.168.*, or 10.*; * is required as IPv6 would omit `0`s.
func (StaticHosts) GetStrategy ¶
func (sh StaticHosts) GetStrategy(q string) Strategy
GetStrategy gets the strategy for a host or ip.
func (StaticHosts) Load ¶
func (sh StaticHosts) Load(file string, strategy Strategy)
Load settings from a file.
func (StaticHosts) Upsert ¶
func (sh StaticHosts) Upsert(in string, strategy Strategy)
Upsert updates/inserts the StaticHosts by line(s) of items for a same strategy. host: sufix, ip: prefix.
Click to show internal directories.
Click to hide internal directories.