Documentation
¶
Index ¶
- type IPRange
- type IPRanges
- type IPRules
- func (iprl *IPRules) Blacklist(ip string) error
- func (iprl *IPRules) BlacklistCIDR(rawIPCIDR string) error
- func (iprl *IPRules) BlacklistRange(rawIPRange string) error
- func (iprl *IPRules) ParseRules(whitelist []string, blacklist []string)
- func (iprl *IPRules) Whitelist(ip string) error
- func (iprl *IPRules) WhitelistCIDR(rawIPCIDR string) error
- func (iprl *IPRules) WhitelistRange(rawIPRange string) error
- type PortRange
- type PortRanges
- type PortRules
- func (prls *PortRules) Blacklist(port string) error
- func (prls *PortRules) BlacklistRange(rawPortRange string) error
- func (prls *PortRules) ParseRules(whitelist []string, blacklist []string)
- func (prls *PortRules) Whitelist(port string) error
- func (prls *PortRules) WhitelistRange(rawPortRange string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPRange ¶
IPRange is a range of IP represented by a lower and an upper bound
func NewIPRange ¶
NewIPRange created a new ip range from a lower and an upper bound
func (IPRange) ContainsIP ¶
ContainsIP is an helper that checks if a range contains the given IP
func (IPRange) ContainsIPRange ¶
ContainsIPRange is an helper that checks if a range contains the given IP range
func (IPRange) ContainsIPString ¶
ContainsIPString is an helper that checks if a range contains the given IP string
type IPRanges ¶
type IPRanges []IPRange
IPRanges abstracts an array of IPRange
func (*IPRanges) AddString ¶
AddString is an helper that parses and adds a range of IP from a string
func (*IPRanges) MergeOverlapping ¶
func (iprgs *IPRanges) MergeOverlapping()
MergeOverlapping optimize the parsed IPRange by keeping only non-overlapping ranges
type IPRules ¶
IPRules groups the whitelisted and blacklisted ip rules
func (*IPRules) Blacklist ¶
Blacklist checks the validity of an IP string and adds it to the IPRules' blacklist
func (*IPRules) BlacklistCIDR ¶
BlacklistCIDR parses and adds a CIDR string to the IPRules' blacklist
func (*IPRules) BlacklistRange ¶
BlacklistRange parses and adds an IP range string to the IPRules' blacklist
func (*IPRules) ParseRules ¶
ParseRules loads a whitelist and a blacklist into a set of IPRules
func (*IPRules) Whitelist ¶
Whitelist checks the validity of an IP string and adds it to the IPRules' whitelist
func (*IPRules) WhitelistCIDR ¶
WhitelistCIDR parses and adds a CIDR string to the IPRules' whitelist
func (*IPRules) WhitelistRange ¶
WhitelistRange parses and adds an IP range string to the IPRules' whitelist
type PortRange ¶
PortRange is a range of Port represented by a lower and an upper bound
func NewPortRange ¶
NewPortRange created a new ip range from a lower and an upper bound
func (PortRange) ContainsPort ¶
ContainsPort is an helper that checks if a range contains the given Port
func (PortRange) ContainsPortRange ¶
ContainsPortRange is an helper that checks if a range contains the given Port range
func (PortRange) IsUpperOrLowerBoundary ¶
IsUpperOrLowerBoundary is an helper that checks if the given Port is either the lower of the upper bound of a range
type PortRanges ¶
type PortRanges []PortRange
PortRanges abstracts an array of PortRange
func (*PortRanges) Add ¶
func (prgs *PortRanges) Add(port uint16)
Add is an helper that adds a range made of a single Port
func (*PortRanges) AddRange ¶
func (prgs *PortRanges) AddRange(lower uint16, upper uint16)
AddRange is an helper that parses and adds a range of Port
func (*PortRanges) MergeOverlapping ¶
func (prgs *PortRanges) MergeOverlapping()
MergeOverlapping optimize the parsed PortRange by keeping only non-overlapping ranges
func (*PortRanges) RemoveAt ¶
func (prgs *PortRanges) RemoveAt(index int)
RemoveAt is an helper that removes a range at the the given index
type PortRules ¶
type PortRules struct { WhitelistedPorts PortRanges BlacklistedPorts PortRanges }
PortRules groups the whitelisted and blacklisted ip rules
func (*PortRules) Blacklist ¶
Blacklist checks the validity of a Port string and adds it to the PortRules' blacklist
func (*PortRules) BlacklistRange ¶
BlacklistRange parses and adds a Port range string to the PortRules' blacklist
func (*PortRules) ParseRules ¶
ParseRules loads a whitelist and a blacklist into a set of PortRules
func (*PortRules) Whitelist ¶
Whitelist checks the validity of a Port string and adds it to the PortRules' whitelist
func (*PortRules) WhitelistRange ¶
WhitelistRange parses and adds a Port range string to the PortRules' whitelist