util

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFuncs = template.FuncMap{
	"bytesToCString": BytesToCString,
	"toBytes":        func(s string) []byte { return []byte(s) },
}

Functions

func APIError

func APIError(err error) error

APIError re-formats an OpenAPI-generated API client error

func BytesToCString added in v0.1.5

func BytesToCString(data []byte) string

func EnsureNod

func EnsureNod(path string, mode uint32, dev uint64) error

EnsureNod makes sure a filesystem node exists

func InitJail

func InitJail(c *JailConfig) error

InitJail initializes the jail environment

func NewShellJail

func NewShellJail(c *JailConfig, u *iam.User, token, pathVar, command string) (*exec.Cmd, error)

NewShellJail creates a new exec.Cmd for running fish in an nsjail

func SSHSignalToOS

func SSHSignalToOS(s ssh.Signal) os.Signal

SSHSignalToOS converts an SSH signal to an os.Signal

func SSHToPTYSize

func SSHToPTYSize(s ssh.Window) *pty.Winsize

SSHToPTYSize converts an SSH window size to pty window size

Types

type JailConfig

type JailConfig struct {
	TmpDir string `mapstructure:"tmp_dir"`

	LogLevel string `mapstructure:"log_level"`
	UIDStart uint32 `mapstructure:"uid_start"`
	GIDStart uint32 `mapstructure:"gid_start"`

	Cgroups struct {
		Name string

		Memory  uint64
		PIDs    uint64
		CPUTime uint32 `mapstructure:"cpu_time"`
	} `mapstructure:"cgroups"`

	HomeSize uint64 `mapstructure:"home_size"`
	Greeting string

	CLIExtra map[string]interface{} `mapstructure:"cli_extra"`

	Network struct {
		Interface string
		Address   net.IPNet
	}
}

JailConfig represents jail configuration

Jump to

Keyboard shortcuts

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