mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Add flag to disable packet interception
This commit is contained in:
parent
96b21156e2
commit
0a68b81005
3 changed files with 46 additions and 18 deletions
38
firewall/interception/interception.go
Normal file
38
firewall/interception/interception.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package interception
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/safing/portbase/log"
|
||||
"github.com/safing/portmaster/network/packet"
|
||||
)
|
||||
|
||||
var (
|
||||
// Packets channel for feeding the firewall.
|
||||
Packets = make(chan packet.Packet, 1000)
|
||||
|
||||
disableInterception bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.BoolVar(&disableInterception, "disable-interception", false, "disable packet interception - this breaks a lot of functionality")
|
||||
}
|
||||
|
||||
// Start starts the interception.
|
||||
func Start() error {
|
||||
if disableInterception {
|
||||
log.Warning("interception: packet interception is disabled via flag - this breaks a lot of functionality")
|
||||
return nil
|
||||
}
|
||||
|
||||
return start()
|
||||
}
|
||||
|
||||
// Stop starts the interception.
|
||||
func Stop() error {
|
||||
if disableInterception {
|
||||
return nil
|
||||
}
|
||||
|
||||
return stop()
|
||||
}
|
|
@ -1,16 +1,11 @@
|
|||
package interception
|
||||
|
||||
import "github.com/safing/portmaster/network/packet"
|
||||
|
||||
// Packets channel for feeding the firewall.
|
||||
var Packets = make(chan packet.Packet, 1000)
|
||||
|
||||
// Start starts the interception.
|
||||
func Start() error {
|
||||
// start starts the interception.
|
||||
func start() error {
|
||||
return StartNfqueueInterception()
|
||||
}
|
||||
|
||||
// Stop starts the interception.
|
||||
func Stop() error {
|
||||
// stop starts the interception.
|
||||
func stop() error {
|
||||
return StopNfqueueInterception()
|
||||
}
|
||||
|
|
|
@ -7,16 +7,11 @@ import (
|
|||
"github.com/safing/portbase/notifications"
|
||||
"github.com/safing/portbase/utils/osdetail"
|
||||
"github.com/safing/portmaster/firewall/interception/windowskext"
|
||||
"github.com/safing/portmaster/network/packet"
|
||||
"github.com/safing/portmaster/updates"
|
||||
)
|
||||
|
||||
// Packets channel for feeding the firewall.
|
||||
var Packets = make(chan packet.Packet, 1000)
|
||||
|
||||
// Start starts the interception.
|
||||
func Start() error {
|
||||
|
||||
// start starts the interception.
|
||||
func start() error {
|
||||
dllFile, err := updates.GetPlatformFile("kext/portmaster-kext.dll")
|
||||
if err != nil {
|
||||
return fmt.Errorf("interception: could not get kext dll: %s", err)
|
||||
|
@ -42,8 +37,8 @@ func Start() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Stop starts the interception.
|
||||
func Stop() error {
|
||||
// stop starts the interception.
|
||||
func stop() error {
|
||||
return windowskext.Stop()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue