This commit is contained in:
Daniel
2024-11-27 16:16:15 +01:00
parent f91003d077
commit 706ce222d0
35 changed files with 1138 additions and 601 deletions

View File

@@ -6,6 +6,8 @@ import (
"fmt"
"sync/atomic"
"github.com/safing/portmaster/base/config"
"github.com/safing/portmaster/base/database"
"github.com/safing/portmaster/base/log"
"github.com/safing/portmaster/base/metrics"
"github.com/safing/portmaster/base/utils/debug"
@@ -19,6 +21,11 @@ import (
"github.com/safing/portmaster/service/updates"
)
var db = database.NewInterface(&database.Options{
Local: true,
Internal: true,
})
// Core is the core service module.
type Core struct {
m *mgr.Manager
@@ -56,8 +63,10 @@ func init() {
func prep() error {
// init config
err := registerConfig()
if err != nil {
if err := registerConfig(); err != nil {
return err
}
if err := registerUpdateConfig(); err != nil {
return err
}
@@ -77,6 +86,10 @@ func start() error {
return fmt.Errorf("failed to start plattform-specific components: %w", err)
}
// Setup update system.
initUpdateConfig()
initVersionExport()
// Enable persistent metrics.
if err := metrics.EnableMetricPersistence("core:metrics/storage"); err != nil {
log.Warningf("core: failed to enable persisted metrics: %s", err)
@@ -116,6 +129,7 @@ type instance interface {
Shutdown()
Restart()
AddWorkerInfoToDebugInfo(di *debug.Info)
Config() *config.Config
BinaryUpdates() *updates.Updater
IntelUpdates() *updates.Updater
}