Skip to content
Snippets Groups Projects
Commit 4e1f3a4f authored by meskio's avatar meskio :tent: Committed by Kali Kaneko
Browse files

Let's rename the API to use location instead of gateway

parent b14d048e
Branches
Tags
No related merge requests found
......@@ -30,9 +30,9 @@ func SwitchOff() {
backend.SwitchOff()
}
//export UseGateway
func UseGateway(label string) {
backend.UseGateway(label)
//export UseLocation
func UseLocation(label string) {
backend.UseLocation(label)
}
//export UseTransport
......
......@@ -42,9 +42,9 @@ void Backend::donateSeen()
DonateSeen();
}
void Backend::useGateway(QString label)
void Backend::useLocation(QString label)
{
UseGateway(toGoStr(label));
UseLocation(toGoStr(label));
}
void Backend::login(QString username, QString password)
......
......@@ -36,7 +36,7 @@ public slots:
void switchOff();
void donateAccepted();
void donateSeen();
void useGateway(QString username);
void useLocation(QString username);
void login(QString username, QString password);
void resetError(QString errlabel);
void resetNotification(QString label);
......
......@@ -163,7 +163,7 @@ Window {
model: [qsTr("Automatic")]
onActivated: {
console.debug("Selected gateway:", currentText)
backend.useGateway(currentText.toString())
backend.useLocation(currentText.toString())
}
}
} // end column
......
......@@ -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()
}
......
......@@ -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)
......
......@@ -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
......
......@@ -27,7 +27,7 @@ type Bitmask interface {
InstallHelpers() error
VPNCheck() (helpers bool, priviledge bool, err error)
ListLocationFullness(protocol string) map[string]float64
UseGateway(name string) error
UseGateway(name string)
GetCurrentGateway() string
GetCurrentLocation() string
UseTransport(transport string) error
......
......@@ -235,9 +235,8 @@ func (b *Bitmask) ListLocationFullness(transport string) map[string]float64 {
}
// UseGateway selects a gateway, by label, as the default gateway
func (b *Bitmask) UseGateway(label string) error {
func (b *Bitmask) UseGateway(label string) {
b.bonafide.SetManualGateway(label)
return nil
}
// UseTransport selects an obfuscation transport to use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment