internal

package
v2.0.0-...-c342dd4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(pathPrefix string, path string) string

Prepends the path prefix to the path, if it's not absolute

func AddAddress

func AddAddress(link NetworkLink, address CIDRAddress) error

Adds an cidr address to a network link

func AddressExists

func AddressExists(link NetworkLink, address CIDRAddress) (bool, error)

Checks whether a cidr address is already present on a network link

func AdvertiseAddress

func AdvertiseAddress(link NetworkLink, address CIDRAddress) error

Advertises an cidr address on a network link

func DeleteAddress

func DeleteAddress(link NetworkLink, address CIDRAddress) error

Removes a cidr address from a network link

func RunServer

func RunServer(configFilePath string) error

Runs the server

Types

type AddressPolicy

type AddressPolicy struct {
	IPNetwork          IPNetwork `json:"ip_network"`
	InterfaceNameRegex Regexp    `json:"interface_name_regex"`
}

Holds configuration for a address policy

func (AddressPolicy) Allows

func (ap AddressPolicy) Allows(interfaceName string, address CIDRAddress) bool

Checks whether an interface name and address is allowed by an address policy

type CIDRAddress

type CIDRAddress = *netlink.Addr

func ParseAddress

func ParseAddress(address string) (CIDRAddress, error)

Parses an cidr address

type Config

type Config struct {
	Port                    uint16          `json:"port"`
	ClientCACertificatePath string          `json:"client_ca_certificate_path"`
	ServerCertificatePath   string          `json:"server_certificate_path"`
	ServerKeyPath           string          `json:"server_key_path"`
	AddressPolicies         []AddressPolicy `json:"address_policies"`
}

Holds configuration information

func ReadConfiguration

func ReadConfiguration(configFilePath string) (*Config, error)

Reads the configuration from a file

func (Config) Validate

func (c Config) Validate() error

Validates a configuration

type IPNetwork

type IPNetwork struct {
	net.IPNet
}

Custom type for ip network parsing

func (*IPNetwork) UnmarshalJSON

func (ipnet *IPNetwork) UnmarshalJSON(data []byte) error

Implements parsing a json value to the ip network value

type NetworkLink = *netlink.Link

func LinkByName

func LinkByName(interfaceName string) (NetworkLink, error)

Returns a network link based on the interface name

type Regexp

type Regexp struct {
	regexp.Regexp
}

Custom type for regexp parsing

func (*Regexp) UnmarshalJSON

func (r *Regexp) UnmarshalJSON(data []byte) error

Implements parsing a json value to the regexp value

type RequestData

type RequestData struct {
	Address       string `json:"address"`
	InterfaceName string `json:"interface_name"`
}

Jump to

Keyboard shortcuts

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