tree

package
v0.1.105 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tree

type Tree interface {
	// Find the IpRange for a given ip, returns nil if none matches.
	FindIPRange(ip net.IP) *source.IPRange

	// Add a new IpRange to the tree.
	Add(ipRange *source.IPRange)

	// Serialize the tree to a buffer.
	SerializeTo(w io.Writer)

	// Get all ranges stored in tree, after duduplication ...
	GetAllRanges() []*source.IPRange
}

This package implements a segement tree for ip ranges, that can be saved & loaded to/from a file at build time.

func NewIPv4Tree

func NewIPv4Tree() Tree

NewTree creates a new tree, returns the root node.

func NewIPv6Tree

func NewIPv6Tree() Tree

func NewTreeFrom

func NewTreeFrom(r io.Reader, cat source.IPCat) Tree

Jump to

Keyboard shortcuts

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