Documentation
¶
Overview ¶
Package service installs and controls Mihari as a native OS service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInteractive ¶
func IsInteractive() bool
IsInteractive reports whether this process is running outside the OS service manager. When false (Windows service session), the daemon entrypoint must call Manager.Run so the process registers with SCM (StartServiceCtrlDispatcher).
Types ¶
type Controller ¶
type Controller interface {
Install() error
Uninstall() error
Start() error
Stop() error
Restart() error
Status() (StatusKind, error)
Run() error
}
Controller performs service manager operations (tests inject fakes).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the production entry for service control.
func (*Manager) Install ¶
Install copies mihari into the machine install directory, then registers the OS service with that installed path (never the caller's download location).
func (*Manager) Reinstall ¶
Reinstall stops the service, removes registration, copies this binary into the install directory, re-registers ImagePath, and starts the service.
func (*Manager) Status ¶
func (m *Manager) Status() (StatusKind, error)
Status reports the service state. When the service is not registered, it returns StatusNotInstalled with a nil error so callers (CLI status, TUI badge) can distinguish "not installed" without elevation. On Windows, Access is denied from the default service library falls back to a low-privilege SCM query so non-admin users still see running/stopped/not_installed.
type Options ¶
type Options struct {
// Executable is the absolute path to mihari. Empty uses the current process executable.
Executable string
// Arguments defaults to ["daemon"].
Arguments []string
// Run is required only for Run().
Run RunFunc
// NewController builds a Controller; tests replace it.
NewController func(run RunFunc, executable string, arguments []string) (Controller, error)
}
Options configures which binary the OS service should launch.
type StatusKind ¶
type StatusKind string
StatusKind is a redacted service state for CLI/JSON.
const ( StatusRunning StatusKind = "running" StatusStopped StatusKind = "stopped" StatusUnknown StatusKind = "unknown" StatusNotInstalled StatusKind = "not_installed" )