ipnet

package
v0.0.0-...-ab2e2b4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ipnet wraps net.IPNet to get CIDR serialization. derived from: https://github.com/openshift/installer/blob/e6ac416efbf6d8dcc5a36e1187a4e05bbe7c9319/pkg/ipnet/ipnet.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPNet

type IPNet net.IPNet

IPNet wraps net.IPNet to get CIDR serialization.

+kubebuilder:validation:Type=string +kubebuilder:validation:MaxLength=43 +kubebuilder:validation:XValidation:rule=`self.matches('^((\\d{1,3}\\.){3}\\d{1,3}/\\d{1,2})$') || self.matches('^([0-9a-fA-F]{0,4}:){2,7}([0-9a-fA-F]{0,4})?/[0-9]{1,3}$')`,message="cidr must be a valid IPv4 or IPv6 CIDR notation (e.g., 192.168.1.0/24 or 2001:db8::/64)"

func MustParseCIDR

func MustParseCIDR(s string) *IPNet

MustParseCIDR parses a CIDR from its string representation. If the parse fails, the function will panic.

func ParseCIDR

func ParseCIDR(s string) (*IPNet, error)

ParseCIDR parses a CIDR from its string representation.

func (*IPNet) DeepCopy

func (in *IPNet) DeepCopy() *IPNet

func (*IPNet) DeepCopyInto

func (in *IPNet) DeepCopyInto(out *IPNet)

func (*IPNet) MarshalJSON

func (ipnet *IPNet) MarshalJSON() (data []byte, err error)

MarshalJSON interface for an IPNet

func (*IPNet) String

func (ipnet *IPNet) String() string

String returns a CIDR serialization of the subnet, or an empty string if the subnet is nil.

func (*IPNet) UnmarshalJSON

func (ipnet *IPNet) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON interface for an IPNet

type IPNets

type IPNets []IPNet

func (IPNets) CSVString

func (ipnets IPNets) CSVString() string

func (IPNets) StringSlice

func (ipnets IPNets) StringSlice() []string

Jump to

Keyboard shortcuts

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