validators

package
v0.0.0-...-798ae07 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MACAddressLength = 6
)

Variables

This section is empty.

Functions

func ParseValidatorStatus

func ParseValidatorStatus(status ValidatorStatus) (code api.ReturnStatusCodes, message string)

func ValidateIPAddress

func ValidateIPAddress(in *api.IPAddress) error

func ValidateIPAddressAndExternalType

func ValidateIPAddressAndExternalType(in *api.IPAddress, t api.IPType) error

Validates both the IP address and makes sure it matches with the defined type.

func ValidateIPCIDR

func ValidateIPCIDR(in *api.IPCIDR) error

func ValidateInterfaceName

func ValidateInterfaceName(in string) error

Validates an interface name for a link. Returns error if invalid.

func ValidateLink(in *api.Link) error

wrapper for validating the integrity of a link object. returns the status code for the link at this stage.

func ValidateLinkAddress

func ValidateLinkAddress(in *api.LinkAddress) error

Validtes the link address object, returns nil if the link is fine and ready for sending to kernel.

func ValidateLinkFilterElems

func ValidateLinkFilterElems(in map[string]string) error

Validates incoming filter elements for filtering when getting a link from the kernel. Returns error if invalid.

func ValidateMACAddress

func ValidateMACAddress(in *api.MACAddress) error

func ValidateNeighbor

func ValidateNeighbor(in *api.Neighbor) error

func ValidateRoute

func ValidateRoute(in *api.Route) error

func ValidateSubnetMask

func ValidateSubnetMask(in *api.IPMask) error

Types

type ValidatorStatus

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

A custom error for validators to use that still conforms to the error interface.

func NewError

func NewError(msg string, status_code api.ReturnStatusCodes) ValidatorStatus

func (ValidatorStatus) Error

func (err ValidatorStatus) Error() string

Jump to

Keyboard shortcuts

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