subnet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package subnet provides Linux-aware wrappers around gonnect subnet allocation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CombinedAllocator

type CombinedAllocator = gonnectsubnet.CombinedAllocator

CombinedAllocator allocates both subnets and IP addresses.

func NewDefaultAllocator

func NewDefaultAllocator(config DefaultAllocatorConfig) *CombinedAllocator

NewDefaultAllocator creates a gonnect default allocator that avoids address space currently used by local network interfaces.

The returned allocator wraps config.IPFilter and config.SubnetFilter. A nil caller filter is treated as allowing all candidates that pass the system checks.

IP candidates are rejected when the same address is assigned to any local network interface.

Subnet candidates are rejected when they exactly match a local interface network, when they contain any local interface address, or when they overlap a local interface network. Only the overlap check ignores local interface networks broader than /8, because networks such as 0.0.0.0/0 and ::/0 are too broad to be useful blockers and would collide with almost every allocation.

The local interface state is checked for each candidate allocation try. If interface enumeration fails, the allocator falls back to the caller-provided filters only for that candidate.

type DefaultAllocatorConfig

type DefaultAllocatorConfig = gonnectsubnet.DefaultAllocatorConfig

DefaultAllocatorConfig configures NewDefaultAllocator.

type IPFilter

type IPFilter = gonnectsubnet.IPFilter

IPFilter decides whether an IP address may be allocated.

type SubnetFilter

type SubnetFilter = gonnectsubnet.SubnetFilter

SubnetFilter decides whether a subnet may be allocated.

Jump to

Keyboard shortcuts

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