Merge pull request #1193 from safing/fix/things-for-0-14

Minor improvements and fixes for v1.0.14
This commit is contained in:
Daniel Hovie 2023-05-08 14:43:42 +02:00 committed by GitHub
commit 40ef960ccc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 16 deletions

View file

@ -50,7 +50,7 @@ function build {
fi
# build
./build main.go
./build
if [[ $? -ne 0 ]]; then
echo -e "\n${COL_BOLD}[core] $platform v$version: ${COL_RED}BUILD FAILED.${COL_OFF}"
exit 1

View file

@ -39,13 +39,13 @@ var (
systemIntegrationIssue = &systemIssue{
id: "compat:system-integration-issue",
title: "Detected System Integration Issue",
message: "Portmaster detected a problem with its system integration. You can try to restart or reinstall the Portmaster. If that does not help, please report the issue via [GitHub](https://github.com/safing/portmaster/issues) or send a mail to [support@safing.io](mailto:support@safing.io) so we can help you out.",
message: "Portmaster detected a problem with its system integration. You can try to restart or reinstall the Portmaster. If that does not help, [get support here](https://safing.io/support/).",
level: notifications.Error,
}
systemCompatibilityIssue = &systemIssue{
id: "compat:compatibility-issue",
title: "Detected Compatibility Issue",
message: "Portmaster detected that something is interfering with its operation. This could be a VPN, an Anti-Virus or another network protection software. Please check if you are running an incompatible [VPN client](https://docs.safing.io/portmaster/install/status/vpn-compatibility) or [software](https://docs.safing.io/portmaster/install/status/software-compatibility). Otherwise, please report the issue via [GitHub](https://github.com/safing/portmaster/issues) or send a mail to [support@safing.io](mailto:support@safing.io) so we can help you out.",
message: "Portmaster detected that something is interfering with its operation. This could be a VPN, an Anti-Virus or another network protection software. Please check if you are running an incompatible [VPN client](https://docs.safing.io/portmaster/install/status/vpn-compatibility) or [software](https://docs.safing.io/portmaster/install/status/software-compatibility) and disable it. If that does not help, [get support here](https://safing.io/support/).",
level: notifications.Error,
}
// manualDNSSetupRequired is additionally initialized in startNotify().

View file

@ -28,11 +28,6 @@ var (
ErrPIDNotFound = errors.New("could not find pid for socket inode")
)
var (
lookupTries = 20 // With a max wait of 5ms, this amounts to up to 100ms.
fastLookupTries = 2
)
// Lookup looks for the given connection in the system state tables and returns the PID of the associated process and whether the connection is inbound.
func Lookup(pktInfo *packet.Info, fast bool) (pid int, inbound bool, err error) {
// auto-detect version

View file

@ -10,6 +10,11 @@ import (
"github.com/safing/portmaster/network/socket"
)
var (
lookupTries = 20 // With a max wait of 5ms, this amounts to up to 100ms.
fastLookupTries = 2
)
func init() {
// This increases performance on unsupported system.
// It's not critical at all and does not break anything if it fails.

View file

@ -12,9 +12,12 @@ var (
getTCP6Table = proc.GetTCP6Table
getUDP4Table = proc.GetUDP4Table
getUDP6Table = proc.GetUDP6Table
)
var baseWaitTime = 3 * time.Millisecond
lookupTries = 20 // With a max wait of 5ms, this amounts to up to 100ms.
fastLookupTries = 2
baseWaitTime = 3 * time.Millisecond
)
// CheckPID checks the if socket info already has a PID and if not, tries to find it.
// Depending on the OS, this might be a no-op.

View file

@ -10,6 +10,13 @@ var (
getTCP6Table = iphelper.GetTCP6Table
getUDP4Table = iphelper.GetUDP4Table
getUDP6Table = iphelper.GetUDP6Table
// With a max wait of 5ms, this amounts to up to 25ms,
// excluding potential data fetching time.
// Measured on Windows: ~150ms
lookupTries = 5
fastLookupTries = 2
)
// CheckPID checks the if socket info already has a PID and if not, tries to find it.

View file

@ -31,13 +31,15 @@ func reportRequestDuration(started time.Time, resolver *Resolver) {
// getSlowQueriesSensorValue returns the current avg query time recorded by the
// slow queries sensor.
func getSlowQueriesSensorValue() (avgQueryTime time.Duration) {
return time.Duration(
slowQueriesSensorSum.Load() / slowQueriesSensorCnt.Load(),
)
}
// Get values and check them.
sum := slowQueriesSensorSum.Load()
cnt := slowQueriesSensorCnt.Load()
if cnt < 1 {
cnt = 1
}
// getAndResetSlowQueriesSensorValue returns the current avg query time
// recorded by the slow queries sensor and reset the sensor values.
return time.Duration(sum / cnt)
}
// resetSlowQueriesSensorValue reset the slow queries sensor values.
func resetSlowQueriesSensorValue() {

25
test
View file

@ -131,6 +131,29 @@ if [[ $testonly -eq 0 ]]; then
fi
fi
# build portmaster-core for for all supported platforms
echo "building portmaster-core for all platforms"
cd ./cmds/portmaster-core
run env GOOS=linux GOARCH=amd64 ./build
run env GOOS=windows GOARCH=amd64 ./build
run env GOOS=darwin GOARCH=amd64 ./build
run env GOOS=linux GOARCH=arm64 ./build
run env GOOS=windows GOARCH=arm64 ./build
run env GOOS=darwin GOARCH=arm64 ./build
cd "$baseDir"
# build portmaster-start for for all supported platforms
echo ""
echo "building portmaster-start for all platforms"
cd ./cmds/portmaster-start
run env GOOS=linux GOARCH=amd64 ./build
# run env GOOS=windows GOARCH=amd64 ./build # TODO: Fix for GitHub CI
run env GOOS=darwin GOARCH=amd64 ./build
run env GOOS=linux GOARCH=arm64 ./build
# run env GOOS=windows GOARCH=arm64 ./build # TODO: Fix for GitHub CI
run env GOOS=darwin GOARCH=arm64 ./build
cd "$baseDir"
# target selection
if [[ "$1" == "" ]]; then
# get all packages
@ -138,10 +161,12 @@ if [[ "$1" == "" ]]; then
else
# single package testing
packages=$(go list -e)/$1
echo ""
echo "note: only running tests for package $packages"
fi
# platform info
echo ""
platformInfo=$(go env GOOS GOARCH)
echo "running tests for ${platformInfo//$'\n'/ }:"