From f91114578c73e0ce4e417ae1344a64eed31e08ea Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 1 Dec 2021 21:55:28 +0100 Subject: [feat] disable autostart we've agreed that the autostart behaviour can be unexpected; we'll expose the ability under preferences (it can be controlled via cli right now). --- CHANGELOG | 10 ++++++++-- gui/backend.go | 2 +- gui/main.cpp | 20 ++++++++++---------- pkg/backend/init.go | 13 ++++++++----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ec44f3e..1c7e8be 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,12 @@ -0.21.8 -====== +0.21.11 +======= - Do not fail if ipv6 is disabled (GNU/Linux) +- Complete UI revamp +- UDP support +- Obfs4 support +- Experimental snowflake support for bootstrap +- Disable autostart + 0.21.6 ====== diff --git a/gui/backend.go b/gui/backend.go index 516ef4a..5feb6d4 100644 --- a/gui/backend.go +++ b/gui/backend.go @@ -87,7 +87,6 @@ func SubscribeToEvent(event string, f unsafe.Pointer) { func InitializeBitmaskContext(provider string, jsonPtr unsafe.Pointer, jsonLen C.int, obfs4 bool, disableAutostart bool, startVPN string) { - json := C.GoBytes(jsonPtr, jsonLen) opts := backend.InitOptsFromJSON(provider, string(json)) opts.Obfs4 = obfs4 @@ -98,6 +97,7 @@ func InitializeBitmaskContext(provider string, //export InitializeTestBitmaskContext func InitializeTestBitmaskContext(provider string, + jsonPtr unsafe.Pointer, jsonLen C.int) { json := C.GoBytes(jsonPtr, jsonLen) opts := backend.InitOptsFromJSON(provider, string(json)) diff --git a/gui/main.cpp b/gui/main.cpp index 5a265eb..b4051b2 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -124,10 +124,10 @@ int main(int argc, char **argv) { "Use obfs4 to obfuscate the traffic, if available in the provider."), }, { - {"a", "disable-autostart"}, + {"a", "enable-autostart"}, QApplication::translate( "main", - "Disable autostart for the next run."), + "Enable autostart."), }, }); QCommandLineOption webPortOption("web-port", QApplication::translate("main", "Web API port (default: 8080)"), "port", "8080"); @@ -137,14 +137,14 @@ int main(int argc, char **argv) { parser.addOption(startVPNOption); parser.process(app); - bool hideSystray = parser.isSet("no-systray"); + bool hideSystray = parser.isSet("no-systray"); bool availableSystray = true; - bool installHelpers = parser.isSet("install-helpers"); - bool webAPI = parser.isSet("web-api"); - QString webPort = parser.value("web-port"); - bool version = parser.isSet("version"); - bool obfs4 = parser.isSet("obfs4"); - bool disAutostart = parser.isSet("disable-autostart"); + bool installHelpers = parser.isSet("install-helpers"); + bool webAPI = parser.isSet("web-api"); + QString webPort = parser.value("web-port"); + bool version = parser.isSet("version"); + bool obfs4 = parser.isSet("obfs4"); + bool enableAutostart = parser.isSet("enable-autostart"); QString startVPN = parser.value("start-vpn"); if (version) { @@ -240,7 +240,7 @@ int main(int argc, char **argv) { InitializeBitmaskContext( toGoStr(defaultProvider.toString()), (char*)providerJsonBytes.data(), providerJsonBytes.length(), - obfs4, disAutostart, toGoStr(startVPN)); + obfs4, !enableAutostart, toGoStr(startVPN)); /* if requested, enable web api for controlling the VPN */ if (webAPI) diff --git a/pkg/backend/init.go b/pkg/backend/init.go index fae5ff1..b007c61 100644 --- a/pkg/backend/init.go +++ b/pkg/backend/init.go @@ -72,6 +72,9 @@ func initializeBitmask(errCh chan string, opts *InitOpts) { errCh <- err.Error() return } + // right now we just get autostart from an init flag, + // but we want to be able to persist that option from the preferences + // pane ctx.autostart = initializeAutostart(ctx.cfg) helpers, privilege, err := b.VPNCheck() @@ -119,11 +122,11 @@ func initializeAutostart(conf *config.Config) bitmask.Autostart { if conf.SkipLaunch || conf.DisableAutostart { autostart.Disable() autostart = &bitmask.DummyAutostart{} - } - - err := autostart.Enable() - if err != nil { - log.Printf("Error enabling autostart: %v", err) + } else { + err := autostart.Enable() + if err != nil { + log.Printf("Error enabling autostart: %v", err) + } } return autostart } -- cgit v1.2.3