Documentation ¶
Index ¶
- Variables
- type IPSet
- func (s *IPSet) Add(prefix netip.Prefix)
- func (s *IPSet) Compact()
- func (s *IPSet) Contains(addr netip.Addr) bool
- func (s *IPSet) Deserialize(r io.Reader) error
- func (s *IPSet) Iterate(step IterStepFunc) bool
- func (s *IPSet) Serialize(w io.Writer) error
- func (s *IPSet) WriteTextTo(w io.Writer) (n int64, err error)
- type IPSet4
- func (s *IPSet4) Add(prefix, length uint32)
- func (s *IPSet4) Compact()
- func (s *IPSet4) Contains(ip uint32) bool
- func (s *IPSet4) Deserialize(r io.Reader) error
- func (s *IPSet4) Iterate(step IterStepFunc) bool
- func (s *IPSet4) Serialize(w io.Writer) error
- func (s *IPSet4) WriteTextTo(w io.Writer) (n int64, err error)
- type IPSet6
- func (s *IPSet6) Add(prefix [16]byte, length uint32)
- func (s *IPSet6) Compact()
- func (s *IPSet6) Contains(addr [16]byte) bool
- func (s *IPSet6) Deserialize(r io.Reader) error
- func (s *IPSet6) Iterate(step IterStepFunc) bool
- func (s *IPSet6) Serialize(w io.Writer) error
- func (s *IPSet6) WriteTextTo(w io.Writer) (n int64, err error)
- type IterStepFunc
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFormat = errors.New("invalid format")
Functions ¶
This section is empty.
Types ¶
type IPSet ¶
type IPSet struct {
// contains filtered or unexported fields
}
func (*IPSet) Iterate ¶
func (s *IPSet) Iterate(step IterStepFunc) bool
Iterate calls the step function for each prefix within the set. If the step function returns false, the iteration stops and the function returns false, otherwise it returns true after all nodes are traversed. The step function must not modify the set.
func (*IPSet) WriteTextTo ¶
WriteTextTo writes a textual representation of the IP set to the provided Writer. The text will contain one prefix per line, separated by '\n'. The order is not guaranteed to match the order in which the prefixes were added. Some contiguous prefixes may be merged. There will be one w.Write() call per prefix, so it is advisable to provide a buffered Writer.
type IPSet4 ¶
type IPSet4 struct {
// contains filtered or unexported fields
}
func (*IPSet4) Deserialize ¶
func (*IPSet4) Iterate ¶
func (s *IPSet4) Iterate(step IterStepFunc) bool
Iterate traverses the tree and calls the step function for each prefix within the set. See IPSet.Iterate for more details.
type IPSet6 ¶
type IPSet6 struct {
// contains filtered or unexported fields
}
func (*IPSet6) Deserialize ¶
func (*IPSet6) Iterate ¶
func (s *IPSet6) Iterate(step IterStepFunc) bool
Iterate traverses the tree and calls the step function for each prefix within the set. See IPSet.Iterate for more details.