cidr

package
v0.3.1-rc.6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 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]) 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]) 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