netns

package
v0.4.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package netns runs small pieces of work inside another process's network namespace. A unix socket belongs to the namespace it was created in, and criu only finds the sockets of the namespaces it dumps, so a channel fiberd shares with a tree inside a container has to be made in the container's namespace. fiberd is root in the initial user namespace, which may enter every namespace below it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(pid int, fn func() error) error

Do runs fn on an OS thread switched into the network namespace of pid, then switches the thread back. The thread is locked to the goroutine throughout. Should switching back fail, the thread is left locked to a goroutine that ends, which makes the runtime discard it rather than hand a thread in the wrong namespace to other goroutines.

func LoopbackUp

func LoopbackUp(pid int) error

LoopbackUp brings the loopback interface up in the network namespace of pid. A namespace criu creates empty has it down.

func Socketpair

func Socketpair(pid, typ int) ([2]int, error)

Socketpair makes a unix socket pair of the given type (SOCK_STREAM, SOCK_SEQPACKET) in the network namespace of pid, close-on-exec.

Types

This section is empty.

Jump to

Keyboard shortcuts

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