cidr

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cidr

type Cidr[T any] struct {
	// contains filtered or unexported fields
}

Cidr cidr matcher

func NewCidrMapper

func NewCidrMapper[T any]() *Cidr[T]

func (*Cidr[T]) Insert

func (c *Cidr[T]) Insert(cidr string, mark T) error

InsetOneCIDR Insert one CIDR to cidr matcher

func (*Cidr[T]) InsertCIDR

func (c *Cidr[T]) InsertCIDR(ipNet netip.Prefix, mark T)

func (*Cidr[T]) InsertIP

func (c *Cidr[T]) InsertIP(ip netip.Addr, maskSize int, mark T)

func (*Cidr[T]) RemoveCIDR

func (c *Cidr[T]) RemoveCIDR(ipNet netip.Prefix)

func (*Cidr[T]) RemoveIP

func (c *Cidr[T]) RemoveIP(ipNet netip.Addr, maskSIze int)

func (*Cidr[T]) Search

func (c *Cidr[T]) Search(ip string) (mark T, ok bool)

MatchWithTrie match ip with trie

func (*Cidr[T]) SearchIP

func (c *Cidr[T]) SearchIP(ip net.IP) (mark T, ok bool)

type Trie

type Trie[T any] struct {
	// contains filtered or unexported fields
}

func NewTrieTree

func NewTrieTree[T any]() Trie[T]

NewTrieTree create a new trie tree

func (*Trie[T]) Insert

func (t *Trie[T]) Insert(ip net.IP, maskSize int, mark T)

Insert insert node to tree

func (*Trie[T]) Remove

func (t *Trie[T]) Remove(ip net.IP)

Search search from trie tree

func (*Trie[T]) Search

func (t *Trie[T]) Search(ip net.IP) (mark T, ok bool)

Search search from trie tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL