validators

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CIDR

func CIDR() validator.String

CIDR returns a validator that checks the value is a valid CIDR using net.ParseCIDR. It does not enforce any prefix length restriction.

func CIDRWithMaxPrefix

func CIDRWithMaxPrefix(maxPrefix int) validator.String

CIDRWithMaxPrefix returns a validator that checks the value is a valid CIDR and that the prefix length is at most maxPrefix (e.g. 21 means /21 or larger network).

func PrivateCIDRWithMaxPrefix

func PrivateCIDRWithMaxPrefix(maxPrefix int) validator.String

PrivateCIDRWithMaxPrefix returns a validator that checks the value is a valid CIDR, that the prefix length is at most maxPrefix, and that the IP is in a private RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).

Types

This section is empty.

Jump to

Keyboard shortcuts

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