summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/backend')
-rw-r--r--pkg/backend/api.go1
-rw-r--r--pkg/backend/init.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index 6d5ceee..52c23c3 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -148,6 +148,7 @@ type InitOpts struct {
ProviderOptions *bitmask.ProviderOpts
SkipLaunch bool
Obfs4 bool
+ UDP bool
DisableAutostart bool
StartVPN string
}
diff --git a/pkg/backend/init.go b/pkg/backend/init.go
index c6d713b..fae5ff1 100644
--- a/pkg/backend/init.go
+++ b/pkg/backend/init.go
@@ -58,6 +58,7 @@ func initializeBitmask(errCh chan string, opts *InitOpts) {
bitmask.InitializeLogger()
ctx.cfg = config.ParseConfig()
setConfigOpts(opts, ctx.cfg)
+ ctx.UseUDP = ctx.cfg.UDP
err := pid.AcquirePID()
if err != nil {
@@ -92,6 +93,7 @@ func initializeBitmask(errCh chan string, opts *InitOpts) {
ctx.IsReady = true
}
+// transfer initialization options from the config json to the config object
func setConfigOpts(opts *InitOpts, conf *config.Config) {
conf.SkipLaunch = opts.SkipLaunch
if opts.StartVPN != "" {
@@ -104,6 +106,9 @@ func setConfigOpts(opts *InitOpts, conf *config.Config) {
if opts.Obfs4 {
conf.Obfs4 = opts.Obfs4
}
+ if opts.UDP {
+ conf.UDP = opts.UDP
+ }
if opts.DisableAutostart {
conf.DisableAutostart = opts.DisableAutostart
}