From 9c2453b05a98bc5131c37c5dfb535f10bf1054f5 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Tue, 30 Nov 2021 21:14:44 +0100 Subject: [bug] initialize bitmask with persisted udp option --- pkg/backend/api.go | 1 + pkg/backend/init.go | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'pkg/backend') 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 } -- cgit v1.2.3