Documentation ¶
Index ¶
- Constants
- Variables
- type EqualAddressRule
- type Rule
- type RuleEntry
- type RuleSet
- func (ruleSet *RuleSet) AppendEqualAddress(targetIP net.IP)
- func (ruleSet *RuleSet) AppendWithinNetwork(targetNetwork *net.IPNet)
- func (ruleSet *RuleSet) AppendWithinRange(fromIP net.IP, untilIP net.IP)
- func (ruleSet *RuleSet) Contains(ip net.IP) bool
- func (ruleSet *RuleSet) MarshalBinary() (data []byte, err error)
- func (ruleSet *RuleSet) MarshalJSON() ([]byte, error)
- func (ruleSet *RuleSet) RuleEntries() []RuleEntry
- func (ruleSet *RuleSet) UnmarshalBinary(data []byte) error
- func (ruleSet *RuleSet) UnmarshalJSON(buf []byte) (err error)
- type RuleType
- type WithinNetworkRule
- type WithinRangeRule
Constants ¶
View Source
const BinaryPackageVersion1 = 1
Variables ¶
View Source
var ErrInsufficientBinaryBuffer = errors.New("insufficient binary buffer")
View Source
var ErrInvalidRule = errors.New("invalid check rule")
View Source
var ErrInvalidRuleType = errors.New("invalid rule type")
View Source
var ErrPackedBinaryBroken = errors.New("packed binary broken")
View Source
var ErrPackedBinarySizeMismatch = errors.New("packed binary size mismatch")
View Source
var ErrPackedBinaryUnsupportedVersion = errors.New("packed binary unsupported version")
Functions ¶
This section is empty.
Types ¶
type EqualAddressRule ¶
func (EqualAddressRule) MarshalJSON ¶
func (rule EqualAddressRule) MarshalJSON() ([]byte, error)
func (*EqualAddressRule) UnmarshalJSON ¶
func (ruleRef *EqualAddressRule) UnmarshalJSON(buf []byte) (err error)
type RuleEntry ¶
func (*RuleEntry) UnmarshalJSON ¶
type RuleSet ¶
type RuleSet struct {
// contains filtered or unexported fields
}
func NewRuleSet ¶ added in v0.0.2
func (*RuleSet) AppendEqualAddress ¶
func (*RuleSet) AppendWithinNetwork ¶
func (*RuleSet) AppendWithinRange ¶
func (*RuleSet) MarshalBinary ¶
MarshalBinary returns the binary representation of the RuleSet. The binary representation is: - 4 bytes for Adler-32 checksum of the rest of binary package. - 4 bytes for total size (include checksum) of binary package. - 4 byte for count of rules. - 1 byte for binary package version. - rules in the following repeated format: --- 1 byte for rule type (RuleType), value 0 (UnknownRule) stop rule packs. --- packed rule binary.
func (*RuleSet) MarshalJSON ¶
func (*RuleSet) RuleEntries ¶
RuleEntries returns the internal slice of rule entries in the RuleSet. Do not alter the content of returned slice as it will also modify the content of rules in the ruleSet.
func (*RuleSet) UnmarshalBinary ¶
func (*RuleSet) UnmarshalJSON ¶
type WithinNetworkRule ¶
func NewWithinNetworkRuleViaCIDR ¶
func NewWithinNetworkRuleViaCIDR(s string) (*WithinNetworkRule, error)
func (*WithinNetworkRule) MarshalJSON ¶
func (rule *WithinNetworkRule) MarshalJSON() ([]byte, error)
func (*WithinNetworkRule) UnmarshalJSON ¶
func (rule *WithinNetworkRule) UnmarshalJSON(buf []byte) (err error)
type WithinRangeRule ¶
func NewWithinRangeRule ¶
func NewWithinRangeRule(fromIP net.IP, untilIP net.IP) *WithinRangeRule
func (*WithinRangeRule) MarshalJSON ¶
func (rule *WithinRangeRule) MarshalJSON() ([]byte, error)
func (*WithinRangeRule) UnmarshalJSON ¶
func (rule *WithinRangeRule) UnmarshalJSON(buf []byte) (err error)
Click to show internal directories.
Click to hide internal directories.