netns

package
v0.0.0-...-d773db1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunShim

func RunShim(fd int, tunif string, mtu uint16, addr string, domain string, dnsServer string) error

func WithMTU

func WithMTU(mtu uint16) func(*newParams)

WithMTU sets the MTU for the tunnel interface in the namespace.

func WithShimBin

func WithShimBin(shimBin string) func(*newParams)

WithShimBin sets the path to the netns_shim binary. Used for testing - normal users do not need this.

Types

type Link struct {
	chanreader.Publisher
	// contains filtered or unexported fields
}

Link implements link.Link for a local private network namespace

func New

func New(ctx context.Context, addr net.IP, domain string, dnsServer string, mods ...func(*newParams)) (*Link, error)

New creates a new Linux network namespace based network stack

func (*Link) MTU

func (ns *Link) MTU() uint16

func (*Link) PID

func (ns *Link) PID() int

func (*Link) RunInNamespace

func (ns *Link) RunInNamespace(ctx context.Context, command string, prep func(*exec.Cmd) error) (*exec.Cmd, error)

func (*Link) SendPacket

func (ns *Link) SendPacket(packet []byte) error

type NamePID

type NamePID struct {
	Name string
	PID  int
}

type Registry

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

func (*Registry) Add

func (ns *Registry) Add(name string, pid int)

func (*Registry) Del

func (ns *Registry) Del(name string)

func (*Registry) Get

func (ns *Registry) Get(name string) (int, error)

func (*Registry) GetAll

func (ns *Registry) GetAll() []NamePID

Jump to

Keyboard shortcuts

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