diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-03-27 22:30:56 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2018-04-11 01:26:37 +0200 |
commit | a45d99f2dd4d3694160580184f0573a15c06708f (patch) | |
tree | a3f217997daa9dce1dc94125b99ccb1727a306bd /main.go | |
parent | 2d0f7c1aa92dee25e923c31456cdd3763dec1ada (diff) |
[feat] autoconnect if is the first run or was not manually stopped
- Resolves: #23
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -54,6 +54,7 @@ func main() { log.Printf("Is bitmask running? %v", err) return } + maybeStartVPN(b, conf) run(b, conf) } @@ -77,6 +78,18 @@ func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) error { return nil } +func maybeStartVPN(b *bitmask.Bitmask, conf *systrayConfig) { + if conf.UserStoppedVPN { + return + } + + err := b.StartVPN(provider) + if err != nil { + log.Println("Error starting VPN: ", err) + } + conf.setUserStoppedVPN(false) +} + func initPrinter() { locale, err := go_locale.DetectLocale() if err != nil { |