summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/backend')
-rw-r--r--pkg/backend/actions.go8
-rw-r--r--pkg/backend/api.go4
-rw-r--r--pkg/backend/webapi.go3
3 files changed, 3 insertions, 12 deletions
diff --git a/pkg/backend/actions.go b/pkg/backend/actions.go
index 6e143f9..1860b09 100644
--- a/pkg/backend/actions.go
+++ b/pkg/backend/actions.go
@@ -20,14 +20,6 @@ func stopVPN() {
}
}
-// TODO return bool?
-func useGateway(label string) {
- err := ctx.bm.UseGateway(label)
- if err != nil {
- log.Println(err)
- }
-}
-
func getGateway() string {
return ctx.bm.GetCurrentGateway()
}
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index 761c03d..f1fed57 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -57,8 +57,8 @@ func SwitchOff() {
// TODO implement Reconnect - do not tear whole fw down in between
-func UseGateway(label string) {
- ctx.bm.UseGateway(string(label))
+func UseLocation(label string) {
+ ctx.bm.UseGateway(label)
time.Sleep(200 * time.Millisecond)
SwitchOff()
time.Sleep(500 * time.Millisecond)
diff --git a/pkg/backend/webapi.go b/pkg/backend/webapi.go
index 3e4efd3..903112e 100644
--- a/pkg/backend/webapi.go
+++ b/pkg/backend/webapi.go
@@ -51,8 +51,7 @@ func webGatewaySet(w http.ResponseWriter, r *http.Request) {
}
gwLabel := r.FormValue("gw")
fmt.Fprintf(w, "selected gateway: %s\n", gwLabel)
- // FIXME catch error here, return it (error code)
- useGateway(gwLabel)
+ ctx.bm.UseGateway(gwLabel)
// TODO make sure we don't tear the fw down on reconnect...
SwitchOff()
// a little sleep is needed, though, because iptables takes some time