summaryrefslogtreecommitdiff
path: root/standalone/launcher.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-01-09 12:49:33 +0100
committerRuben Pollan <meskio@sindominio.net>2019-01-09 12:49:33 +0100
commitf274ec2beaf060cc8bfe4f5eb6f2ce3b5c6aa1f3 (patch)
tree198930362039654cc03b50703512ce1ca6819003 /standalone/launcher.go
parent9434d2534b0031c20de64ba03518aa7a150b265d (diff)
[feat] use firewall status to check if the vpn is in failed status
If openvpn is off, but the firewall is up, we are in a fail-close status and we should report it properly. - Resolves: #97
Diffstat (limited to 'standalone/launcher.go')
-rw-r--r--standalone/launcher.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/standalone/launcher.go b/standalone/launcher.go
index 03178c5..0a95dd1 100644
--- a/standalone/launcher.go
+++ b/standalone/launcher.go
@@ -68,6 +68,16 @@ func (l *launcher) firewallStop() error {
return l.send("/firewall/stop", nil)
}
+func (l *launcher) firewallIsUp() bool {
+ res, err := http.Post(helperAddr+"/firewall/isup", "", nil)
+ if err != nil {
+ return false
+ }
+ defer res.Body.Close()
+
+ return res.StatusCode == http.StatusOK
+}
+
func (l *launcher) send(path string, body []byte) error {
var reader io.Reader
if body != nil {