Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leap
bitmask-vpn
Commits
30587fb2
Unverified
Commit
30587fb2
authored
4 years ago
by
Kali Kaneko
Browse files
Options
Downloads
Patches
Plain Diff
[feat] pick only the top 3 gateways
fixes bug: do not initialize an empty list of gateways
parent
9882dfc4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!105
Sip login
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/vpn/bonafide/bonafide.go
+1
-1
1 addition, 1 deletion
pkg/vpn/bonafide/bonafide.go
pkg/vpn/bonafide/eip_service.go
+10
-2
10 additions, 2 deletions
pkg/vpn/bonafide/eip_service.go
with
11 additions
and
3 deletions
pkg/vpn/bonafide/bonafide.go
+
1
−
1
View file @
30587fb2
...
...
@@ -232,7 +232,7 @@ func (b *Bonafide) GetOpenvpnArgs() ([]string, error) {
}
func
(
b
*
Bonafide
)
fetchGeolocation
()
([]
string
,
error
)
{
/* FIXME in float deployments, geolocation is served on gemyip.domain/json, with a LE certificate.
/* FIXME in float deployments, geolocation is served on gemyip.domain/json, with a LE
certificate, but in riseup is served behind the api
certificate.
So this is a workaround until we streamline that behavior */
resp
,
err
:=
b
.
client
.
Post
(
config
.
GeolocationAPI
,
""
,
nil
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
pkg/vpn/bonafide/eip_service.go
+
10
−
2
View file @
30587fb2
...
...
@@ -116,6 +116,9 @@ func (b *Bonafide) fetchEipJSON() error {
}
b
.
setupAuthentication
(
b
.
eip
)
/* TODO we could launch the looping call from here.
but smells: calls a bonafide method that in turn calls methods in this file
*/
b
.
sortGateways
()
return
nil
}
...
...
@@ -204,8 +207,9 @@ func (eip eipService) getOpenvpnArgs() []string {
}
func
(
eip
*
eipService
)
sortGatewaysByGeolocation
(
geolocatedGateways
[]
string
)
{
gws
:=
make
([]
gatewayV3
,
len
(
eip
.
Gateways
)
)
gws
:=
make
([]
gatewayV3
,
0
)
/* TODO this probably should be moved out of this method */
if
eip
.
defaultGateway
!=
""
{
for
_
,
gw
:=
range
eip
.
Gateways
{
if
gw
.
Location
==
eip
.
defaultGateway
{
...
...
@@ -213,6 +217,8 @@ func (eip *eipService) sortGatewaysByGeolocation(geolocatedGateways []string) {
break
}
}
// a manually selected gateway means we do want exactly one remote
return
}
for
_
,
host
:=
range
geolocatedGateways
{
...
...
@@ -224,7 +230,9 @@ func (eip *eipService) sortGatewaysByGeolocation(geolocatedGateways []string) {
}
if
len
(
gws
)
==
0
{
log
.
Println
(
"ERROR: avoiding to replace eip.Gateways will null list. Is the geolocation service properly configured?"
)
// this can happen if a misconfigured geoip service does not match the
// providers list we got.
log
.
Println
(
"ERROR: avoiding to nullify eip.Gateways. Is the geolocation service properly configured?"
)
}
else
{
if
len
(
gws
)
>
2
{
eip
.
Gateways
=
gws
[
:
3
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment