iptree

package
v1.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPTree

type IPTree struct {
	R *nradix.Tree
}

func New

func New() *IPTree

func (*IPTree) Add

func (i *IPTree) Add(cidr *net.IPNet, v interface{}) error

func (*IPTree) AddByNetIP added in v1.0.2

func (i *IPTree) AddByNetIP(ipcidr net.IP, mask net.IPMask, v interface{}) error

func (*IPTree) AddByNetIPAddr added in v1.0.2

func (i *IPTree) AddByNetIPAddr(ipcidr netip.Addr, mask netip.Prefix, v interface{}, overwrite bool) error

func (*IPTree) AddByString

func (i *IPTree) AddByString(ipcidr string, v interface{}) error

func (*IPTree) DeleteByNetIP added in v1.0.2

func (i *IPTree) DeleteByNetIP(ip net.IP, mask net.IPMask) error

func (*IPTree) DeleteByNetIPAddr added in v1.0.2

func (i *IPTree) DeleteByNetIPAddr(nip netip.Addr, mask netip.Prefix) error

func (*IPTree) DeleteByString

func (i *IPTree) DeleteByString(ipstr string) error

func (*IPTree) Get

func (i *IPTree) Get(ip net.IP) (interface{}, bool, error)

func (*IPTree) GetAll added in v1.0.3

func (i *IPTree) GetAll() map[string]interface{}

GetAll returns all entries in the IPTree as a map of CIDR strings to their values

func (*IPTree) GetByString

func (i *IPTree) GetByString(ipstr string) (interface{}, bool, error)

func (*IPTree) GetIPNet

func (i *IPTree) GetIPNet(ip net.IPNet) (interface{}, bool, error)

func (*IPTree) GetNetIP

func (i *IPTree) GetNetIP(ip net.IP) (interface{}, bool, error)

func (*IPTree) GetNetIPAddr

func (i *IPTree) GetNetIPAddr(nip netip.Addr) (interface{}, bool, error)

func (*IPTree) WalkV4Prefix added in v1.0.5

func (i *IPTree) WalkV4Prefix(callback func(prefix netip.Prefix, value interface{}) error) error

WalkV4Prefix iterates through all entries in the IPTree, calling the provided function for each entry. If the callback returns false, iteration stops.

func (*IPTree) WalkV4String added in v1.0.5

func (i *IPTree) WalkV4String(callback func(prefix string, value interface{}) error) error

WalkV4String iterates through all entries in the IPTree, calling the provided function for each entry. If the callback returns false, iteration stops.

func (*IPTree) WalkV6Prefix added in v1.0.5

func (i *IPTree) WalkV6Prefix(callback func(prefix netip.Prefix, value interface{}) error) error

WalkV6Prefix iterates through all entries in the IPTree, calling the provided function for each entry. If the callback returns false, iteration stops.

func (*IPTree) WalkV6String added in v1.0.5

func (i *IPTree) WalkV6String(callback func(prefix string, value interface{}) error) error

WalkV6String iterates through all entries in the IPTree, calling the provided function for each entry. If the callback returns false, iteration stops.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳