Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppCallback ¶
type AppCallback interface {
Hostname() string
LanIp() string
MacAddress() string
Exit(error string)
}
AppCallback provides access to app instance.
type Controller ¶
type Controller struct {
AppCallback AppCallback
Config cli.AppConfig
// contains filtered or unexported fields
}
Controller holds global state. Start, Stop and IsRunning are safe for concurrent use. AppCallback and Config must not be accessed concurrently.
func NewController ¶
func NewController(appCallback AppCallback) *Controller
NewController provides reference to global state to be managed by android vpn service and iOS network extension.
func (*Controller) IsRunning ¶
func (c *Controller) IsRunning() bool
IsRunning remains true until the run has finished releasing its resources.
func (*Controller) Start ¶
func (c *Controller) Start(CdUID string, ProvisionID string, CustomHostname string, HomeDir string, UpstreamProto string, logLevel int, logPath string)
Start configures utility with config.toml from provided directory. This function blocks until the run exits, including teardown after Stop. A call made while a run is active or stopping returns immediately. Check port availability prior to calling it.
func (*Controller) Stop ¶
func (c *Controller) Stop(restart bool, pin int64) int
Stop requests shutdown after validating pin, unless restart bypasses the check. A zero result means the stop request was accepted, not that teardown finished. After cancellation it waits up to 15 seconds. Callers must check IsRunning after Stop: while it remains true, teardown still owns the session and Start will be rejected. PIN failure codes are returned unchanged.