diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-06-22 17:57:29 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-06-22 18:04:48 +0200 |
commit | 9f1807c2c053e3b57881d42ebf58ec26dfee1b1d (patch) | |
tree | 70abd66546c6ad1f49edfc032eaf9f1cd8ca5d30 /pkg/vpn | |
parent | 514a6a8a1f1188a8dd95c79db150711cdc30bc48 (diff) |
[bug] populate gateways early on
- Closes: #511
Diffstat (limited to 'pkg/vpn')
-rw-r--r-- | pkg/vpn/main.go | 3 | ||||
-rw-r--r-- | pkg/vpn/openvpn.go | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/pkg/vpn/main.go b/pkg/vpn/main.go index 826e5d4..3a1f521 100644 --- a/pkg/vpn/main.go +++ b/pkg/vpn/main.go @@ -69,8 +69,9 @@ func Init() (*Bitmask, error) { */ err = ioutil.WriteFile(b.getTempCaCertPath(), config.CaCert, 0600) - + go b.fetchGateways() go b.openvpnManagement() + return &b, err } diff --git a/pkg/vpn/openvpn.go b/pkg/vpn/openvpn.go index 1a34c22..6682094 100644 --- a/pkg/vpn/openvpn.go +++ b/pkg/vpn/openvpn.go @@ -219,6 +219,15 @@ func (b *Bitmask) getCert() (certPath string, err error) { return certPath, err } +// Explicit call to GetGateways, to be able to fetch them all before starting the vpn +func (b *Bitmask) fetchGateways() { + log.Println("Fetching gateways...") + _, err := b.bonafide.GetAllGateways(b.transport) + if err != nil { + log.Println("ERROR Cannot fetch gateways") + } +} + // StopVPN or cancel func (b *Bitmask) StopVPN() error { err := b.launch.firewallStop() |