Improve user agents

This commit is contained in:
Daniel
2023-04-13 16:28:43 +02:00
parent 64d1e165bb
commit 72c59c0e52
3 changed files with 12 additions and 3 deletions

View File

@@ -2,12 +2,15 @@
package main
import (
"fmt"
"os"
"runtime"
"github.com/safing/portbase/info"
"github.com/safing/portbase/log"
"github.com/safing/portbase/metrics"
"github.com/safing/portbase/run"
"github.com/safing/portmaster/updates"
"github.com/safing/spn/conf"
// Include packages here.
@@ -29,6 +32,9 @@ func main() {
// Configure metrics.
_ = metrics.SetNamespace("portmaster")
// Configure user agent.
updates.UserAgent = fmt.Sprintf("Portmaster Core (%s %s)", runtime.GOOS, runtime.GOARCH)
// enable SPN client mode
conf.EnableClient(true)

View File

@@ -8,6 +8,7 @@ import (
"os"
"os/signal"
"path/filepath"
"runtime"
"strings"
"syscall"
@@ -34,6 +35,7 @@ var (
UpdateURLs: []string{
"https://updates.safing.io",
},
UserAgent: fmt.Sprintf("Portmaster Start (%s %s)", runtime.GOOS, runtime.GOARCH),
Verification: helper.VerificationConfig,
DevMode: false,
Online: true, // is disabled later based on command

View File

@@ -57,9 +57,10 @@ var (
// UserAgent is an HTTP User-Agent that is used to add
// more context to requests made by the registry when
// fetching resources from the update server.
UserAgent = "Core"
UserAgent = fmt.Sprintf("Portmaster (%s %s)", runtime.GOOS, runtime.GOARCH)
// Explicitly disables automatic software updates. Used in android.
// DisableSoftwareAutoUpdate specifies whether software updates should be disabled.
// This is used on Android, as it will never require binary updates.
DisableSoftwareAutoUpdate = false
)
@@ -250,7 +251,7 @@ func checkForUpdates(ctx context.Context) (err error) {
}
defer func() {
// Resolve any error and and send success notification.
// Resolve any error and send success notification.
if err == nil {
log.Infof("updates: successfully checked for updates")
notifyUpdateSuccess(forcedUpdate)