Documentation
¶
Index ¶
- func AbsoluteDataRoot() (string, error)
- func AbsoluteInstallRoot() (string, error)
- func AbsoluteInstalledBinaryPath() (string, error)
- func ChannelDataRoot() (string, error)
- func ChannelPath() (string, error)
- func DefaultDataRoot() string
- func InstallRoot() string
- func InstalledBinaryName() string
- func InstalledBinaryPath() string
- func OpenBrowser(url string) error
- func OwnChannelWrite(path string, newParent bool) error
- func Relaunch(binary string, args, env []string) error
- func StageInstalledBinary(source string) (string, error)
- type Paths
- type TCPOccupant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsoluteDataRoot ¶
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 ¶
AbsoluteInstallRoot returns InstallRoot as a cleaned absolute path.
func AbsoluteInstalledBinaryPath ¶
AbsoluteInstalledBinaryPath returns the absolute path of the installed binary.
func ChannelDataRoot ¶ added in v0.9.0
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
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 ¶
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
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
Relaunch replaces the current process with the updated Mihari binary.
func StageInstalledBinary ¶
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 (Paths) EnsureDirs ¶
EnsureDirs creates the durable directories under this layout.
type TCPOccupant ¶ added in v0.7.3
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.