Documentation
¶
Overview ¶
Package netns provides utility functions for network ns handling on linux platform.
Index ¶
- func GetCurrentIno() (uint32, error)
- func GetInoForNs(ns netns.NsHandle) (uint32, error)
- func GetNetNamespaceFromPid(procRoot string, pid int) (netns.NsHandle, error)
- func GetNetNamespaces(procRoot string) ([]netns.NsHandle, error)
- func GetNetNsInoFromPid(procRoot string, pid int) (uint32, error)
- func GetRootNetNamespace(procRoot string) (netns.NsHandle, error)
- func WithNS(ns netns.NsHandle, fn func() error) error
- func WithRootNS(procRoot string, fn func() error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentIno ¶
GetCurrentIno returns the ino number for the current network namespace
func GetInoForNs ¶
GetInoForNs gets the inode number for the given network namespace
func GetNetNamespaceFromPid ¶
GetNetNamespaceFromPid gets the network namespace for a given `pid`
func GetNetNamespaces ¶
GetNetNamespaces returns a list of network namespaces on the machine. The caller is responsible for calling Close() on each of the returned NsHandle's.
func GetNetNsInoFromPid ¶
GetNetNsInoFromPid gets the network namespace inode number for the given `pid`
func GetRootNetNamespace ¶
GetRootNetNamespace gets the root network namespace
func WithNS ¶
WithNS executes the given function in the given network namespace, and then switches back to the previous namespace.
func WithRootNS ¶
WithRootNS executes a function within root network namespace and then switch back to the previous namespace. If the thread is already in the root network namespace, the function is executed without calling SYS_SETNS.
Types ¶
This section is empty.