summaryrefslogtreecommitdiff
path: root/pkg/backend
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/backend')
-rw-r--r--pkg/backend/actions.go7
-rw-r--r--pkg/backend/api.go16
-rw-r--r--pkg/backend/init.go4
-rw-r--r--pkg/backend/status.go2
4 files changed, 19 insertions, 10 deletions
diff --git a/pkg/backend/actions.go b/pkg/backend/actions.go
index 9e0941b..805c5ad 100644
--- a/pkg/backend/actions.go
+++ b/pkg/backend/actions.go
@@ -23,10 +23,3 @@ func stopVPN() {
func getGateway() string {
return ctx.bm.GetCurrentGateway()
}
-
-func setTransport(t string) {
- err := ctx.bm.SetTransport(t)
- if err != nil {
- log.Println(err)
- }
-}
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index 96f3072..51fa377 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -80,7 +80,21 @@ func UseAutomaticGateway() {
}
func SetTransport(label string) {
- ctx.bm.SetTransport(label)
+ err := ctx.bm.SetTransport(label)
+ if err != nil {
+ log.Println(err)
+ }
+ if label == "obfs4" {
+ ctx.cfg.SetUseObfs4(true)
+ } else {
+ ctx.cfg.SetUseObfs4(false)
+ }
+ go trigger(OnStatusChanged)
+}
+
+func SetUDP(udp bool) {
+ log.Println("DEBUG setting UDP")
+ ctx.cfg.SetUseUDP(udp)
go trigger(OnStatusChanged)
}
diff --git a/pkg/backend/init.go b/pkg/backend/init.go
index fcde725..70a3582 100644
--- a/pkg/backend/init.go
+++ b/pkg/backend/init.go
@@ -103,13 +103,13 @@ func setConfigOpts(opts *InitOpts, conf *config.Config) {
conf.Obfs4 = opts.Obfs4
}
if opts.DisableAutostart {
- conf.DisableAustostart = opts.DisableAutostart
+ conf.DisableAutostart = opts.DisableAutostart
}
}
func initializeAutostart(conf *config.Config) bitmask.Autostart {
autostart := bitmask.NewAutostart(config.ApplicationName, "")
- if conf.SkipLaunch || conf.DisableAustostart {
+ if conf.SkipLaunch || conf.DisableAutostart {
autostart.Disable()
autostart = &bitmask.DummyAutostart{}
}
diff --git a/pkg/backend/status.go b/pkg/backend/status.go
index c5f79d1..79b70ff 100644
--- a/pkg/backend/status.go
+++ b/pkg/backend/status.go
@@ -51,6 +51,7 @@ type connectionCtx struct {
CurrentCountry string `json:"currentCountry"`
BestLocation string `json:"bestLocation"`
Transport string `json:"transport"`
+ UseUDP bool `json:"udp"`
ManualLocation bool `json:"manualLocation"`
IsReady bool `json:"isReady"`
bm bitmask.Bitmask
@@ -69,6 +70,7 @@ func (c *connectionCtx) toJson() ([]byte, error) {
c.CurrentCountry = c.bm.GetCurrentCountry()
c.BestLocation = c.bm.GetBestLocation(transport)
c.Transport = transport
+ c.UseUDP = c.cfg.UDP // TODO initialize bitmask too
c.ManualLocation = c.bm.IsManualLocation()
}
defer statusMutex.Unlock()