platform

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteDataRoot

func AbsoluteDataRoot() (string, error)

AbsoluteDataRoot returns DefaultDataRoot as a cleaned absolute path. Used when installing the OS service so LocalSystem/root inherits a fixed path instead of resolving systemprofile or /root home.

func AbsoluteInstallRoot

func AbsoluteInstallRoot() (string, error)

AbsoluteInstallRoot returns InstallRoot as a cleaned absolute path.

func AbsoluteInstalledBinaryPath

func AbsoluteInstalledBinaryPath() (string, error)

AbsoluteInstalledBinaryPath returns the absolute path of the installed binary.

func ChannelDataRoot added in v0.9.0

func ChannelDataRoot() (string, error)

ChannelDataRoot returns the data root used only for Mihari channel I/O. MIHARI_DATA wins. Unlike DefaultDataRoot, Unix elevated processes honor SUDO_USER.

func ChannelPath added in v0.9.0

func ChannelPath() (string, error)

ChannelPath returns the sidecar path for the Mihari release channel.

func DefaultDataRoot

func DefaultDataRoot() string

DefaultDataRoot returns MIHARI_DATA when set, otherwise the platform default data root under the current user's home directory ($HOME/.mihari / %USERPROFILE%\.mihari).

func InstallRoot

func InstallRoot() string

InstallRoot returns the machine-local directory that holds the OS-managed mihari binary (separate from the data root and from any download location). Override with MIHARI_INSTALL_ROOT (absolute preferred; relative is Abs'd by callers).

func InstalledBinaryName

func InstalledBinaryName() string

InstalledBinaryName is mihari.exe on Windows and mihari elsewhere.

func InstalledBinaryPath

func InstalledBinaryPath() string

InstalledBinaryPath is InstallRoot()/InstalledBinaryName().

func OpenBrowser

func OpenBrowser(url string) error

OpenBrowser launches the OS default browser for a local URL. Callers must not log the URL when it may contain one-shot access tokens.

func OwnChannelWrite added in v0.9.0

func OwnChannelWrite(path string, newParent bool) error

OwnChannelWrite chowns the sidecar to the SUDO_USER owner when Unix euid is 0. newParent chowns the immediate data-root directory only when this write created it. It is a no-op on Windows.

func Relaunch added in v0.4.0

func Relaunch(binary string, args, env []string) error

Relaunch replaces the current process with the updated Mihari binary.

func StageInstalledBinary

func StageInstalledBinary(source string) (string, error)

StageInstalledBinary copies source into the install directory and returns the absolute installed path. The OS service ImagePath must always use this path, never a download folder or developer workspace path.

If source already resolves to the install path, no copy is performed.

Types

type Paths

type Paths struct {
	Root                string
	ControlToken        string
	Bin                 string
	CoreBinary          string
	RuntimeConfig       string
	Settings            string
	Onboarding          string
	Log                 string
	Staging             string
	Subscriptions       string
	SubscriptionCatalog string
	SubscriptionCache   string
	SubscriptionStaging string
	TUIPreferences      string
	GeoIPCountry        string
	GeoIPASN            string
	GeoIPStaging        string
	WebRoot             string
	WebActive           string
	WebCredential       string
	PanelStaging        string
}

Paths is the on-disk layout under a single data root (default: $HOME/.mihari).

func DefaultPaths

func DefaultPaths() Paths

DefaultPaths returns the layout under DefaultDataRoot.

func NewPaths

func NewPaths(root string) Paths

NewPaths builds the standard layout under root.

func (Paths) EnsureDirs

func (p Paths) EnsureDirs() error

EnsureDirs creates the durable directories under this layout.

type TCPOccupant added in v0.7.3

type TCPOccupant struct {
	PID     int
	Process string
}

TCPOccupant is the process holding a local TCP listen address.

func LookupTCPOccupant added in v0.7.3

func LookupTCPOccupant(address string) (TCPOccupant, bool)

LookupTCPOccupant reports the process listening on address (host:port). Lookup failures return ok=false.

Jump to

Keyboard shortcuts

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