summaryrefslogtreecommitdiff
path: root/pkg/vpn
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-09-27 19:31:51 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-11-23 21:51:10 +0100
commitd7e65d5cd3ca87b7ebc11cc5f6e9bfd4e9cefbfd (patch)
tree4d74d31f4275dabd145f41f0d61753e155680581 /pkg/vpn
parentab6360dd9a32a11fa220b93c7e379aa4367347d9 (diff)
[ui] pseudo-load based on distance
Diffstat (limited to 'pkg/vpn')
-rw-r--r--pkg/vpn/bonafide/gateways.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/vpn/bonafide/gateways.go b/pkg/vpn/bonafide/gateways.go
index 4299bb2..633493e 100644
--- a/pkg/vpn/bonafide/gateways.go
+++ b/pkg/vpn/bonafide/gateways.go
@@ -96,14 +96,18 @@ func (p *gatewayPool) listLocationFullness(transport string) map[string]float64
return cm
}
if len(p.recommended) != 0 {
- for _, gw := range p.recommended {
+ for idx, gw := range p.recommended {
if gw.gateway.Transport != transport {
continue
}
if _, ok := cm[gw.gateway.Location]; ok {
continue
}
- cm[gw.gateway.Location] = gw.Fullness
+ if gw.Fullness != -1 {
+ cm[gw.gateway.Location] = gw.Fullness
+ } else {
+ cm[gw.gateway.Location] = 1 - float64(idx)/float64(len(p.recommended))
+ }
}
} else {
for _, location := range locations {