config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAKeyName  = "ca-key.pem"
	CACertName = "ca-cert.pem"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowStringsArray

type AllowStringsArray []string

AllowStringsArray is a custom type that implements pflag.Value to support repeatable --allow flags without splitting on commas. This allows comma-separated paths within a single allow rule (e.g., "path=/todos/1,/todos/2").

func (*AllowStringsArray) Set

func (a *AllowStringsArray) Set(value string) error

Set implements pflag.Value. It appends the value to the slice without splitting on commas.

func (AllowStringsArray) String

func (a AllowStringsArray) String() string

String implements pflag.Value.

func (AllowStringsArray) Type

func (a AllowStringsArray) Type() string

Type implements pflag.Value.

func (AllowStringsArray) Value

func (a AllowStringsArray) Value() []string

Value returns the underlying slice of strings.

type AppConfig

type AppConfig struct {
	AllowRules         []string
	LogLevel           string
	LogDir             string
	ProxyPort          int64
	PprofEnabled       bool
	PprofPort          int64
	JailType           JailType
	UseRealDNS         bool
	NoUserNamespace    bool
	TargetCMD          []string
	UserInfo           *UserInfo
	DisableAuditLogs   bool
	LogProxySocketPath string
}

func NewAppConfigFromCliConfig

func NewAppConfigFromCliConfig(cfg CliConfig, targetCMD []string) (AppConfig, error)

type CliConfig

type CliConfig struct {
	Config             serpent.YAMLConfigPath `yaml:"-"`
	AllowListStrings   serpent.StringArray    `yaml:"allowlist"` // From config file
	AllowStrings       AllowStringsArray      `yaml:"-"`         // From CLI flags only
	LogLevel           serpent.String         `yaml:"log_level"`
	LogDir             serpent.String         `yaml:"log_dir"`
	ProxyPort          serpent.Int64          `yaml:"proxy_port"`
	PprofEnabled       serpent.Bool           `yaml:"pprof_enabled"`
	PprofPort          serpent.Int64          `yaml:"pprof_port"`
	JailType           serpent.String         `yaml:"jail_type"`
	UseRealDNS         serpent.Bool           `yaml:"use_real_dns"`
	NoUserNamespace    serpent.Bool           `yaml:"no_user_namespace"`
	DisableAuditLogs   serpent.Bool           `yaml:"disable_audit_logs"`
	LogProxySocketPath serpent.String         `yaml:"log_proxy_socket_path"`
}

type JailType

type JailType string

JailType represents the type of jail to use for network isolation

const (
	NSJailType   JailType = "nsjail"
	LandjailType JailType = "landjail"
)

func NewJailTypeFromString

func NewJailTypeFromString(str string) (JailType, error)

type UserInfo

type UserInfo struct {
	SudoUser  string
	Uid       int
	Gid       int
	HomeDir   string
	ConfigDir string
}

func GetUserInfo

func GetUserInfo() *UserInfo

GetUserInfo returns information about the current user, handling sudo scenarios

func (*UserInfo) CACertPath

func (u *UserInfo) CACertPath() string

func (*UserInfo) CAKeyPath

func (u *UserInfo) CAKeyPath() string

Jump to

Keyboard shortcuts

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