summaryrefslogtreecommitdiff
path: root/pkg/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/vpn')
-rw-r--r--pkg/vpn/bonafide/bonafide.go26
-rw-r--r--pkg/vpn/bonafide/gateways.go9
2 files changed, 24 insertions, 11 deletions
diff --git a/pkg/vpn/bonafide/bonafide.go b/pkg/vpn/bonafide/bonafide.go
index b4e6af0..907bba5 100644
--- a/pkg/vpn/bonafide/bonafide.go
+++ b/pkg/vpn/bonafide/bonafide.go
@@ -25,10 +25,12 @@ import (
"io/ioutil"
"log"
"net/http"
+ "os"
"strings"
"time"
"0xacab.org/leap/bitmask-vpn/pkg/config"
+ "0xacab.org/leap/bitmask-vpn/pkg/snowflake"
)
const (
@@ -234,18 +236,22 @@ func (b *Bonafide) getURLNoDNS(object string) string {
}
func (b *Bonafide) maybeInitializeEIP() error {
- if b.eip == nil {
- err := b.fetchEipJSON()
- if err != nil {
- return err
+ if os.Getenv("SNOWFLAKE") == "1" {
+ snowflake.BootstrapWithSnowflakeProxies()
+ } else {
+ if b.eip == nil {
+ err := b.fetchEipJSON()
+ if err != nil {
+ return err
+ }
+ b.gateways = newGatewayPool(b.eip)
}
- b.gateways = newGatewayPool(b.eip)
- }
- // FIXME: let's update the menshen gateways every time we 'maybe initilize EIP'
- // in a future we might want to be more clever on when to do that
- // (when opening the locations tab in the UI, only on reconnects, ...)
- b.fetchGatewaysFromMenshen()
+ // FIXME: let's update the menshen gateways every time we 'maybe initilize EIP'
+ // in a future we might want to be more clever on when to do that
+ // (when opening the locations tab in the UI, only on reconnects, ...)
+ b.fetchGatewaysFromMenshen()
+ }
return nil
}
diff --git a/pkg/vpn/bonafide/gateways.go b/pkg/vpn/bonafide/gateways.go
index 633493e..c442e72 100644
--- a/pkg/vpn/bonafide/gateways.go
+++ b/pkg/vpn/bonafide/gateways.go
@@ -306,7 +306,14 @@ func (p *gatewayPool) getBestLocation(transport string, tz int) string {
}
func (p *gatewayPool) getAll(transport string, tz int) ([]Gateway, error) {
- if len(p.recommended) != 0 {
+ /*
+ if (&gatewayPool{} == p) {
+ log.Println("getAll tried to access uninitialized struct")
+ return []Gateway{}, nil
+ }
+ */
+
+ if p.recommended == nil || len(p.recommended) == 0 {
return p.getGatewaysFromMenshen(transport, 999)
}
return p.getGatewaysByTimezone(transport, tz, 999)