utils

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package utils contain utility functions for the IPAM package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMask

func GetMask(network string) uint8

GetMask retrieves the mask from a CIDR.

func GetTunnelIP

func GetTunnelIP(externalCIDR string) (string, error)

GetTunnelIP returns the IP address of the tunnel, which is the first external CIDR ip.

func GetUnknownSourceIP

func GetUnknownSourceIP(extCIDR string) (string, error)

GetUnknownSourceIP returns the IP address used to map unknown sources.

func IsValidCIDR

func IsValidCIDR(cidr string) error

IsValidCIDR returns an error if the received CIDR is invalid.

func MapIPToNetwork

func MapIPToNetwork(newNetwork, oldIP string) (newIP string, err error)

MapIPToNetwork creates a new IP address obtained by means of the old IP address and the new network.

func Next

func Next(network string) string

Next used to get the second half of a given network.

func SetMask

func SetMask(network string, mask uint8) string

SetMask forges a new cidr from a network cidr and a mask.

func SplitNetwork

func SplitNetwork(network string) []string

SplitNetwork returns the two halves that make up a given network.

Types

This section is empty.

Jump to

Keyboard shortcuts

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