chroot

package
v0.0.0-...-85e830f Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS interface {
	fs.ReadDirFS
	fs.ReadFileFS
}

type FileSystem

type FileSystem struct {
	Root      fs.FS
	Logger    *log.Logger
	Verbosity LogVerbosity
	// contains filtered or unexported fields
}

FileSystem represents a chrooted filesystem.

func New

func New(dirpath string) FileSystem

New generates a new FileSystem rooted at dirpath in the operating system.

func (*FileSystem) CreateDirectory

func (fsys *FileSystem) CreateDirectory(dirpath string)

CreateDirectory creates a directory rooted within fsys. If dirpath already exists within fsys, then it succeeds quietly. Will automatically create intermediary directories.

func (*FileSystem) CreateFile

func (fsys *FileSystem) CreateFile(filepath string, data []byte) *os.File

CreateFile creates a file rooted from fsys at path filepath and fills it with the given data.

type LogVerbosity

type LogVerbosity int // Could extract all of this out to separate logging utility, or use another pre-built one
const (
	DEFAULT LogVerbosity = iota
	INFO
	DEBUG
)

Jump to

Keyboard shortcuts

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