netdb

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPLease added in v0.2.0

type IPLease struct {
	IP         string
	Subnet     string
	Reserved   bool
	ReleasedAt *time.Time
}

IPLease represents an IP lease record from the database.

type LeaseFilter added in v0.2.0

type LeaseFilter struct {
	Subnet       string
	ReservedOnly bool
	ReleasedOnly bool
}

LeaseFilter specifies filters for listing IP leases.

type NetDB

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

func New

func New(path string) (*NetDB, error)

func (*NetDB) Close

func (n *NetDB) Close() error

func (*NetDB) ForceReleaseAll added in v0.2.0

func (n *NetDB) ForceReleaseAll() (int, error)

ForceReleaseAll releases all reserved IPs.

func (*NetDB) ForceReleaseIP added in v0.2.0

func (n *NetDB) ForceReleaseIP(ip string) (bool, error)

ForceReleaseIP releases a specific IP address regardless of its current state.

func (*NetDB) ForceReleaseIPs added in v0.2.0

func (n *NetDB) ForceReleaseIPs(ips []string) error

ForceReleaseIPs releases a specific set of IPs in a single transaction.

func (*NetDB) ForceReleaseSubnet added in v0.2.0

func (n *NetDB) ForceReleaseSubnet(subnet string) (int, error)

ForceReleaseSubnet releases all reserved IPs in a subnet.

func (*NetDB) GetReservedIPs added in v0.2.0

func (n *NetDB) GetReservedIPs(subnet string) ([]string, error)

GetReservedIPs returns all reserved IP addresses, optionally filtered by subnet.

func (*NetDB) GetSubnetStatus added in v0.2.0

func (n *NetDB) GetSubnetStatus() ([]SubnetStatus, error)

GetSubnetStatus returns utilization statistics for all subnets.

func (*NetDB) ListLeases added in v0.2.0

func (n *NetDB) ListLeases(filter LeaseFilter) ([]IPLease, error)

ListLeases returns IP leases matching the given filter.

func (*NetDB) ReleaseInterface

func (n *NetDB) ReleaseInterface(name string) error

func (*NetDB) ReserveInterface

func (n *NetDB) ReserveInterface(prefix string) (string, error)

func (*NetDB) Subnet

func (n *NetDB) Subnet(cidr string) (*Subnet, error)

type Subnet

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

func (*Subnet) Prefix

func (s *Subnet) Prefix() netip.Prefix

func (*Subnet) Release

func (s *Subnet) Release(prefix netip.Prefix) error

func (*Subnet) ReleaseAddr

func (s *Subnet) ReleaseAddr(addr netip.Addr) error

func (*Subnet) ReleaseSubnet

func (s *Subnet) ReleaseSubnet(prefix netip.Prefix) error

func (*Subnet) Reserve

func (s *Subnet) Reserve() (netip.Prefix, error)

func (*Subnet) ReserveSubnet

func (s *Subnet) ReserveSubnet(bits int, identifier string) (*Subnet, error)

func (*Subnet) Router

func (s *Subnet) Router() netip.Prefix

type SubnetStatus added in v0.2.0

type SubnetStatus struct {
	Subnet   string
	Total    int
	Reserved int
	Released int
	Capacity int
}

SubnetStatus contains utilization statistics for a subnet.

Jump to

Keyboard shortcuts

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