nradix

package module
v0.0.0-...-b675282 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 4 Imported by: 0

README

nradix

Translated to Golang implementation of nginx's radix tree (allowing to store and lookup IP information)

This project is licensed under the terms of the MIT license. Read LICENSE file for information for all notices and permissions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeBusy = errors.New("node busy")
	ErrNotFound = errors.New("no such node")
	ErrBadIP    = errors.New("bad IP address or mask")
)

Functions

This section is empty.

Types

type Tree

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

Tree implements radix tree for working with IP/mask. Thread safety is not guaranteed, you should choose your own style of protecting safety of operations.

func NewTree

func NewTree[T any](preallocate uint64, ipv6 bool) (t *Tree[T])

NewTree creates Tree.

func (*Tree[T]) AddCIDR

func (t *Tree[T]) AddCIDR(cidr string, val T) error

func (*Tree[T]) DeleteCIDR

func (t *Tree[T]) DeleteCIDR(cidr string) error

func (*Tree[T]) DeleteWholeRangeCIDR

func (t *Tree[T]) DeleteWholeRangeCIDR(cidr string) error

func (*Tree[T]) FindCIDR

func (t *Tree[T]) FindCIDR(cidr string) (val T, err error)

func (*Tree[T]) SetCIDR

func (t *Tree[T]) SetCIDR(cidr string, val T) error

Jump to

Keyboard shortcuts

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