internal

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyPaths added in v0.0.8

func CopyPaths(os System, v *Paths)

CopyPaths is a generic implementation of [System.Paths].

Types

type Paths added in v0.0.8

type Paths struct {
	// path to shared directory e.g. /tmp/fortify.%d
	SharePath string `json:"share_path"`
	// XDG_RUNTIME_DIR value e.g. /run/user/%d
	RuntimePath string `json:"runtime_path"`
	// application runtime directory e.g. /run/user/%d/fortify
	RunDirPath string `json:"run_dir_path"`
}

Paths contains environment dependent paths used by fortify.

type Std added in v0.0.8

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

Std implements System using the standard library.

func (*Std) Executable added in v0.0.8

func (s *Std) Executable() (string, error)

func (*Std) Exit added in v0.0.8

func (s *Std) Exit(code int)

func (*Std) Geteuid added in v0.0.8

func (s *Std) Geteuid() int

func (*Std) LookPath added in v0.0.8

func (s *Std) LookPath(file string) (string, error)

func (*Std) Lookup added in v0.0.8

func (s *Std) Lookup(username string) (*user.User, error)

func (*Std) LookupEnv added in v0.0.8

func (s *Std) LookupEnv(key string) (string, bool)

func (*Std) Open added in v0.0.8

func (s *Std) Open(name string) (fs.File, error)

func (*Std) Paths added in v0.0.8

func (s *Std) Paths() Paths

func (*Std) ReadDir added in v0.0.8

func (s *Std) ReadDir(name string) ([]os.DirEntry, error)

func (*Std) SdBooted added in v0.0.10

func (s *Std) SdBooted() bool

func (*Std) Stat added in v0.0.8

func (s *Std) Stat(name string) (fs.FileInfo, error)

func (*Std) TempDir added in v0.0.8

func (s *Std) TempDir() string

type System added in v0.0.8

type System interface {
	// Geteuid provides [os.Geteuid].
	Geteuid() int
	// LookupEnv provides [os.LookupEnv].
	LookupEnv(key string) (string, bool)
	// TempDir provides [os.TempDir].
	TempDir() string
	// LookPath provides [exec.LookPath].
	LookPath(file string) (string, error)
	// Executable provides [os.Executable].
	Executable() (string, error)
	// Lookup provides [user.Lookup].
	Lookup(username string) (*user.User, error)
	// ReadDir provides [os.ReadDir].
	ReadDir(name string) ([]fs.DirEntry, error)
	// Stat provides [os.Stat].
	Stat(name string) (fs.FileInfo, error)
	// Open provides [os.Open]
	Open(name string) (fs.File, error)
	// Exit provides [os.Exit].
	Exit(code int)

	// Paths returns a populated [Paths] struct.
	Paths() Paths
	// SdBooted implements https://www.freedesktop.org/software/systemd/man/sd_booted.html
	SdBooted() bool
}

System provides safe access to operating system resources.

Directories

Path Synopsis
Package fmsg provides various functions for output messages.
Package fmsg provides various functions for output messages.

Jump to

Keyboard shortcuts

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