Documentation ¶
Overview ¶
Package netns holds netns related files
Package netns holds netns related files
Index ¶
- Variables
- type NetworkDeviceDump
- type NetworkNamespace
- type NetworkNamespaceDump
- type Resolver
- func (nr *Resolver) Close()
- func (nr *Resolver) DumpNetworkNamespaces(params *api.DumpNetworkNamespaceParams) *api.DumpNetworkNamespaceMessage
- func (nr *Resolver) FlushNetworkNamespace(netns *NetworkNamespace)
- func (nr *Resolver) GetState() int64
- func (nr *Resolver) IsLazyDeletionInterface(name string) bool
- func (nr *Resolver) QueueNetworkDevice(device model.NetDevice)
- func (nr *Resolver) ResolveNetworkNamespace(nsID uint32) *NetworkNamespace
- func (nr *Resolver) SaveNetworkNamespaceHandle(nsID uint32, nsPath *utils.NetNSPath) (*NetworkNamespace, bool)
- func (nr *Resolver) SaveNetworkNamespaceHandleLazy(nsID uint32, nsPathFunc func() *utils.NetNSPath) (*NetworkNamespace, bool)
- func (nr *Resolver) SendStats() error
- func (nr *Resolver) SetState(state int64)
- func (nr *Resolver) Start(ctx context.Context) error
- func (nr *Resolver) SyncCache(pid uint32) bool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoNetworkNamespaceHandle is used to indicate that we haven't resolved a handle for the requested network // namespace yet. ErrNoNetworkNamespaceHandle = fmt.Errorf("no network namespace handle") )
Functions ¶
This section is empty.
Types ¶
type NetworkDeviceDump ¶
NetworkDeviceDump is used to dump a network namespace
type NetworkNamespace ¶
NetworkNamespace is used to hold a handle to a network namespace
func NewNetworkNamespace ¶
func NewNetworkNamespace(nsID uint32) *NetworkNamespace
NewNetworkNamespace returns a new NetworkNamespace instance
func NewNetworkNamespaceWithPath ¶
func NewNetworkNamespaceWithPath(nsID uint32, nsPath *utils.NetNSPath) (*NetworkNamespace, error)
NewNetworkNamespaceWithPath returns a new NetworkNamespace instance from a path.
func (*NetworkNamespace) GetNamespaceHandleDup ¶
func (nn *NetworkNamespace) GetNamespaceHandleDup() (*os.File, error)
GetNamespaceHandleDup duplicates the network namespace handle and returns it. WARNING: it is up to the caller of this function to close the duplicated network namespace handle. Failing to close a network namespace handle may lead to leaking the network namespace.
func (*NetworkNamespace) ID ¶
func (nn *NetworkNamespace) ID() uint32
ID returns the network namespace ID
type NetworkNamespaceDump ¶
type NetworkNamespaceDump struct { NsID uint32 HandleFD int HandlePath string LonelyTimeout time.Time Devices []NetworkDeviceDump DevicesInQueue []NetworkDeviceDump }
NetworkNamespaceDump is used to dump a network namespce
type Resolver ¶
Resolver is used to store namespace handles
func NewResolver ¶
func NewResolver(config *config.Config, manager *manager.Manager, statsdClient statsd.ClientInterface, tcResolver *tc.Resolver) (*Resolver, error)
NewResolver returns a new instance of Resolver
func (*Resolver) Close ¶
func (nr *Resolver) Close()
Close closes this resolver and frees all the resources
func (*Resolver) DumpNetworkNamespaces ¶
func (nr *Resolver) DumpNetworkNamespaces(params *api.DumpNetworkNamespaceParams) *api.DumpNetworkNamespaceMessage
DumpNetworkNamespaces dumps the network namespaces held by the namespace resolver
func (*Resolver) FlushNetworkNamespace ¶
func (nr *Resolver) FlushNetworkNamespace(netns *NetworkNamespace)
FlushNetworkNamespace flushes the cached entries for the provided network namespace. (WARNING: you probably want to use probe.FlushNetworkNamespace instead)
func (*Resolver) IsLazyDeletionInterface ¶
IsLazyDeletionInterface returns true if an interface name is in the list of interfaces that aren't explicitly deleted by the container runtime when a container is deleted.
func (*Resolver) QueueNetworkDevice ¶
QueueNetworkDevice adds the input device to the map of queued network devices. Once a handle for the network namespace of the device is resolved, a new TC classifier will automatically be added to the device. The queue is cleaned up periodically if a namespace do not own any process.
func (*Resolver) ResolveNetworkNamespace ¶
func (nr *Resolver) ResolveNetworkNamespace(nsID uint32) *NetworkNamespace
ResolveNetworkNamespace returns a file descriptor to the network namespace. WARNING: it is up to the caller to close this file descriptor when it is done using it. Do not forget to close this file descriptor, otherwise we might exhaust the host IPs by keeping all network namespaces alive.
func (*Resolver) SaveNetworkNamespaceHandle ¶
func (nr *Resolver) SaveNetworkNamespaceHandle(nsID uint32, nsPath *utils.NetNSPath) (*NetworkNamespace, bool)
SaveNetworkNamespaceHandle inserts the provided process network namespace in the list of tracked network. Returns true if a new entry was added.
func (*Resolver) SaveNetworkNamespaceHandleLazy ¶
func (nr *Resolver) SaveNetworkNamespaceHandleLazy(nsID uint32, nsPathFunc func() *utils.NetNSPath) (*NetworkNamespace, bool)
SaveNetworkNamespaceHandleLazy inserts the provided process network namespace in the list of tracked network. Returns true if a new entry was added.
func (*Resolver) SendStats ¶
SendStats sends metrics about the current state of the namespace resolver