nradix

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 5 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 comparable] interface {
	AddCIDR(cidr string, val T) error
	AddCIDRb(cidr []byte, val T) error
	SetCIDR(cidr string, val T) error
	SetCIDRb(cidr []byte, val T) error
	DeleteWholeRangeCIDR(cidr string) error
	DeleteWholeRangeCIDRb(cidr []byte) error
	DeleteCIDR(cidr string) error
	DeleteCIDRb(cidr []byte) error
	FindCIDR(cidr string) (T, bool, error)
	FindCIDRb(cidr []byte) (T, bool, error)
}

func New

func New[T comparable](preallocate int) Tree[T]

New creates tree and preallocates (if preallocate not zero) number of nodes that would be ready to fill with data.

Jump to

Keyboard shortcuts

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