ipblock

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(cfg Config) error

Types

type Config

type Config struct {
	// V4Prefix is the prefix length for IPv4 blocks
	V4Prefix int `json:"v4_prefix"`
	// V6Prefix is the prefix length for IPv6 blocks
	V6Prefix int `json:"v6_prefix"`
}

IPBlockConfig represents the configuration for an IPBlock. It's used to specify the prefix length for IPv4 and IPv6 blocks for IP blocking.

func (Config) IsEmpty

func (c Config) IsEmpty() bool

type IPBlock

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

IPBlock represents either an IPv4 or IPv6 block Data representation: v6: Stored as first 8 bytes of the address v4: Stored as 2001:db8:<v4>

func NewIPBlock

func NewIPBlock(ip net.IP, cfg Config) (IPBlock, error)

NewIPBlock creates a new IPBlock from an IP address

func (IPBlock) ToIPNet

func (b IPBlock) ToIPNet(cfg Config) *net.IPNet

func (IPBlock) ToUint64

func (b IPBlock) ToUint64() uint64

Jump to

Keyboard shortcuts

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