Documentation

Index

Constants

View Source
const (
	FoU4LinkPrefix = "fou4_"
	FoU6LinkPrefix = "fou6_"
)

Prefixes for Foo-over-UDP tunnel link names

Variables

View Source
var ErrIPFamilyMismatch = errors.New("no matching IP family")

ErrIPFamilyMismatch is the sentinel error to indicate that FoUTunnel or Egress cannot handle the given address because it is not setup for the address family.

Functions

This section is empty.

Types

type Egress

type Egress interface {
	Init() error
	AddClient(net.IP, netlink.Link) error
}

Egress represents NAT and routing service running on egress Pods. Methods are idempotent; i.e. they can be called multiple times.

func NewEgress

func NewEgress(iface string, ipv4, ipv6 net.IP) Egress

NewEgress creates an Egress

type FoUTunnel

type FoUTunnel interface {
	// Init starts FoU listening socket.
	Init() error

	// AddPeer setups tunnel devices to the given peer and returns them.
	// If FoUTunnel does not setup for the IP family of the given address,
	// this returns ErrIPFamilyMismatch error.
	AddPeer(net.IP) (netlink.Link, error)

	// DelPeer deletes tunnel for the peer, if any.
	DelPeer(net.IP) error
}

FoUTunnel represents the interface for Foo-over-UDP tunnels. Methods are idempotent; i.e. they can be called multiple times.

func NewFoUTunnel

func NewFoUTunnel(port int, localIPv4, localIPv6 net.IP) FoUTunnel

NewFoUTunnel creates a new FoUTunnel. port is the UDP port to receive FoU packets. localIPv4 is the local IPv4 address of the IPIP tunnel. This can be nil. localIPv6 is the same as localIPv4 for IPv6.

type NatClient

type NatClient interface {
	Init() error
	AddEgress(link netlink.Link, subnets []*net.IPNet) error
}

NatClient represents the interface for NAT client This can be re-initialized by calling `Init` again.

func NewNatClient

func NewNatClient(ipv4, ipv6 net.IP, podNodeNet []*net.IPNet) NatClient

NewNatClient creates a NatClient.

`ipv4` and `ipv6` are IPv4 and IPv6 addresses of the client pod. Either one of them can be nil.

`podNodeNet` is, if given, are networks for Pod and Node addresses. If all the addresses of Pods and Nodes are within IPv4/v6 private addresses, `podNodeNet` can be left nil.