mirror of
https://github.com/safing/portmaster
synced 2025-09-04 11:39:29 +00:00
Improve logging and fix linter errors
This commit is contained in:
parent
a33526a976
commit
3e8c330775
4 changed files with 9 additions and 8 deletions
|
@ -2,6 +2,7 @@ package network
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -338,7 +339,7 @@ func NewConnectionFromDNSRequest(ctx context.Context, fqdn string, cnames []stri
|
||||||
if localProfile := proc.Profile().LocalProfile(); localProfile != nil {
|
if localProfile := proc.Profile().LocalProfile(); localProfile != nil {
|
||||||
dnsConn.Internal = localProfile.Internal
|
dnsConn.Internal = localProfile.Internal
|
||||||
|
|
||||||
if err := dnsConn.updateFeatures(); err != nil {
|
if err := dnsConn.updateFeatures(); err != nil && !errors.Is(err, access.ErrNotLoggedIn) {
|
||||||
log.Tracer(ctx).Warningf("network: failed to check for enabled features: %s", err)
|
log.Tracer(ctx).Warningf("network: failed to check for enabled features: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +381,7 @@ func NewConnectionFromExternalDNSRequest(ctx context.Context, fqdn string, cname
|
||||||
if localProfile := remoteHost.Profile().LocalProfile(); localProfile != nil {
|
if localProfile := remoteHost.Profile().LocalProfile(); localProfile != nil {
|
||||||
dnsConn.Internal = localProfile.Internal
|
dnsConn.Internal = localProfile.Internal
|
||||||
|
|
||||||
if err := dnsConn.updateFeatures(); err != nil {
|
if err := dnsConn.updateFeatures(); err != nil && !errors.Is(err, access.ErrNotLoggedIn) {
|
||||||
log.Tracer(ctx).Warningf("network: failed to check for enabled features: %s", err)
|
log.Tracer(ctx).Warningf("network: failed to check for enabled features: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,7 +449,7 @@ func (conn *Connection) GatherConnectionInfo(pkt packet.Packet) (err error) {
|
||||||
if localProfile := conn.process.Profile().LocalProfile(); localProfile != nil {
|
if localProfile := conn.process.Profile().LocalProfile(); localProfile != nil {
|
||||||
conn.Internal = localProfile.Internal
|
conn.Internal = localProfile.Internal
|
||||||
|
|
||||||
if err := conn.updateFeatures(); err != nil {
|
if err := conn.updateFeatures(); err != nil && !errors.Is(err, access.ErrNotLoggedIn) {
|
||||||
log.Tracer(pkt.Ctx()).Warningf("network: failed to check for enabled features: %s", err)
|
log.Tracer(pkt.Ctx()).Warningf("network: failed to check for enabled features: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func EnsureChromeSandboxPermissions(reg *updater.ResourceRegistry) error {
|
||||||
|
|
||||||
return fmt.Errorf("failed to chmod: %w", err)
|
return fmt.Errorf("failed to chmod: %w", err)
|
||||||
}
|
}
|
||||||
log.Infof("updates: fixed SUID permission for chrome-sandbox")
|
log.Debugf("updates: fixed SUID permission for chrome-sandbox")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func MandatoryUpdates() (identifiers []string) {
|
||||||
|
|
||||||
// Stop here if we only want intel data.
|
// Stop here if we only want intel data.
|
||||||
if intelOnly.IsSet() {
|
if intelOnly.IsSet() {
|
||||||
return
|
return identifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binaries
|
// Binaries
|
||||||
|
|
|
@ -284,13 +284,13 @@ func checkForUpdates(ctx context.Context) (err error) {
|
||||||
|
|
||||||
if err = registry.UpdateIndexes(ctx); err != nil {
|
if err = registry.UpdateIndexes(ctx); err != nil {
|
||||||
err = fmt.Errorf("failed to update indexes: %w", err)
|
err = fmt.Errorf("failed to update indexes: %w", err)
|
||||||
return
|
return //nolint:nakedret // TODO: Would "return err" work with the defer?
|
||||||
}
|
}
|
||||||
|
|
||||||
err = registry.DownloadUpdates(ctx, !forcedUpdate)
|
err = registry.DownloadUpdates(ctx, !forcedUpdate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("failed to download updates: %w", err)
|
err = fmt.Errorf("failed to download updates: %w", err)
|
||||||
return
|
return //nolint:nakedret // TODO: Would "return err" work with the defer?
|
||||||
}
|
}
|
||||||
|
|
||||||
registry.SelectVersions()
|
registry.SelectVersions()
|
||||||
|
@ -299,7 +299,7 @@ func checkForUpdates(ctx context.Context) (err error) {
|
||||||
err = registry.UnpackResources()
|
err = registry.UnpackResources()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("failed to unpack updates: %w", err)
|
err = fmt.Errorf("failed to unpack updates: %w", err)
|
||||||
return
|
return //nolint:nakedret // TODO: Would "return err" work with the defer?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge old resources
|
// Purge old resources
|
||||||
|
|
Loading…
Add table
Reference in a new issue