spn

package
v1.6.28 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const RestartExitCode = 23

RestartExitCode will instruct portmaster-start to restart the process immediately, potentially with a new version.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	CommandLineOperation func() error
	// contains filtered or unexported fields
}

Instance is an instance of a Portmaster service.

func New

func New() (*Instance, error)

New returns a new Portmaster service instance.

func (*Instance) API

func (i *Instance) API() *api.API

API returns the api module.

func (*Instance) Access

func (i *Instance) Access() *access.Access

Access returns the access module.

func (*Instance) AddModule

func (i *Instance) AddModule(m mgr.Module)

AddModule validates the given module and adds it to the service group, if all requirements are met. All modules must be added before anything is done with the instance.

func (*Instance) AddStatesCallback

func (i *Instance) AddStatesCallback(callbackName string, callback mgr.EventCallbackFunc[mgr.StateUpdate])

AddStatesCallback adds the given callback function to all group modules that expose a state manager at States().

func (*Instance) AddWorkerInfoToDebugInfo added in v1.6.22

func (i *Instance) AddWorkerInfoToDebugInfo(di *debug.Info)

AddWorkerInfoToDebugInfo adds the worker info of all running workers to the debug info.

func (*Instance) Base

func (i *Instance) Base() *base.Base

Base returns the base module.

func (*Instance) Cabin

func (i *Instance) Cabin() *cabin.Cabin

Cabin returns the cabin module.

func (*Instance) Captain

func (i *Instance) Captain() *captain.Captain

Captain returns the captain module.

func (*Instance) Config

func (i *Instance) Config() *config.Config

Config returns the config module.

func (*Instance) Core

func (i *Instance) Core() *core.Core

Core returns the core module.

func (*Instance) Crew

func (i *Instance) Crew() *crew.Crew

Crew returns the crew module.

func (*Instance) Ctx

func (i *Instance) Ctx() context.Context

Ctx returns the instance context. It is only canceled on shutdown.

func (*Instance) Database

func (i *Instance) Database() *dbmodule.DBModule

Database returns the database module.

func (*Instance) Docks

func (i *Instance) Docks() *docks.Docks

Docks returns the crew module.

func (*Instance) ExitCode

func (i *Instance) ExitCode() int

ExitCode returns the set exit code of the instance.

func (*Instance) FilterLists

func (i *Instance) FilterLists() *filterlists.FilterLists

FilterLists returns the filterLists module.

func (*Instance) GeoIP

func (i *Instance) GeoIP() *geoip.GeoIP

GeoIP returns the geoip module.

func (*Instance) GetEventSPNConnected

func (i *Instance) GetEventSPNConnected() *mgr.EventMgr[struct{}]

GetEventSPNConnected return the event manager for the SPN connected event.

func (*Instance) GetStates

func (i *Instance) GetStates() []mgr.StateUpdate

GetStates returns the current states of all group modules.

func (*Instance) GetWorkerInfo added in v1.6.22

func (i *Instance) GetWorkerInfo() (*mgr.WorkerInfo, error)

GetWorkerInfo returns the worker info of all running workers.

func (*Instance) Metrics

func (i *Instance) Metrics() *metrics.Metrics

Metrics returns the metrics module.

func (*Instance) Navigator

func (i *Instance) Navigator() *navigator.Navigator

Navigator returns the navigator module.

func (*Instance) NetEnv

func (i *Instance) NetEnv() *netenv.NetEnv

NetEnv returns the netenv module.

func (*Instance) Notifications

func (i *Instance) Notifications() *notifications.Notifications

Notifications returns nil.

func (*Instance) Patrol

func (i *Instance) Patrol() *patrol.Patrol

Patrol returns the patrol module.

func (*Instance) Ready

func (i *Instance) Ready() bool

Ready returns whether all modules in the main service module group have been started and are still running.

func (*Instance) Restart

func (i *Instance) Restart()

Restart asynchronously restarts the instance. This only works if the underlying system/process supports this.

func (*Instance) Rng

func (i *Instance) Rng() *rng.Rng

Rng returns the rng module.

func (*Instance) Runtime

func (i *Instance) Runtime() *runtime.Runtime

Runtime returns the runtime module.

func (*Instance) SPNGroup

func (i *Instance) SPNGroup() *mgr.ExtendedGroup

SPNGroup fakes interface conformance. SPNGroup is only needed on SPN clients.

func (*Instance) SetCmdLineOperation

func (i *Instance) SetCmdLineOperation(f func() error)

SetCmdLineOperation sets a command line operation to be executed instead of starting the system. This is useful when functions need all modules to be prepared for a special operation.

func (*Instance) SetSleep

func (i *Instance) SetSleep(enabled bool)

SetSleep sets sleep mode on all modules that satisfy the SleepyModule interface.

func (*Instance) Ships

func (i *Instance) Ships() *ships.Ships

Ships returns the ships module.

func (*Instance) Shutdown

func (i *Instance) Shutdown()

Shutdown asynchronously stops the instance.

func (*Instance) Sluice

func (i *Instance) Sluice() *sluice.SluiceModule

Sluice returns the ships module.

func (*Instance) Start

func (i *Instance) Start() error

Start starts the instance.

func (*Instance) Stop

func (i *Instance) Stop() error

Stop stops the instance and cancels the instance context when done.

func (*Instance) Stopped

func (i *Instance) Stopped() <-chan struct{}

Stopped returns a channel that is triggered when the instance has shut down.

func (*Instance) Stopping

func (i *Instance) Stopping() bool

Stopping returns whether the instance is shutting down.

func (*Instance) Terminal

func (i *Instance) Terminal() *terminal.TerminalModule

Terminal returns the terminal module.

func (*Instance) Updates

func (i *Instance) Updates() *updates.Updates

Updates returns the updates module.

type SleepyModule

type SleepyModule interface {
	SetSleep(enabled bool)
}

SleepyModule is an interface for modules that can enter some sort of sleep mode.

Directories

Path Synopsis
Package unit provides a "work unit" scheduling system for handling data sets that traverse multiple workers / goroutines.
Package unit provides a "work unit" scheduling system for handling data sets that traverse multiple workers / goroutines.

Jump to

Keyboard shortcuts

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