tunnels

package
v2.0.0-...-faab03c Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncapTypeFOU  = EncapType("fou")
	EncapTypeIPIP = EncapType("ipip")
)

Variables

This section is empty.

Functions

func CleanupTunnel

func CleanupTunnel(destinationSubnet *net.IPNet, tunnelName string)

cleanupTunnel removes any traces of tunnels / routes that were setup by nrc.setupOverlayTunnel() and are no longer needed. All errors are logged only, as we want to attempt to perform all cleanup actions regardless of their success

func GenerateTunnelName

func GenerateTunnelName(nodeIP string) string

GenerateTunnelName will generate a name for a tunnel interface given a node IP Since linux restricts interface names to 15 characters, we take the sha-256 of the node IP after removing non-entropic characters like '.' and ':', and then use the first 12 bytes of it. This allows us to cater to both long IPv4 addresses and much longer IPv6 addresses.

TODO: In the future, we should consider using the hexadecimal byte representation of IPv4 addresses and using a the SHA256 of the hash. Additionally, we should not remove non-entropic characters as it can cause hash collisions as "21.3.0.4" would has the same as "2.13.0.4" without "."'s.

Types

type EncapPort

type EncapPort uint16

func ParseEncapPort

func ParseEncapPort(encapPort uint16) (EncapPort, error)

type EncapType

type EncapType string

EncapType represents the type of encapsulation used for an overlay tunnel in kube-router.

func ParseEncapType

func ParseEncapType(encapType string) (EncapType, bool)

ParseEncapType parses the given string and returns an Encap type if valid. It returns an error if the encapsulation type is invalid.

Parameters:

  • s: A string representing the encapsulation type.

Returns:

  • Encap: The parsed encapsulation type.
  • bool: A boolean indicating whether the encapsulation type is valid.

type OverlayTunnel

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

func NewOverlayTunnel

func NewOverlayTunnel(krNode utils.NodeIPAware, encapType EncapType, encapPort EncapPort) *OverlayTunnel

func (*OverlayTunnel) EncapPort

func (o *OverlayTunnel) EncapPort() EncapPort

func (*OverlayTunnel) EncapType

func (o *OverlayTunnel) EncapType() EncapType

func (*OverlayTunnel) SetupOverlayTunnel

func (o *OverlayTunnel) SetupOverlayTunnel(tunnelName string, nextHop net.IP,
	nextHopSubnet *net.IPNet) (netlink.Link, error)

setupOverlayTunnel attempts to create a tunnel link and corresponding routes for IPIP based overlay networks

type Tunneler

type Tunneler interface {
	SetupOverlayTunnel(tunnelName string, nextHop net.IP, nextHopSubnet *net.IPNet) (netlink.Link, error)
	EncapType() EncapType
	EncapPort() EncapPort
}

Jump to

Keyboard shortcuts

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