diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-09-02 21:38:13 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-05-04 14:58:39 +0200 |
commit | 335bb742b957370bbf40ae77a661559805ab307f (patch) | |
tree | 3d8b9a8023b1bcca2b531bf57b1fd846916f4a8e /pkg/vpn/openvpn.go | |
parent | 68f566cf7fddbe9e5eb08c4c07a76375148b682b (diff) |
[feat] expose gateway selection in webapi
Diffstat (limited to 'pkg/vpn/openvpn.go')
-rw-r--r-- | pkg/vpn/openvpn.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/vpn/openvpn.go b/pkg/vpn/openvpn.go index b6593f2..38a64a9 100644 --- a/pkg/vpn/openvpn.go +++ b/pkg/vpn/openvpn.go @@ -230,22 +230,23 @@ func (b *Bitmask) VPNCheck() (helpers bool, privilege bool, err error) { return b.launch.check() } -// ListGateways return the names of the gateways +// ListGateways return the labels of the gateways (only for transport=openvpn, at the moment) +// TODO return other transports too func (b *Bitmask) ListGateways(provider string) ([]string, error) { - gateways, err := b.bonafide.GetGateways("openvpn") + gateways, err := b.bonafide.GetAllGateways("openvpn") if err != nil { return nil, err } gatewayNames := make([]string, len(gateways)) for i, gw := range gateways { - gatewayNames[i] = gw.Location + gatewayNames[i] = gw.Label } return gatewayNames, nil } -// UseGateway selects name as the default gateway -func (b *Bitmask) UseGateway(name string) error { - b.bonafide.SetManualGateway(name) +// UseGateway selects a gateway, by label, as the default gateway +func (b *Bitmask) UseGateway(label string) error { + b.bonafide.SetManualGateway(label) return nil } |