chroot

package
v6.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fs billy.Basic, base string) billy.Filesystem

New creates a new filesystem wrapping the given 'fs', rooted at base. All paths passed to the returned filesystem are joined with base before being forwarded to the underlying filesystem.

Types

type ChrootHelper

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

ChrootHelper is a helper to implement billy.Chroot. It is not a security boundary; callers that need containment should use a filesystem implementation that enforces paths at the OS boundary instead.

func (*ChrootHelper) Capabilities

func (fs *ChrootHelper) Capabilities() billy.Capability

Capabilities implements the Capable interface.

func (*ChrootHelper) Chmod

func (fs *ChrootHelper) Chmod(path string, mode fs.FileMode) error

func (*ChrootHelper) Chroot

func (fs *ChrootHelper) Chroot(path string) (billy.Filesystem, error)

func (*ChrootHelper) Create

func (fs *ChrootHelper) Create(filename string) (billy.File, error)

func (*ChrootHelper) Join

func (fs *ChrootHelper) Join(elem ...string) string

func (*ChrootHelper) Lstat

func (fs *ChrootHelper) Lstat(filename string) (os.FileInfo, error)

func (*ChrootHelper) MkdirAll

func (fs *ChrootHelper) MkdirAll(filename string, perm fs.FileMode) error

func (*ChrootHelper) Open

func (fs *ChrootHelper) Open(filename string) (billy.File, error)

func (*ChrootHelper) OpenFile

func (fs *ChrootHelper) OpenFile(filename string, flag int, mode fs.FileMode) (billy.File, error)

func (*ChrootHelper) ReadDir

func (fs *ChrootHelper) ReadDir(path string) ([]fs.DirEntry, error)
func (fs *ChrootHelper) Readlink(link string) (string, error)

Readlink returns the target stored for link.

Relative targets are returned unchanged, preserving the original separators as written by ChrootHelper.Symlink or the underlying filesystem. Absolute targets that resolve under the chroot base are translated back to be absolute relative to the chroot (using the host path separator), so callers see paths in the chroot's coordinate system rather than the underlying filesystem's. Absolute targets that resolve outside the base are returned as written.

func (*ChrootHelper) Remove

func (fs *ChrootHelper) Remove(path string) error

func (*ChrootHelper) Rename

func (fs *ChrootHelper) Rename(from, to string) error

func (*ChrootHelper) Root

func (fs *ChrootHelper) Root() string

func (*ChrootHelper) Stat

func (fs *ChrootHelper) Stat(filename string) (os.FileInfo, error)
func (fs *ChrootHelper) Symlink(target, link string) error

Symlink creates link with the given target. Slashes in target are normalised to the host separator. Absolute targets are rewritten to be rooted under the chroot base before being stored, so that the link is resolvable when the chroot is reopened from a different working directory. Relative targets are stored as provided.

func (*ChrootHelper) TempFile

func (fs *ChrootHelper) TempFile(dir, prefix string) (billy.File, error)

func (*ChrootHelper) Underlying

func (fs *ChrootHelper) Underlying() billy.Basic

type FileDescriptor

type FileDescriptor interface {
	Fd() (uintptr, bool)
}

Jump to

Keyboard shortcuts

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