Documentation ¶
Overview ¶
Package idtools is forked from https://github.com/moby/moby/tree/298ba5b13150bfffe8414922a951a7a793276d31/pkg/idtools
Index ¶
- func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error)
- type IDMap
- type Identity
- type IdentityMapping
- func (i *IdentityMapping) Empty() bool
- func (i *IdentityMapping) GIDs() []IDMap
- func (i *IdentityMapping) RootPair() Identity
- func (i *IdentityMapping) ToContainer(pair Identity) (int, int, error)
- func (i *IdentityMapping) ToHost(pair Identity) (Identity, error)
- func (i *IdentityMapping) UIDs() []IDMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IDMap ¶
type IDMap struct { ContainerID int `json:"container_id"` HostID int `json:"host_id"` Size int `json:"size"` }
IDMap contains a single entry for user namespace range remapping. An array of IDMap entries represents the structure that will be provided to the Linux kernel for creating a user namespace.
type IdentityMapping ¶
type IdentityMapping struct {
// contains filtered or unexported fields
}
IdentityMapping contains a mappings of UIDs and GIDs
func NewIDMappingsFromMaps ¶
func NewIDMappingsFromMaps(uids []IDMap, gids []IDMap) *IdentityMapping
NewIDMappingsFromMaps creates a new mapping from two slices Deprecated: this is a temporary shim while transitioning to IDMapping
func NewIdentityMapping ¶
func NewIdentityMapping(uid int, username string) (*IdentityMapping, error)
NewIdentityMapping takes a requested user and group name and using the data from /etc/sub{uid,gid} ranges, creates the proper uid and gid remapping ranges for that user/group pair
func (*IdentityMapping) Empty ¶
func (i *IdentityMapping) Empty() bool
Empty returns true if there are no id mappings
func (*IdentityMapping) GIDs ¶
func (i *IdentityMapping) GIDs() []IDMap
GIDs return the UID mapping TODO: remove this once everything has been refactored to use pairs
func (*IdentityMapping) RootPair ¶
func (i *IdentityMapping) RootPair() Identity
RootPair returns a uid and gid pair for the root user. The error is ignored because a root user always exists, and the defaults are correct when the uid and gid maps are empty.
func (*IdentityMapping) ToContainer ¶
func (i *IdentityMapping) ToContainer(pair Identity) (int, int, error)
ToContainer returns the container UID and GID for the host uid and gid
func (*IdentityMapping) ToHost ¶
func (i *IdentityMapping) ToHost(pair Identity) (Identity, error)
ToHost returns the host UID and GID for the container uid, gid. Remapping is only performed if the ids aren't already the remapped root ids
func (*IdentityMapping) UIDs ¶
func (i *IdentityMapping) UIDs() []IDMap
UIDs return the UID mapping TODO: remove this once everything has been refactored to use pairs