summaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-09-24 20:58:30 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-11-23 21:51:08 +0100
commit0efd19b935452a7b0b5561f9cba56b01ba7c627f (patch)
treef7ca08f78a76d64b0be83eef789ed6a935ca31d1 /pkg/config
parentbe36ce80cac534afda4393fc6bd904d489b63361 (diff)
[feat] persist obfs4 & udp prefs
Diffstat (limited to 'pkg/config')
-rw-r--r--pkg/config/gui.go34
1 files changed, 24 insertions, 10 deletions
diff --git a/pkg/config/gui.go b/pkg/config/gui.go
index f5ae7a2..6004d20 100644
--- a/pkg/config/gui.go
+++ b/pkg/config/gui.go
@@ -36,16 +36,18 @@ var (
// Config holds the configuration of the systray
type Config struct {
file struct {
- LastReminded time.Time
- Donated time.Time
- Obfs4 bool
- UserStoppedVPN bool
- DisableAustostart bool
+ LastReminded time.Time
+ Donated time.Time
+ Obfs4 bool
+ UserStoppedVPN bool
+ DisableAutostart bool
+ UDP bool
}
- Obfs4 bool
- DisableAustostart bool
- StartVPN bool
- SkipLaunch bool
+ SkipLaunch bool
+ Obfs4 bool
+ DisableAutostart bool
+ StartVPN bool
+ UDP bool
}
// ParseConfig reads the configuration from the configuration file
@@ -62,7 +64,7 @@ func ParseConfig() *Config {
}
conf.Obfs4 = conf.file.Obfs4
- conf.DisableAustostart = conf.file.DisableAustostart
+ conf.DisableAutostart = conf.file.DisableAutostart
conf.StartVPN = !conf.file.UserStoppedVPN
return &conf
}
@@ -90,6 +92,18 @@ func (c *Config) SetDonated() error {
return c.save()
}
+func (c *Config) SetUseObfs4(val bool) error {
+ c.Obfs4 = val
+ c.file.Obfs4 = val
+ return c.save()
+}
+
+func (c *Config) SetUseUDP(val bool) error {
+ c.UDP = val
+ c.file.UDP = val
+ return c.save()
+}
+
func (c *Config) save() error {
f, err := os.Create(configPath)
if err != nil {