summaryrefslogtreecommitdiff
path: root/helper/darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'helper/darwin.go')
-rw-r--r--helper/darwin.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/helper/darwin.go b/helper/darwin.go
index 10bab31..99e0d46 100644
--- a/helper/darwin.go
+++ b/helper/darwin.go
@@ -27,6 +27,7 @@ To inspect the rules in the firewall manually, use the bitmask anchor:
package main
import (
+ "bytes"
"errors"
"fmt"
"log"
@@ -103,6 +104,15 @@ func firewallStop() error {
return exec.Command(pfctl, "-a", bitmask_anchor, "-F", "all").Run()
}
+func firewallIsUp() bool {
+ out, err := exec.Command(pfctl, "-a", bitmask_anchor, "-sr").Output()
+ if err != nil {
+ log.Printf("An error ocurred getting the status of the firewall: %v", err)
+ return false
+ }
+ return bytes.Contains(out, []byte("block out proto udp to any port 53"))
+}
+
func enablePf() {
cmd := exec.Command(pfctl, "-e")
cmd.Run()