iplist

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package iplist matches client addresses against a set of CIDR prefixes: a policy's IP allow and deny lists (#358).

A Set holds the prefixes as sorted, merged address ranges, one slice per family, so a lookup is a binary search: a few dozen comparisons at 10,000 prefixes, with no allocation.

Index

Constants

View Source
const MaxEntries = 100000

MaxEntries bounds a Set, as the bundle and the CRD bound a policy's lists.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is an immutable set of addresses. The nil Set is empty. It is safe for concurrent use.

func Parse

func Parse(entries []string) (*Set, error)

Parse returns the set of the CIDR prefixes (10.0.0.0/8, 2001:db8::/32) or addresses in entries. An IPv4-mapped IPv6 prefix of at least /96 is its IPv4 prefix.

func (*Set) Contains

func (s *Set) Contains(a netip.Addr) bool

Contains reports whether a is in s. An IPv4-mapped IPv6 address is its IPv4 address; the zero Addr is in no set.

func (*Set) Len

func (s *Set) Len() int

Len is the number of address ranges s holds, after merging.

Jump to

Keyboard shortcuts

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