testutil

package
v0.0.0-...-45a9bcf Latest Latest
Warning

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

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

Documentation

Overview

Package testutil contains helper functions used for testing conntrack

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNS

func AddNS(tb testing.TB) string

AddNS adds a randomly named network namespace

func SetupCrossNsDNAT

func SetupCrossNsDNAT(tb testing.TB) (ns string)

SetupCrossNsDNAT sets up a network namespace, a veth pair, and a NAT rule in the specified network namespace. Redirecting port 80 to 8080 within the namespace.

func SetupCrossNsDNAT6

func SetupCrossNsDNAT6(t *testing.T) (ns string)

SetupCrossNsDNAT6 sets up a network namespace, along with two IPv6 addresses fd00::1 and fd00::2 to be used for namespace aware tests. fd00::2 is within the specified namespace, while fd00::1 is a peer in the root namespace.

func SetupCrossNsDNATWithPorts

func SetupCrossNsDNATWithPorts(tb testing.TB, dport int, redirPort int) (ns string)

SetupCrossNsDNATWithPorts sets up a network namespace, a veth pair, and a NAT rule in the specified network namespace. Redirecting `dport` to `redirPort` within the namespace.

func SetupDNAT

func SetupDNAT(t *testing.T)

SetupDNAT sets up a NAT translation from: * 2.2.2.2 to 1.1.1.1 (OUTPUT Chain) * 3.3.3.3 to 1.1.1.1 (PREROUTING Chain)

func SetupDNAT6

func SetupDNAT6(t *testing.T)

SetupDNAT6 sets up a NAT translation from fd00::2 to fd00::1

func SetupSNAT

func SetupSNAT(t *testing.T) string

SetupSNAT sets up a NAT translation from: * 6.6.6.6 to 7.7.7.7 (POSTROUTING Chain)

func SetupVeth6Pair

func SetupVeth6Pair(t *testing.T) (ns string)

SetupVeth6Pair sets up a network namespace, along with two IPv6 addresses fd00::1 and fd00::2 to be used for namespace aware tests. fd00::2 is within the specified namespace, while fd00::1 is a peer in the root namespace.

func SetupVethPair

func SetupVethPair(tb testing.TB) (ns string)

SetupVethPair sets up a network namespace, along with two IP addresses 2.2.2.3 and 2.2.2.4 to be used for namespace aware tests. 2.2.2.4 is within the specified namespace, while 2.2.2.3 is a peer in the root namespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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