netlink

package module
v0.0.0-...-cd6ae7c Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvName = "IS_HOST_A"
	// 无需修改
	NSName     = "ns0"
	BridgeName = "bridge0"
	VEth0      = "veth0"
	NsEth0     = "nseth0"

	// 如果需要在自己的机器上实现,需要改动HostA 和 HostB 变量即可
	HostA        = "192.168.0.3/24"
	HostANS0     = "10.0.1.1/24"
	HostABridge0 = "10.0.1.254/24"

	HostB        = "192.168.0.2/24"
	HostBNS0     = "10.0.2.1/24"
	HostBBridge0 = "10.0.2.254/24"
)

Variables

View Source
var (
	IsHostA = false
)

Functions

func Error

func Error(e error)

func NsDo

func NsDo(doFunc DoFunc) error

func SetupBridge

func SetupBridge() *netlink.Bridge

func SetupIPTables

func SetupIPTables()

func SetupNetNamespace

func SetupNetNamespace() *netns.NsHandle

func SetupNsDefaultRoute

func SetupNsDefaultRoute()

func SetupRouteNs2Ns

func SetupRouteNs2Ns()

func SetupVEthPeer

func SetupVEthPeer(br *netlink.Bridge, ns *netns.NsHandle)

Types

type DoFunc

type DoFunc func(oNs, nNs *netns.NsHandle) error

Jump to

Keyboard shortcuts

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