Files
portmaster/status/module.go
Patrick Pacher a5e3f7ff37 Refactor status package to use portbase/runtime.
Refactor the status package to use portbase/runtime and
make system status readonly. Also adapts the code base
to the new portbase/notifications package.
2020-09-21 17:19:07 +02:00

37 lines
581 B
Go

package status
import (
"context"
"github.com/safing/portbase/modules"
"github.com/safing/portmaster/netenv"
)
var (
module *modules.Module
)
func init() {
module = modules.Register("status", nil, start, nil, "base")
}
func start() error {
module.StartWorker("auto-pilot", autoPilot)
triggerAutopilot()
err := module.RegisterEventHook(
"netenv",
netenv.OnlineStatusChangedEvent,
"update online status in system status",
func(_ context.Context, _ interface{}) error {
triggerAutopilot()
return nil
},
)
if err != nil {
return err
}
return nil
}