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
de44d07f
Commit
de44d07f
authored
5 months ago
by
Pea Nut
Committed by
jkito
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add introducer to storage before using it when supplied via env
parent
1a5a5a07
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!265
enable setting introducer url using env variable
Pipeline
#253819
failed
3 months ago
Stage: build
Stage: package
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/vpn/menshen/init.go
+31
-2
31 additions, 2 deletions
pkg/vpn/menshen/init.go
with
31 additions
and
2 deletions
pkg/vpn/menshen/init.go
+
31
−
2
View file @
de44d07f
...
...
@@ -7,6 +7,7 @@ import (
"0xacab.org/leap/bitmask-core/models"
"0xacab.org/leap/bitmask-core/pkg/bootstrap"
"0xacab.org/leap/bitmask-core/pkg/storage"
"0xacab.org/leap/bitmask-vpn/pkg/config"
"0xacab.org/leap/bitmask-vpn/pkg/snowflake"
...
...
@@ -49,6 +50,34 @@ func New() (*Menshen, error) {
// experimental introducer
if
introURL
:=
os
.
Getenv
(
"LEAP_INTRODUCER_URL"
);
introURL
!=
""
{
log
.
Info
()
.
Str
(
"introducerURL"
,
introURL
)
.
Msg
(
"Using introducer from env LEAP_INTRODUCER_URL"
)
store
,
err
:=
storage
.
GetStorage
()
if
err
!=
nil
{
log
.
Fatal
()
.
Err
(
err
)
.
Str
(
"introducerURL"
,
introURL
)
.
Msg
(
"Could to get storage"
)
}
// check if introducer exists in database, if not add it
_
,
err
=
store
.
GetIntroducerByURL
(
introURL
)
if
err
!=
nil
{
err
=
store
.
AddIntroducer
(
introURL
)
if
err
!=
nil
{
log
.
Fatal
()
.
Err
(
err
)
.
Str
(
"introducerURL"
,
introURL
)
.
Msg
(
"Failed to add introducer to storage"
)
}
else
{
log
.
Info
()
.
Msg
(
"Added introducer to database"
)
}
}
else
{
log
.
Info
()
.
Msg
(
"Found introducer in database"
)
}
cfg
.
Introducer
=
introURL
}
...
...
@@ -75,7 +104,7 @@ func New() (*Menshen, error) {
// "--persisst-key" without additional value
// Currently, there is no caching implemented
func
(
m
*
Menshen
)
GetOpenvpnArgs
()
([]
string
,
error
)
{
log
.
Trace
()
.
Msg
(
"Getting OpenVPN arguments"
)
log
.
Trace
()
.
Msg
(
"Getting OpenVPN arguments
from menshen
"
)
service
,
err
:=
m
.
api
.
GetService
()
if
err
!=
nil
{
...
...
@@ -118,7 +147,7 @@ func (m *Menshen) GetOpenvpnArgs() ([]string, error) {
// Asks menshen for valid client credentials (certificate + key)
// Currently, there is no caching implemented
func
(
m
*
Menshen
)
GetPemCertificate
()
([]
byte
,
error
)
{
log
.
Trace
()
.
Msg
(
"Getting OpenVPN client certificate"
)
log
.
Trace
()
.
Msg
(
"Getting OpenVPN client certificate
from menshen
"
)
cert
,
err
:=
m
.
api
.
GetOpenVPNCert
()
if
err
!=
nil
{
return
[]
byte
{},
err
...
...
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