Enable building on unsupported systems
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
//+build !windows,!linux
|
||||||
|
|
||||||
package netenv
|
package netenv
|
||||||
|
|
||||||
import "net"
|
import "net"
|
||||||
43
network/state/system_default.go
Normal file
43
network/state/system_default.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// +build !windows,!linux
|
||||||
|
|
||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/safing/portbase/config"
|
||||||
|
"github.com/safing/portmaster/network/socket"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// This increases performance on unsupported system.
|
||||||
|
// It's not critical at all and does not break anything if it fails.
|
||||||
|
go func() {
|
||||||
|
// Wait for one minute before we set the default value, as we
|
||||||
|
// currently cannot easily integrate into the startup procedure.
|
||||||
|
time.Sleep(1 * time.Minute)
|
||||||
|
|
||||||
|
// We cannot use process.CfgOptionEnableProcessDetectionKey, because of an import loop.
|
||||||
|
config.SetDefaultConfigOption("core/enableProcessDetection", false)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTCP4Table() (connections []*socket.ConnectionInfo, listeners []*socket.BindInfo, err error) {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getTCP6Table() (connections []*socket.ConnectionInfo, listeners []*socket.BindInfo, err error) {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getUDP4Table() (binds []*socket.BindInfo, err error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getUDP6Table() (binds []*socket.BindInfo, err error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkPID(socketInfo socket.Info, connInbound bool) (pid int, inbound bool, err error) {
|
||||||
|
return socketInfo.GetPID(), connInbound, nil
|
||||||
|
}
|
||||||
28
process/process_default.go
Normal file
28
process/process_default.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
//+build !windows,!linux
|
||||||
|
|
||||||
|
package process
|
||||||
|
|
||||||
|
// IsUser returns whether the process is run by a normal user.
|
||||||
|
func (p *Process) IsUser() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsAdmin returns whether the process is run by an admin user.
|
||||||
|
func (p *Process) IsAdmin() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSystem returns whether the process is run by the operating system.
|
||||||
|
func (p *Process) IsSystem() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsKernel returns whether the process is the Kernel.
|
||||||
|
func (p *Process) IsKernel() bool {
|
||||||
|
return p.Pid == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// specialOSInit does special OS specific Process initialization.
|
||||||
|
func (p *Process) specialOSInit() {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ func (p *Process) IsUser() bool {
|
|||||||
|
|
||||||
// IsAdmin returns whether the process is run by an admin user.
|
// IsAdmin returns whether the process is run by an admin user.
|
||||||
func (p *Process) IsAdmin() bool {
|
func (p *Process) IsAdmin() bool {
|
||||||
return p.UserID >= 0
|
return p.UserID >= 0 && p.UserID < 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSystem returns whether the process is run by the operating system.
|
// IsSystem returns whether the process is run by the operating system.
|
||||||
|
|||||||
Reference in New Issue
Block a user