summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-06-12 19:09:21 +0200
committerRuben Pollan <meskio@sindominio.net>2018-06-12 20:34:46 +0200
commit5687154a9581325d5a9382a592e793218dba1a74 (patch)
tree8543498d72bdbe6a5ecac00b50baebd4250288e9
parenta154c2b3b12a1eb61580729fd7d66025b5b4ebf6 (diff)
[bug] check for errors on vpn check
- Resolves: #44
-rw-r--r--bitmask/vpn.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/bitmask/vpn.go b/bitmask/vpn.go
index efc6d18..aee5e8f 100644
--- a/bitmask/vpn.go
+++ b/bitmask/vpn.go
@@ -17,6 +17,7 @@ package bitmask
import (
"errors"
+ "log"
)
// StartVPN for provider
@@ -52,7 +53,17 @@ func (b *Bitmask) VPNCheck() (helpers bool, priviledge bool, err error) {
if err != nil {
return false, false, err
}
- return res["installed"].(bool), res["privcheck"].(bool), nil
+ installed, ok := res["installed"].(bool)
+ if !ok {
+ log.Printf("Unexpected value for installed on 'vpn check': %v", res)
+ return false, false, errors.New("Invalid response format")
+ }
+ privcheck, ok := res["privcheck"].(bool)
+ if !ok {
+ log.Printf("Unexpected value for privcheck on 'vpn check': %v", res)
+ return installed, false, errors.New("Invalid response format")
+ }
+ return installed, privcheck, nil
}
// ListGateways return the names of the gateways