userns

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package userns provides helpers for interacting with Linux user namespaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserNamespaceMappings

func GetUserNamespaceMappings(nsPath string) (uidMap, gidMap []configs.IDMap, err error)

func IsSameMapping

func IsSameMapping(a, b []configs.IDMap) bool

IsSameMapping returns whether or not the two id mappings are the same. Note that if the order of the mappings is different, or a mapping has been split, the mappings will be considered different.

Types

type Handles

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

func (*Handles) Get

func (hs *Handles) Get(req Mapping) (file *os.File, err error)

Get returns a handle to a /proc/$pid/ns/user nsfs file with the requested mapping. The processes spawned to produce userns nsfds are cached, so if equivalent user namespace mappings are requested, the same user namespace will be returned. The caller is responsible for closing the returned file descriptor.

func (*Handles) Release

func (hs *Handles) Release()

Release all resources associated with this Handle. All existing files returned from Get() will continue to work even after calling Release(). The same Handles can be reused after calling Release().

type Mapping

type Mapping struct {
	UIDMappings []configs.IDMap
	GIDMappings []configs.IDMap
}

Jump to

Keyboard shortcuts

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