netlists

package module
v0.0.0-...-cec718c Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

README

go-netlists

License

MPL 2.0.

Documentation

Overview

Package netlists implements helpers to work with IP address lists.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCIDR       = errors.New("invalid CIDR")
	ErrInvalidMaskLength = errors.New("invalid mask size bits")
)

Functions

This section is empty.

Types

type CIDR

type CIDR interface {
	IsIP4() bool
	IsIP6() bool

	// MaskLength returns the mask size in bits.
	//
	// For IPv4, the returned value is `>=0 && <=32`.
	//
	// For IPv6, the returned value is `>=0 && <=128`.
	MaskLength() int

	// IPString returns only the IP component as a string.
	IPString() string

	String() string

	WithMaskLength(maskLength int) (CIDR, error)
	// contains filtered or unexported methods
}

func ParseCIDR

func ParseCIDR(v string) (CIDR, error)

type MemorySet

type MemorySet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MemorySet is an in-memory implementation of `Set`.

func (*MemorySet) Add

func (ms *MemorySet) Add(cidr string) error

func (*MemorySet) Has

func (ms *MemorySet) Has(cidr string) (ok bool, err error)

type Set

type Set interface {
	Add(cidr string) error

	Has(cidr string) (ok bool, err error)
}

Jump to

Keyboard shortcuts

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