From f274ec2beaf060cc8bfe4f5eb6f2ce3b5c6aa1f3 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Wed, 9 Jan 2019 12:49:33 +0100 Subject: [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 --- standalone/launcher.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'standalone/launcher.go') 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 { -- cgit v1.2.3