Documentation
¶
Index ¶
- func CopyPaths(os System, v *Paths)
- type Paths
- type Std
- func (s *Std) Executable() (string, error)
- func (s *Std) Exit(code int)
- func (s *Std) Geteuid() int
- func (s *Std) LookPath(file string) (string, error)
- func (s *Std) LookupEnv(key string) (string, bool)
- func (s *Std) LookupGroup(name string) (*user.Group, error)
- func (s *Std) Open(name string) (fs.File, error)
- func (s *Std) Paths() Paths
- func (s *Std) ReadDir(name string) ([]os.DirEntry, error)
- func (s *Std) SdBooted() bool
- func (s *Std) Stat(name string) (fs.FileInfo, error)
- func (s *Std) Stdout() io.Writer
- func (s *Std) TempDir() string
- func (s *Std) Uid(aid int) (int, error)
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Paths ¶
type Paths struct {
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 ¶
type Std struct {
// contains filtered or unexported fields
}
Std implements System using the standard library.
func (*Std) Executable ¶
func (*Std) LookupGroup ¶ added in v0.2.0
type System ¶
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)
// LookupGroup provides [user.LookupGroup].
LookupGroup(name string) (*user.Group, 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)
// Stdout provides [os.Stdout].
Stdout() io.Writer
// Paths returns a populated [Paths] struct.
Paths() Paths
// Uid invokes fsu and returns target uid.
Uid(aid int) (int, error)
// SdBooted implements https://www.freedesktop.org/software/systemd/man/sd_booted.html
SdBooted() bool
}
System provides safe access to operating system resources.
Click to show internal directories.
Click to hide internal directories.