diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 30 | ||||
-rw-r--r-- | autostart.go | 16 | ||||
-rw-r--r-- | cmd/bitmask-vpn/catalog.go (renamed from catalog.go) | 249 | ||||
-rw-r--r-- | cmd/bitmask-vpn/main.go | 76 | ||||
-rw-r--r-- | locales/bn/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/en-GB/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/en-US/messages.gotext.json | 70 | ||||
-rw-r--r-- | locales/es-ES/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/es/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/fr/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/lt/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/nl/messages.gotext.json | 66 | ||||
-rw-r--r-- | locales/pt-BR/messages.gotext.json | 66 | ||||
-rw-r--r-- | pkg/bitmask/autostart.go | 32 | ||||
-rw-r--r-- | pkg/bitmask/bitmask.go (renamed from bitmask/bitmask.go) | 0 | ||||
-rw-r--r-- | pkg/bitmask/bitmaskd.go (renamed from bitmaskd.go) | 12 | ||||
-rw-r--r-- | pkg/bitmask/standalone.go (renamed from standalone.go) | 16 | ||||
-rw-r--r-- | pkg/bitmaskd/events.go (renamed from bitmaskd/events.go) | 2 | ||||
-rw-r--r-- | pkg/bitmaskd/main.go (renamed from bitmaskd/main.go) | 6 | ||||
-rw-r--r-- | pkg/bitmaskd/vpn.go (renamed from bitmaskd/vpn.go) | 2 | ||||
-rw-r--r-- | pkg/config/darwin.go (renamed from bitmask/darwin.go) | 5 | ||||
-rw-r--r-- | pkg/config/logger.go | 31 | ||||
-rw-r--r-- | pkg/config/unix.go (renamed from bitmask/unix.go) | 5 | ||||
-rw-r--r-- | pkg/config/windows.go (renamed from bitmask/windows.go) | 5 | ||||
-rw-r--r-- | pkg/standalone/bonafide.go (renamed from standalone/bonafide.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/bonafide_integration_test.go (renamed from standalone/bonafide_integration_test.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/bonafide_test.go (renamed from standalone/bonafide_test.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/launcher.go (renamed from standalone/launcher.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/launcher_linux.go (renamed from standalone/launcher_linux.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/main.go (renamed from standalone/main.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/status.go (renamed from standalone/status.go) | 2 | ||||
-rw-r--r-- | pkg/standalone/testdata/cert (renamed from standalone/testdata/cert) | 0 | ||||
-rw-r--r-- | pkg/standalone/testdata/eip-service.json (renamed from standalone/testdata/eip-service.json) | 0 | ||||
-rw-r--r-- | pkg/standalone/vpn.go (renamed from standalone/vpn.go) | 2 | ||||
-rw-r--r-- | pkg/systray/config.go (renamed from config.go) | 31 | ||||
-rw-r--r-- | pkg/systray/notificator.go (renamed from notificator.go) | 24 | ||||
-rw-r--r-- | pkg/systray/pid.go (renamed from pid.go) | 6 | ||||
-rw-r--r-- | pkg/systray/pid_test.go (renamed from pid_test.go) | 2 | ||||
-rw-r--r-- | pkg/systray/run.go (renamed from main.go) | 77 | ||||
-rw-r--r-- | pkg/systray/signal_unix.go (renamed from signal_unix.go) | 4 | ||||
-rw-r--r-- | pkg/systray/signal_windows.go (renamed from signal_windows.go) | 4 | ||||
-rw-r--r-- | pkg/systray/systray.go (renamed from systray.go) | 34 | ||||
-rw-r--r-- | tools/transifex/Makefile | 8 | ||||
-rw-r--r-- | tools/transifex/main.go (renamed from transifex/main.go) | 0 | ||||
-rw-r--r-- | tools/transifex/messages.json (renamed from transifex/messages.json) | 2 | ||||
-rw-r--r-- | transifex/Makefile | 8 |
47 files changed, 661 insertions, 645 deletions
@@ -1,5 +1,6 @@ -bitmask-systray +/bitmask-vpn +cmd/bitmask-vpn/bitmask-vpn locales/*/out.gotext.json .*.swp *.exe -transifex/transifex +tools/transifex/transifex @@ -8,27 +8,29 @@ get: go get -tags $(TAGS) ./... go get -tags "$(TAGS) bitmaskd" ./... -build: - go build -tags $(TAGS) -ldflags "-X main.version=`git describe --tags`" +build: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path))) + +build_%: + go build -tags $(TAGS) -ldflags "-X main.version=`git describe --tags`" -o $* ./cmd/$* test: go test -tags "integration $(TAGS)" ./... build_bitmaskd: - go build -tags "$(TAGS) bitmaskd" -ldflags "-X main.version=`git describe --tags`" + go build -tags "$(TAGS) bitmaskd" -ldflags "-X main.version=`git describe --tags`" ./cmd/* build_win: - powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version"' + powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version" ./cmd/*' clean: make -C icon clean - rm bitmask-systray + rm bitmask-vpn icon: make -C icon get_deps: - sudo apt install libgtk-3-dev libappindicator3-dev golang pkg-config + sudo apt install libgtk-3-dev libappindicator3-dev golang pkg-config LANGS ?= $(foreach path,$(wildcard locales/*),$(patsubst locales/%,%,$(path))) @@ -36,17 +38,17 @@ empty := space := $(empty) $(empty) lang_list := $(subst $(space),,$(foreach lang,$(LANGS),$(lang),)) -locales: $(foreach lang,$(LANGS),get_$(lang)) catalog.go +locales: $(foreach lang,$(LANGS),get_$(lang)) cmd/bitmask-vpn/catalog.go generate_locales: $(foreach lang,$(LANGS),locales/$(lang)/out.gotext.json) - make -C transifex + make -C tools/transifex -locales/%/out.gotext.json: systray.go notificator.go - gotext update -lang=$* +locales/%/out.gotext.json: pkg/systray/systray.go pkg/systray/notificator.go pkg/bitmask/standalone.go pkg/bitmask/bitmaskd.go + gotext update -lang=$* ./pkg/systray ./pkg/bitmask -catalog.go: $(foreach lang,$(LANGS),locales/$(lang)/messages.gotext.json) - gotext update -lang=$(lang_list) -out catalog.go +cmd/bitmask-vpn/catalog.go: $(foreach lang,$(LANGS),locales/$(lang)/messages.gotext.json) + gotext update -lang=$(lang_list) -out cmd/bitmask-vpn/catalog.go ./pkg/systray ./pkg/bitmask get_%: - make -C transifex build - curl -L -X GET --user "api:${API_TOKEN}" "https://www.transifex.com/api/2/project/bitmask/resource/RiseupVPN/translation/${subst -,_,$*}/?file" | transifex/transifex t2g locales/$*/ + make -C tools/transifex build + curl -L -X GET --user "api:${API_TOKEN}" "https://www.transifex.com/api/2/project/bitmask/resource/RiseupVPN/translation/${subst -,_,$*}/?file" | tools/transifex/transifex t2g locales/$*/ diff --git a/autostart.go b/autostart.go deleted file mode 100644 index 62f30cc..0000000 --- a/autostart.go +++ /dev/null @@ -1,16 +0,0 @@ -package main - -type autostart interface { - Disable() error - Enable() error -} - -type dummyAutostart struct{} - -func (a *dummyAutostart) Disable() error { - return nil -} - -func (a *dummyAutostart) Enable() error { - return nil -} diff --git a/catalog.go b/cmd/bitmask-vpn/catalog.go index a9f00b6..55142e8 100644 --- a/catalog.go +++ b/cmd/bitmask-vpn/catalog.go @@ -44,44 +44,44 @@ func init() { var messageKeyToIndex = map[string]int{ "%[1]s is an easy, fast, and secure VPN service from riseup.net. %[1]s does not require a user account, keep logs, or track you in any way.\n\t \nThis service is paid for entirely by donations from users like you. Please donate at https://riseup.net/vpn/donate.\n\t\t\nBy using this application, you agree to the Terms of Service available at https://riseup.net/tos. This service is provide as-is, without any warranty, and is intended for people who work to make the world a better place.\n\n\n%[1]v version: %[2]s": 2, - "%s blocking internet": 25, - "%s off": 20, - "%s on": 19, + "%s blocking internet": 24, + "%s off": 19, + "%s on": 18, "About": 3, - "About...": 15, - "An error has ocurred initializing %s: %v": 9, - "Can't connect to %s: %v": 7, - "Cancel": 21, - "Checking status...": 10, - "Connecting to %s": 22, + "About...": 14, + "An error has ocurred initializing the VPN: %v": 25, + "Can't connect to %s: %v": 7, + "Cancel": 20, + "Checking status...": 9, + "Connecting to %s": 21, "Could not find a polkit authentication agent. Please run one and try again.": 5, "Donate": 1, - "Donate...": 14, + "Donate...": 13, "Error starting VPN": 8, - "Help...": 13, + "Help...": 12, "Initialization error": 4, "Missing authentication agent": 6, - "Quit": 16, - "Retry": 24, - "Route traffic through": 17, - "Stopping %s": 23, + "Quit": 15, + "Retry": 23, + "Route traffic through": 16, + "Stopping %s": 22, "The %s service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?": 0, - "Turn off": 12, - "Turn on": 11, - "Use %s %v gateway": 18, + "Turn off": 11, + "Turn on": 10, + "Use %s %v gateway": 17, } var bnIndex = []uint32{ // 27 elements 0x00000000, 0x000000fd, 0x00000110, 0x0000030c, 0x00000325, 0x00000348, 0x00000394, 0x000003e2, - 0x00000400, 0x00000450, 0x0000047f, 0x000004c6, - 0x000004da, 0x000004ee, 0x00000507, 0x0000051d, - 0x00000539, 0x00000546, 0x00000586, 0x0000059e, - 0x000005b1, 0x000005c4, 0x000005d4, 0x00000614, - 0x00000637, 0x0000066a, 0x000006b2, + 0x00000400, 0x00000450, 0x00000497, 0x000004ab, + 0x000004bf, 0x000004d8, 0x000004ee, 0x0000050a, + 0x00000517, 0x00000557, 0x0000056f, 0x00000582, + 0x00000595, 0x000005a5, 0x000005e5, 0x00000608, + 0x0000063b, 0x00000683, 0x000006b0, } // Size: 132 bytes -const bnData string = "" + // Size: 1714 bytes +const bnData string = "" + // Size: 1712 bytes "\x02The %[1]s service is expensive to run. Because we don't want to stor" + "e personal information about you, there is no accounts or billing for th" + "is service. But if you want the service to continue, donate at least $5 " + @@ -96,24 +96,24 @@ const bnData string = "" + // Size: 1714 bytes "\x0a\x0a%[1]v version: %[2]s\x02সম্পর্কে\x02সূচনা ত্রুটি\x02Could not fi" + "nd a polkit authentication agent. Please run one and try again.\x02প্রমা" + "ণীকরণ এজেন্ট অনুপস্থিত\x02Can't connect to %[1]s: %[2]v\x02ভিপিএন চালু" + - " করতে ত্রুটি হয়েছে\x02An error has ocurred initializing %[1]s: %[2]v\x02" + - "অবস্থা পরিক্ষা করা হচ্ছে ...\x02চালু কর\x02বন্ধ কর\x02সাহায্য...\x02অন" + - "ুদান...\x02সম্পর্কে...\x02বন্ধ\x02ট্রাফিক এর মাধ্যমে যাবে\x02Use %[1]s" + - " %[2]v gateway\x02%[1]s চালু\x02%[1]s বন্ধ\x02বাতিল\x02%[1]s এর সাথে সংয" + - "ুক্ত হচ্ছে\x02%[1]s বন্ধ হচ্ছে\x02পূনরায় চেষ্টা করুন\x02%[1]s ইন্টারনে" + - "ট প্রতিরোধ করছে" + " করতে ত্রুটি হয়েছে\x02অবস্থা পরিক্ষা করা হচ্ছে ...\x02চালু কর\x02বন্ধ কর" + + "\x02সাহায্য...\x02অনুদান...\x02সম্পর্কে...\x02বন্ধ\x02ট্রাফিক এর মাধ্যমে" + + " যাবে\x02Use %[1]s %[2]v gateway\x02%[1]s চালু\x02%[1]s বন্ধ\x02বাতিল" + + "\x02%[1]s এর সাথে সংযুক্ত হচ্ছে\x02%[1]s বন্ধ হচ্ছে\x02পূনরায় চেষ্টা করু" + + "ন\x02%[1]s ইন্টারনেট প্রতিরোধ করছে\x02An error has ocurred initializin" + + "g VPN: %[1]v" var en_GBIndex = []uint32{ // 27 elements 0x00000000, 0x000000ff, 0x00000106, 0x00000302, 0x00000308, 0x0000031d, 0x00000369, 0x00000386, - 0x000003a4, 0x000003b7, 0x000003e7, 0x000003fa, - 0x00000402, 0x0000040b, 0x00000413, 0x0000041d, - 0x00000426, 0x0000042b, 0x00000441, 0x00000459, - 0x00000462, 0x0000046c, 0x00000473, 0x00000487, - 0x00000496, 0x0000049c, 0x000004b4, + 0x000003a4, 0x000003b7, 0x000003ca, 0x000003d2, + 0x000003db, 0x000003e3, 0x000003ed, 0x000003f6, + 0x000003fb, 0x00000411, 0x00000429, 0x00000432, + 0x0000043c, 0x00000443, 0x00000457, 0x00000466, + 0x0000046c, 0x00000484, 0x000004b2, } // Size: 132 bytes -const en_GBData string = "" + // Size: 1204 bytes +const en_GBData string = "" + // Size: 1202 bytes "\x02The %[1]s service is expensive to run. Because we don't want to stor" + "e personal information about you, there is no accounts or billing for th" + "is service. But if you want the service to continue, donate at least US$" + @@ -128,23 +128,23 @@ const en_GBData string = "" + // Size: 1204 bytes "\x0a\x0a%[1]v version: %[2]s\x02About\x02Initialisation error\x02Could n" + "ot find a Polkit authentication agent. Please run one and try again.\x02" + "Missing authentication agent\x02Can't connect to %[1]s: %[2]v\x02Error s" + - "tarting VPN\x02An error has occurred initialising %[1]s: %[2]v\x02Checki" + - "ng status...\x02Turn on\x02Turn off\x02Help...\x02Donate...\x02About..." + - "\x02Quit\x02Route traffic through\x02Use %[1]s %[2]v gateway\x02%[1]s on" + - "\x02%[1]s off\x02Cancel\x02Connecting to %[1]s\x02Stopping %[1]s\x02Retr" + - "y\x02%[1]s blocking Internet" + "tarting VPN\x02Checking status...\x02Turn on\x02Turn off\x02Help...\x02D" + + "onate...\x02About...\x02Quit\x02Route traffic through\x02Use %[1]s %[2]v" + + " gateway\x02%[1]s on\x02%[1]s off\x02Cancel\x02Connecting to %[1]s\x02St" + + "opping %[1]s\x02Retry\x02%[1]s blocking Internet\x02An error has occurre" + + "d initialising VPN: %[1]v" var en_USIndex = []uint32{ // 27 elements 0x00000000, 0x000000fd, 0x00000104, 0x00000300, 0x00000306, 0x0000031b, 0x00000367, 0x00000384, - 0x000003a2, 0x000003b5, 0x000003e4, 0x000003f7, - 0x000003ff, 0x00000408, 0x00000410, 0x0000041a, - 0x00000423, 0x00000428, 0x0000043e, 0x00000456, - 0x0000045f, 0x00000469, 0x00000470, 0x00000484, - 0x00000493, 0x00000499, 0x000004b1, + 0x000003a2, 0x000003b5, 0x000003c8, 0x000003d0, + 0x000003d9, 0x000003e1, 0x000003eb, 0x000003f4, + 0x000003f9, 0x0000040f, 0x00000427, 0x00000430, + 0x0000043a, 0x00000441, 0x00000455, 0x00000464, + 0x0000046a, 0x00000482, 0x000004af, } // Size: 132 bytes -const en_USData string = "" + // Size: 1201 bytes +const en_USData string = "" + // Size: 1199 bytes "\x02The %[1]s service is expensive to run. Because we don't want to stor" + "e personal information about you, there is no accounts or billing for th" + "is service. But if you want the service to continue, donate at least $5 " + @@ -159,23 +159,23 @@ const en_USData string = "" + // Size: 1201 bytes "\x0a\x0a%[1]v version: %[2]s\x02About\x02Initialization error\x02Could n" + "ot find a polkit authentication agent. Please run one and try again.\x02" + "Missing authentication agent\x02Can't connect to %[1]s: %[2]v\x02Error s" + - "tarting VPN\x02An error has ocurred initializing %[1]s: %[2]v\x02Checkin" + - "g status...\x02Turn on\x02Turn off\x02Help...\x02Donate...\x02About..." + - "\x02Quit\x02Route traffic through\x02Use %[1]s %[2]v gateway\x02%[1]s on" + - "\x02%[1]s off\x02Cancel\x02Connecting to %[1]s\x02Stopping %[1]s\x02Retr" + - "y\x02%[1]s blocking internet" + "tarting VPN\x02Checking status...\x02Turn on\x02Turn off\x02Help...\x02D" + + "onate...\x02About...\x02Quit\x02Route traffic through\x02Use %[1]s %[2]v" + + " gateway\x02%[1]s on\x02%[1]s off\x02Cancel\x02Connecting to %[1]s\x02St" + + "opping %[1]s\x02Retry\x02%[1]s blocking internet\x02An error has ocurred" + + " initializing VPN: %[1]v" var esIndex = []uint32{ // 27 elements 0x00000000, 0x000000ec, 0x000000f1, 0x00000332, 0x0000033c, 0x00000355, 0x000003bc, 0x000003de, - 0x00000401, 0x00000419, 0x00000449, 0x00000462, - 0x0000046b, 0x00000472, 0x0000047b, 0x00000483, - 0x00000490, 0x00000497, 0x000004aa, 0x000004cb, - 0x000004db, 0x000004e9, 0x000004f2, 0x00000506, - 0x0000051e, 0x00000529, 0x00000543, + 0x00000401, 0x00000419, 0x00000432, 0x0000043b, + 0x00000442, 0x0000044b, 0x00000453, 0x00000460, + 0x00000467, 0x0000047a, 0x0000049b, 0x000004ab, + 0x000004b9, 0x000004c2, 0x000004d6, 0x000004ee, + 0x000004f9, 0x00000513, 0x00000541, } // Size: 132 bytes -const esData string = "" + // Size: 1347 bytes +const esData string = "" + // Size: 1345 bytes "\x02El servicio %[1]s es caro de mantener. Como no queremos guardar ning" + "una información personal tuya, no hay cuentas ni servicio de facturación" + ". Si quieres que este servicio continúe, dona al menos $5 cada mes.\x0a" + @@ -191,24 +191,24 @@ const esData string = "" + // Size: 1347 bytes " de\x02Error de inicialización\x02No se pudo encontrar ningún agente de " + "autenticacion de polkit. Por favor lanza uno y prueba de nuevo.\x02Falta" + " un agente de autenticación\x02No puedo conectar con %[1]s: %[2]v\x02Err" + - "or arrancando la VPN\x02Un error ha ocurrido inicializando %[1]s: %[2]v" + - "\x02Comprobando el estado...\x02Encender\x02Apagar\x02Ayuda...\x02Dona.." + - ".\x02Acerca de...\x02Cerrar\x02Salir a través de\x02Usa la salida de %[1" + - "]s por %[2]v\x02%[1]s encendida\x02%[1]s apagada\x02Cancelar\x02Connecta" + - "ndo a %[1]s\x02Desconnectando de %[1]s\x02Reintentar\x02%[1]s bloqueando" + - " internet" + "or arrancando la VPN\x02Comprobando el estado...\x02Encender\x02Apagar" + + "\x02Ayuda...\x02Dona...\x02Acerca de...\x02Cerrar\x02Salir a través de" + + "\x02Usa la salida de %[1]s por %[2]v\x02%[1]s encendida\x02%[1]s apagada" + + "\x02Cancelar\x02Connectando a %[1]s\x02Desconnectando de %[1]s\x02Reinte" + + "ntar\x02%[1]s bloqueando internet\x02Un error ha ocurrido inicializando " + + "VPN: %[1]v" var es_ESIndex = []uint32{ // 27 elements 0x00000000, 0x000000ec, 0x000000f2, 0x00000343, 0x0000034d, 0x00000366, 0x000003c7, 0x000003e6, - 0x0000040a, 0x0000041e, 0x0000044e, 0x00000464, - 0x0000046c, 0x00000477, 0x00000480, 0x00000489, - 0x00000496, 0x0000049c, 0x000004ba, 0x000004da, - 0x000004e9, 0x000004fb, 0x00000504, 0x00000517, - 0x00000528, 0x00000533, 0x0000054d, + 0x0000040a, 0x0000041e, 0x00000434, 0x0000043c, + 0x00000447, 0x00000450, 0x00000459, 0x00000466, + 0x0000046c, 0x0000048a, 0x000004aa, 0x000004b9, + 0x000004cb, 0x000004d4, 0x000004e7, 0x000004f8, + 0x00000503, 0x0000051d, 0x0000054b, } // Size: 132 bytes -const es_ESData string = "" + // Size: 1357 bytes +const es_ESData string = "" + // Size: 1355 bytes "\x02Correr el servicio %[1]s es caro. Porque no queremos almacenar infor" + "mación personal acerca tuyo, no hay cuentas o tarifas por este servicio." + " Pero si quieres que el mismo continúe, dona la menos USD 5 por mes.\x0a" + @@ -224,24 +224,24 @@ const es_ESData string = "" + // Size: 1357 bytes ": %[2]s\x02Acerca de\x02Error de inicialización\x02No se pudo encontrar " + "un agente de autenticación polkit. Por favor corre uno e intenta de nuev" + "o.\x02Falta agente de autenticación\x02No se puede conectar a %[1]s: %[2" + - "]v\x02Error iniciando VPN\x02Ha ocurrido un error inicializando %[1]s: %" + - "[2]v\x02Comprobando estado...\x02Activar\x02Desactivar\x02Ayuda...\x02Do" + - "nar...\x02Acerca de...\x02Salir\x02Enrutar tráfico a través de\x02Usar r" + - "uta de salida %[1]s %[2]v\x02%[1]s activada\x02%[1]s desactivada\x02Canc" + - "elar\x02Conectando a %[1]s\x02Deteniendo %[1]s\x02Reintentar\x02%[1]s bl" + - "oqueando Internet" + "]v\x02Error iniciando VPN\x02Comprobando estado...\x02Activar\x02Desacti" + + "var\x02Ayuda...\x02Donar...\x02Acerca de...\x02Salir\x02Enrutar tráfico " + + "a través de\x02Usar ruta de salida %[1]s %[2]v\x02%[1]s activada\x02%[1]" + + "s desactivada\x02Cancelar\x02Conectando a %[1]s\x02Deteniendo %[1]s\x02R" + + "eintentar\x02%[1]s bloqueando Internet\x02Ha ocurrido un error inicializ" + + "ando VPN: %[1]v" var frIndex = []uint32{ // 27 elements 0x00000000, 0x00000154, 0x00000161, 0x000003d5, 0x000003df, 0x000003f9, 0x0000045b, 0x00000487, - 0x000004b4, 0x000004d0, 0x00000513, 0x00000531, - 0x00000539, 0x00000545, 0x0000054d, 0x0000055d, - 0x0000056a, 0x00000572, 0x0000058a, 0x000005ae, - 0x000005c0, 0x000005d6, 0x000005de, 0x000005f1, - 0x00000601, 0x0000060a, 0x00000620, + 0x000004b4, 0x000004d0, 0x000004ee, 0x000004f6, + 0x00000502, 0x0000050a, 0x0000051a, 0x00000527, + 0x0000052f, 0x00000547, 0x0000056b, 0x0000057d, + 0x00000593, 0x0000059b, 0x000005ae, 0x000005be, + 0x000005c7, 0x000005dd, 0x0000061c, } // Size: 132 bytes -const frData string = "" + // Size: 1568 bytes +const frData string = "" + // Size: 1564 bytes "\x02L’exploitation du service %[1]s coûte cher. Dans la mesure où ne nou" + "s voulons enregistrer aucun renseignement personnel à votre sujet, il n’" + "y ni compte ni facturation pour ce service. Mais si vous souhaitez toute" + @@ -259,25 +259,24 @@ const frData string = "" + // Size: 1568 bytes "\u00a0: %[2]s\x02À propos\x02Erreur d’initialisation\x02Impossible de tr" + "ouver un agent d’authentification polkit. Veuillez en exécuter un et res" + "sayer.\x02L’agent d’authentification est manquant\x02Impossible de se co" + - "nnecter à %[1]s\u00a0: %[2]v\x02Erreur du démarrage du RPV\x02Une erreur" + - " est survenue lors de l'initialisation de %[1]s\u00a0: %[2]v\x02Vérifica" + - "tion de l’état…\x02Activer\x02Désactiver\x02Aide…\x02Faire un don…\x02À " + - "propos…\x02Quitter\x02Acheminer le trafic par\x02Utiliser la passerelle " + - "%[1]s %[2]v\x0a\x02%[1]s est activé\x02%[1]s est désactivé\x02Annuler" + - "\x02Connexion à %[1]s\x02Arrêt de %[1]s\x02Ressayer\x02%[1]s bloque Inte" + - "rnet" + "nnecter à %[1]s\u00a0: %[2]v\x02Erreur du démarrage du RPV\x02Vérificati" + + "on de l’état…\x02Activer\x02Désactiver\x02Aide…\x02Faire un don…\x02À pr" + + "opos…\x02Quitter\x02Acheminer le trafic par\x02Utiliser la passerelle %[" + + "1]s %[2]v\x0a\x02%[1]s est activé\x02%[1]s est désactivé\x02Annuler\x02C" + + "onnexion à %[1]s\x02Arrêt de %[1]s\x02Ressayer\x02%[1]s bloque Internet" + + "\x02Une erreur est survenue lors de l'initialisation de VPN: %[1]v" var ltIndex = []uint32{ // 27 elements 0x00000000, 0x0000013d, 0x00000146, 0x00000392, 0x00000397, 0x000003aa, 0x00000411, 0x00000436, - 0x0000045f, 0x00000477, 0x000004a0, 0x000004b5, - 0x000004be, 0x000004c8, 0x000004d3, 0x000004df, - 0x000004e7, 0x000004ef, 0x0000050c, 0x00000531, - 0x00000540, 0x00000550, 0x0000055b, 0x00000571, - 0x00000580, 0x00000592, 0x000005ac, + 0x0000045f, 0x00000477, 0x0000048c, 0x00000495, + 0x0000049f, 0x000004aa, 0x000004b6, 0x000004be, + 0x000004c6, 0x000004e3, 0x00000508, 0x00000517, + 0x00000527, 0x00000532, 0x00000548, 0x00000557, + 0x00000569, 0x00000583, 0x000005aa, } // Size: 132 bytes -const ltData string = "" + // Size: 1452 bytes +const ltData string = "" + // Size: 1450 bytes "\x02%[1]s paslaugą brangiai kainuoja išlaikyti. Kadangi nenorime saugoti" + " jūsų asmeninės informacijos, todėl nėra jokių paskyrų ar apmokestinimo " + "už šią paslaugą. Tačiau, jei norite, kad paslauga būtų teikiama ir tolia" + @@ -294,23 +293,23 @@ const ltData string = "" + // Size: 1452 bytes "imo klaida\x02Nepavyko rasti politikos rinkinio tapatybės nustatymo agen" + "to. Paleiskite jį ir bandykite dar kartą.\x02Trūksta tapatybės nustatymo" + " agento\x02Nepavyksta prisijungti prie %[1]s: %[2]v\x02Klaida paleidžian" + - "t VPN\x02Inicijuojant %[1]s, įvyko klaida: %[2]v\x02Tikrinama būsena..." + - "\x02Įjungti\x02Išjungti\x02Pagalba...\x02Paaukoti...\x02Apie...\x02Išeit" + - "i\x02Siųsti duomenų srautą per\x02Naudoti %[1]s %[2]v tinklų sietuvą\x02" + - "%[1]s įjungta\x02%[1]s išjungta\x02Atsisakyti\x02Jungiamasi prie %[1]s" + - "\x02Stabdoma %[1]s\x02Bandyti iš naujo\x02%[1]s blokuoja internetą" + "t VPN\x02Tikrinama būsena...\x02Įjungti\x02Išjungti\x02Pagalba...\x02Paa" + + "ukoti...\x02Apie...\x02Išeiti\x02Siųsti duomenų srautą per\x02Naudoti %[" + + "1]s %[2]v tinklų sietuvą\x02%[1]s įjungta\x02%[1]s išjungta\x02Atsisakyt" + + "i\x02Jungiamasi prie %[1]s\x02Stabdoma %[1]s\x02Bandyti iš naujo\x02%[1]" + + "s blokuoja internetą\x02Inicijuojant VPN, įvyko klaida: %[1]v" var nlIndex = []uint32{ // 27 elements 0x00000000, 0x0000010c, 0x00000114, 0x00000356, 0x0000035b, 0x0000036d, 0x000003bc, 0x000003d9, - 0x000003fd, 0x0000041f, 0x00000468, 0x0000047e, - 0x0000048a, 0x00000497, 0x0000049f, 0x000004aa, - 0x000004b2, 0x000004ba, 0x000004cd, 0x000004e9, - 0x000004f3, 0x000004fd, 0x00000507, 0x0000051b, - 0x00000531, 0x00000542, 0x0000055f, + 0x000003fd, 0x0000041f, 0x00000435, 0x00000441, + 0x0000044e, 0x00000456, 0x00000461, 0x00000469, + 0x00000471, 0x00000484, 0x000004a0, 0x000004aa, + 0x000004b4, 0x000004be, 0x000004d2, 0x000004e8, + 0x000004f9, 0x00000516, 0x0000055d, } // Size: 132 bytes -const nlData string = "" + // Size: 1375 bytes +const nlData string = "" + // Size: 1373 bytes "\x02De %[1]s dienst is kostbaar om te onderhouden. Omdat we geen persoon" + "lijke informatie over u willen bijhouden, zijn er geen accounts of betal" + "ingen voor deze dienst. Om deze dienst in leven te houden, overweeg ten " + @@ -326,24 +325,24 @@ const nlData string = "" + // Size: 1375 bytes "reld.\x0a\x0a\x0a%[1]v versie: %[2]s\x02Over\x02Initialisatiefout\x02Kan" + " geen polkit authenticatieagent vinden. Voer er een uit en probeer opnie" + "uw.\x02Authenticatieagent ontbreekt\x02Kan niet verbinden met %[1]s: %[2" + - "]v\x02Fout bij het opstarten van de VPN\x02Er heeft zich een fout voorge" + - "daan bij het initialiseren van %[1]s: %[2]v\x02Status controleren...\x02" + - "Inschakelen\x02Uitschakelen\x02Hulp...\x02Doneren...\x02Over...\x02Stopp" + - "en\x02Stuur verkeer door\x02Gebruik %[1]s %[2]v gateway\x02%[1]s aan\x02" + - "%[1]s uit\x02Annuleren\x02Verbinden met %[1]s\x02%[1]s aan het stoppen" + - "\x02Opnieuw proberen\x02%[1]s blokkeert het internet" + "]v\x02Fout bij het opstarten van de VPN\x02Status controleren...\x02Insc" + + "hakelen\x02Uitschakelen\x02Hulp...\x02Doneren...\x02Over...\x02Stoppen" + + "\x02Stuur verkeer door\x02Gebruik %[1]s %[2]v gateway\x02%[1]s aan\x02%[" + + "1]s uit\x02Annuleren\x02Verbinden met %[1]s\x02%[1]s aan het stoppen\x02" + + "Opnieuw proberen\x02%[1]s blokkeert het internet\x02Er heeft zich een fo" + + "ut voorgedaan bij het initialiseren van VPN: %[1]v" var pt_BRIndex = []uint32{ // 27 elements 0x00000000, 0x00000134, 0x00000147, 0x0000039f, 0x000003a5, 0x000003bd, 0x0000042e, 0x00000459, - 0x00000483, 0x00000499, 0x000004cc, 0x000004e2, - 0x000004e8, 0x000004f1, 0x000004fa, 0x00000510, - 0x00000519, 0x0000051e, 0x0000053c, 0x0000055a, - 0x0000056d, 0x00000583, 0x0000058c, 0x0000059f, - 0x000005ad, 0x000005be, 0x000005e0, + 0x00000483, 0x00000499, 0x000004af, 0x000004b5, + 0x000004be, 0x000004c7, 0x000004dd, 0x000004e6, + 0x000004eb, 0x00000509, 0x00000527, 0x0000053a, + 0x00000550, 0x00000559, 0x0000056c, 0x0000057a, + 0x0000058b, 0x000005ad, 0x000005de, } // Size: 132 bytes -const pt_BRData string = "" + // Size: 1504 bytes +const pt_BRData string = "" + // Size: 1502 bytes "\x02O serviço %[1]s tem um custo para ser mantido. Como não queremos gua" + "rdar suas informações pessoais, não temos contas de usuário e não cobram" + "os por este serviço. Mas se você quiser que este serviço continue, faça " + @@ -360,11 +359,11 @@ const pt_BRData string = "" + // Size: 1504 bytes "\x02Erro na inicialização\x02Não foi possível encontrar um agente de aut" + "enticação polkit. Por favor, execute um agente e tente novamente.\x02Um " + "agente de autenticação está faltando\x02Não é possível conectar a %[1]s:" + - " %[2]v\x02Erro ao iniciar a VPN\x02Um erro ocorreu na inicialização de %" + - "[1]s: %[2]v\x02Verificando estado...\x02Ligar\x02Desligar\x02Ajuda..." + - "\x02Fazer uma doação...\x02Sobre...\x02Sair\x02Rotear o tráfego através " + - "de\x02Usar o gateway %[2]v de %[1]s\x02%[1]s está ligada\x02%[1]s está d" + - "esligada\x02Cancelar\x02Conectando a %[1]s\x02Parando %[1]s\x02Tentar no" + - "vamente\x02%[1]s está bloqueando a Internet" + " %[2]v\x02Erro ao iniciar a VPN\x02Verificando estado...\x02Ligar\x02Des" + + "ligar\x02Ajuda...\x02Fazer uma doação...\x02Sobre...\x02Sair\x02Rotear o" + + " tráfego através de\x02Usar o gateway %[2]v de %[1]s\x02%[1]s está ligad" + + "a\x02%[1]s está desligada\x02Cancelar\x02Conectando a %[1]s\x02Parando %" + + "[1]s\x02Tentar novamente\x02%[1]s está bloqueando a Internet\x02Um erro " + + "ocorreu na inicialização de VPN: %[1]v" - // Total table size 13910 bytes (13KiB); checksum: 87E5E801 + // Total table size 13890 bytes (13KiB); checksum: 25F68812 diff --git a/cmd/bitmask-vpn/main.go b/cmd/bitmask-vpn/main.go new file mode 100644 index 0000000..fb3fd1f --- /dev/null +++ b/cmd/bitmask-vpn/main.go @@ -0,0 +1,76 @@ +// Copyright (C) 2018 LEAP +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +package main + +import ( + "flag" + "fmt" + "log" + "os" + "path" + "runtime" + + "0xacab.org/leap/bitmask-systray/pkg/config" + "0xacab.org/leap/bitmask-systray/pkg/systray" + "github.com/jmshal/go-locale" + "golang.org/x/text/message" +) + +const ( + provider = "riseup.net" + applicationName = "RiseupVPN" + logFile = "systray.log" +) + +var version string + +func main() { + // on OSX sometimes the systray doesn't work (bitmask-systray#52) + // locking the main thread into an OS thread fixes the problem + runtime.LockOSThread() + + logger, err := config.ConfigureLogger(path.Join(config.Path, logFile)) + if err != nil { + log.Println("Can't configure logger: ", err) + } else { + defer logger.Close() + } + + conf := systray.ParseConfig() + + flag.BoolVar(&conf.SelectGateway, "select-gateway", false, "Enable gateway selection") + versionFlag := flag.Bool("version", false, "Version of the bitmask-systray") + flag.Parse() + if *versionFlag { + fmt.Println(version) + os.Exit(0) + } + + conf.Provider = provider + conf.ApplicationName = applicationName + conf.Version = version + conf.Printer = initPrinter() + systray.Run(conf) +} + +func initPrinter() *message.Printer { + locale, err := go_locale.DetectLocale() + if err != nil { + log.Println("Error detecting the system locale: ", err) + } + + return message.NewPrinter(message.MatchLanguage(locale, "en")) +} diff --git a/locales/bn/messages.gotext.json b/locales/bn/messages.gotext.json index a2f063f..9bcbb29 100644 --- a/locales/bn/messages.gotext.json +++ b/locales/bn/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "An error has ocurred initializing VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "ভিপিএন চালু করতে ত্রুটি হয়েছে" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "An error has ocurred initializing {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "অবস্থা পরিক্ষা করা হচ্ছে ..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/en-GB/messages.gotext.json b/locales/en-GB/messages.gotext.json index e7e4edf..b4cacaa 100644 --- a/locales/en-GB/messages.gotext.json +++ b/locales/en-GB/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "An error has occurred initialising VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Error starting VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "An error has occurred initialising {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Checking status..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/en-US/messages.gotext.json b/locales/en-US/messages.gotext.json index f1d2084..d8e72cc 100644 --- a/locales/en-US/messages.gotext.json +++ b/locales/en-US/messages.gotext.json @@ -3,6 +3,26 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "An error has ocurred initializing VPN: {Err}", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ], + "fuzzy": true + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -16,7 +36,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ], "fuzzy": true @@ -43,7 +63,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -51,7 +71,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -59,7 +79,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -118,7 +138,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -139,34 +159,6 @@ "fuzzy": true }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "An error has ocurred initializing {ApplicationName}: {Err}", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ], - "fuzzy": true - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Checking status..." @@ -224,7 +216,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -249,7 +241,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ], "fuzzy": true @@ -266,7 +258,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ], "fuzzy": true @@ -288,7 +280,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ], "fuzzy": true @@ -305,7 +297,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ], "fuzzy": true @@ -327,7 +319,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ], "fuzzy": true diff --git a/locales/es-ES/messages.gotext.json b/locales/es-ES/messages.gotext.json index 28122b8..0cf3e1e 100644 --- a/locales/es-ES/messages.gotext.json +++ b/locales/es-ES/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Ha ocurrido un error inicializando VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Error iniciando VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Ha ocurrido un error inicializando {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Comprobando estado..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/es/messages.gotext.json b/locales/es/messages.gotext.json index 606134d..dc4f16f 100644 --- a/locales/es/messages.gotext.json +++ b/locales/es/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Un error ha ocurrido inicializando VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Error arrancando la VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Un error ha ocurrido inicializando {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Comprobando el estado..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/fr/messages.gotext.json b/locales/fr/messages.gotext.json index 7acdd75..718898d 100644 --- a/locales/fr/messages.gotext.json +++ b/locales/fr/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Une erreur est survenue lors de l'initialisation de VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Erreur du démarrage du RPV" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Une erreur est survenue lors de l'initialisation de {ApplicationName} : {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Vérification de l’état…" @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/lt/messages.gotext.json b/locales/lt/messages.gotext.json index aac9c46..601ba13 100644 --- a/locales/lt/messages.gotext.json +++ b/locales/lt/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Inicijuojant VPN, įvyko klaida: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Klaida paleidžiant VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Inicijuojant {ApplicationName}, įvyko klaida: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Tikrinama būsena..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/nl/messages.gotext.json b/locales/nl/messages.gotext.json index cadc77c..296f77e 100644 --- a/locales/nl/messages.gotext.json +++ b/locales/nl/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Er heeft zich een fout voorgedaan bij het initialiseren van VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Fout bij het opstarten van de VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Er heeft zich een fout voorgedaan bij het initialiseren van {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Status controleren..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/locales/pt-BR/messages.gotext.json b/locales/pt-BR/messages.gotext.json index cd879f0..b83033c 100644 --- a/locales/pt-BR/messages.gotext.json +++ b/locales/pt-BR/messages.gotext.json @@ -3,6 +3,24 @@ "messages": [ { "id": [ + "errorMsg", + "An error has ocurred initializing the VPN: {Err}" + ], + "message": "An error has ocurred initializing the VPN: {Err}", + "translation": "Um erro ocorreu na inicialização de VPN: {Err}", + "placeholders": [ + { + "id": "Err", + "string": "%[1]v", + "type": "error", + "underlyingType": "interface{Error() string}", + "argNum": 1, + "expr": "err" + } + ] + }, + { + "id": [ "donationText", "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?" ], @@ -15,7 +33,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" } ] }, @@ -38,7 +56,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName", @@ -46,7 +64,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "ApplicationName_1", @@ -54,7 +72,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Version", @@ -103,7 +121,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "n.conf.ApplicationName" }, { "id": "Err", @@ -121,32 +139,6 @@ "translation": "Erro ao iniciar a VPN" }, { - "id": [ - "errorMsg", - "An error has ocurred initializing {ApplicationName}: {Err}" - ], - "message": "An error has ocurred initializing {ApplicationName}: {Err}", - "translation": "Um erro ocorreu na inicialização de {ApplicationName}: {Err}", - "placeholders": [ - { - "id": "ApplicationName", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "applicationName" - }, - { - "id": "Err", - "string": "%[2]v", - "type": "error", - "underlyingType": "interface{Error() string}", - "argNum": 2, - "expr": "err" - } - ] - }, - { "id": "Checking status...", "message": "Checking status...", "translation": "Verificando estado..." @@ -197,7 +189,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" }, { "id": "City", @@ -220,7 +212,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -235,7 +227,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -255,7 +247,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -270,7 +262,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] }, @@ -290,7 +282,7 @@ "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "applicationName" + "expr": "bt.conf.ApplicationName" } ] } diff --git a/pkg/bitmask/autostart.go b/pkg/bitmask/autostart.go new file mode 100644 index 0000000..ebab428 --- /dev/null +++ b/pkg/bitmask/autostart.go @@ -0,0 +1,32 @@ +// Copyright (C) 2018 LEAP +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +package bitmask + +// Autostart holds the functions to enable and disable the application autostart +type Autostart interface { + Disable() error + Enable() error +} + +type dummyAutostart struct{} + +func (a *dummyAutostart) Disable() error { + return nil +} + +func (a *dummyAutostart) Enable() error { + return nil +} diff --git a/bitmask/bitmask.go b/pkg/bitmask/bitmask.go index a7aabaa..a7aabaa 100644 --- a/bitmask/bitmask.go +++ b/pkg/bitmask/bitmask.go diff --git a/bitmaskd.go b/pkg/bitmask/bitmaskd.go index ace9ee7..ad4da31 100644 --- a/bitmaskd.go +++ b/pkg/bitmask/bitmaskd.go @@ -14,21 +14,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package bitmask import ( "errors" "log" - "0xacab.org/leap/bitmask-systray/bitmask" - bitmaskd "0xacab.org/leap/bitmask-systray/bitmaskd" + "0xacab.org/leap/bitmask-systray/pkg/bitmaskd" + "golang.org/x/text/message" ) const ( notRunning = `Is bitmaskd running? Start bitmask and try again.` ) -func initBitmask() (bitmask.Bitmask, error) { +// Init bitmask +func Init(printer *message.Printer) (Bitmask, error) { b, err := bitmaskd.Init() if err != nil { log.Printf("An error ocurred starting bitmaskd: %v", err) @@ -37,6 +38,7 @@ func initBitmask() (bitmask.Bitmask, error) { return b, err } -func newAutostart(appName string, iconPath string) autostart { +// NewAutostart creates a handler for the autostart of your platform +func NewAutostart(appName string, iconPath string) Autostart { return &dummyAutostart{} } diff --git a/standalone.go b/pkg/bitmask/standalone.go index 0808da6..f3f7602 100644 --- a/standalone.go +++ b/pkg/bitmask/standalone.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package bitmask import ( "errors" @@ -24,25 +24,27 @@ import ( "path/filepath" "regexp" - "0xacab.org/leap/bitmask-systray/bitmask" - standalone "0xacab.org/leap/bitmask-systray/standalone" + "0xacab.org/leap/bitmask-systray/pkg/standalone" pmautostart "github.com/ProtonMail/go-autostart" + "golang.org/x/text/message" ) const ( - errorMsg = `An error has ocurred initializing %s: %v` + errorMsg = `An error has ocurred initializing the VPN: %v` ) -func initBitmask() (bitmask.Bitmask, error) { +// Init bitmask +func Init(printer *message.Printer) (Bitmask, error) { b, err := standalone.Init() if err != nil { log.Printf("An error ocurred starting standalone bitmask: %v", err) - err = errors.New(printer.Sprintf(errorMsg, applicationName, err)) + err = errors.New(printer.Sprintf(errorMsg, err)) } return b, err } -func newAutostart(appName string, iconPath string) autostart { +// NewAutostart creates a handler for the autostart of your platform +func NewAutostart(appName string, iconPath string) Autostart { exec := os.Args if os.Getenv("SNAP") != "" { re := regexp.MustCompile("/snap/([^/]*)/") diff --git a/bitmaskd/events.go b/pkg/bitmaskd/events.go index e97804c..3c8bb2c 100644 --- a/bitmaskd/events.go +++ b/pkg/bitmaskd/events.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package bitmaskd import ( "log" diff --git a/bitmaskd/main.go b/pkg/bitmaskd/main.go index 2ff2268..f2ca650 100644 --- a/bitmaskd/main.go +++ b/pkg/bitmaskd/main.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package bitmaskd import ( "bytes" @@ -25,7 +25,7 @@ import ( "path" "time" - "0xacab.org/leap/bitmask-systray/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/config" ) const ( @@ -150,7 +150,7 @@ func parseResponse(resJSON []byte) (interface{}, error) { func getToken() (string, error) { var err error - path := path.Join(bitmask.ConfigPath, "authtoken") + path := path.Join(config.Path, "authtoken") for i := 0; i < 30; i++ { b, err := ioutil.ReadFile(path) if err == nil { diff --git a/bitmaskd/vpn.go b/pkg/bitmaskd/vpn.go index cfbe7df..48ce7dd 100644 --- a/bitmaskd/vpn.go +++ b/pkg/bitmaskd/vpn.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package bitmaskd import ( "errors" diff --git a/bitmask/darwin.go b/pkg/config/darwin.go index b71271e..123060c 100644 --- a/bitmask/darwin.go +++ b/pkg/config/darwin.go @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package config import ( "os" ) -var ConfigPath = os.Getenv("HOME") + "/Library/Preferences/leap" +// Path for the config files +var Path = os.Getenv("HOME") + "/Library/Preferences/leap" diff --git a/pkg/config/logger.go b/pkg/config/logger.go new file mode 100644 index 0000000..09d96b7 --- /dev/null +++ b/pkg/config/logger.go @@ -0,0 +1,31 @@ +// Copyright (C) 2018 LEAP +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +package config + +import ( + "io" + "log" + "os" +) + +//ConfigureLogger to write logs into a file as well as the stderr +func ConfigureLogger(logPath string) (io.Closer, error) { + logFile, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + if err == nil { + log.SetOutput(io.MultiWriter(logFile, os.Stderr)) + } + return logFile, err +} diff --git a/bitmask/unix.go b/pkg/config/unix.go index d276556..7425f5b 100644 --- a/bitmask/unix.go +++ b/pkg/config/unix.go @@ -14,10 +14,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package config import ( "os" ) -var ConfigPath = os.Getenv("HOME") + "/.config/leap" +// Path for the config files +var Path = os.Getenv("HOME") + "/.config/leap" diff --git a/bitmask/windows.go b/pkg/config/windows.go index 221d75b..8977842 100644 --- a/bitmask/windows.go +++ b/pkg/config/windows.go @@ -14,8 +14,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package config import "os" -var ConfigPath = os.Getenv("LOCALAPPDATA") + "\\leap" +// Path for the config files +var Path = os.Getenv("LOCALAPPDATA") + "\\leap" diff --git a/standalone/bonafide.go b/pkg/standalone/bonafide.go index 92c1011..c4d588e 100644 --- a/standalone/bonafide.go +++ b/pkg/standalone/bonafide.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "crypto/tls" diff --git a/standalone/bonafide_integration_test.go b/pkg/standalone/bonafide_integration_test.go index f162eb5..5beb8aa 100644 --- a/standalone/bonafide_integration_test.go +++ b/pkg/standalone/bonafide_integration_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "bytes" diff --git a/standalone/bonafide_test.go b/pkg/standalone/bonafide_test.go index a659e46..7bfcaa0 100644 --- a/standalone/bonafide_test.go +++ b/pkg/standalone/bonafide_test.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "io" diff --git a/standalone/launcher.go b/pkg/standalone/launcher.go index 0a95dd1..4dc4761 100644 --- a/standalone/launcher.go +++ b/pkg/standalone/launcher.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "bytes" diff --git a/standalone/launcher_linux.go b/pkg/standalone/launcher_linux.go index 5266fa1..672eb1f 100644 --- a/standalone/launcher_linux.go +++ b/pkg/standalone/launcher_linux.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "errors" diff --git a/standalone/main.go b/pkg/standalone/main.go index 8f697c0..f7e1976 100644 --- a/standalone/main.go +++ b/pkg/standalone/main.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "io/ioutil" diff --git a/standalone/status.go b/pkg/standalone/status.go index 5a1ee3d..42c4687 100644 --- a/standalone/status.go +++ b/pkg/standalone/status.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "fmt" diff --git a/standalone/testdata/cert b/pkg/standalone/testdata/cert index 4968b3f..4968b3f 100644 --- a/standalone/testdata/cert +++ b/pkg/standalone/testdata/cert diff --git a/standalone/testdata/eip-service.json b/pkg/standalone/testdata/eip-service.json index d5f2413..d5f2413 100644 --- a/standalone/testdata/eip-service.json +++ b/pkg/standalone/testdata/eip-service.json diff --git a/standalone/vpn.go b/pkg/standalone/vpn.go index c3b2693..941d444 100644 --- a/standalone/vpn.go +++ b/pkg/standalone/vpn.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package bitmask +package standalone import ( "io/ioutil" diff --git a/config.go b/pkg/systray/config.go index 4eb5dd3..75a7a8a 100644 --- a/config.go +++ b/pkg/systray/config.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( "encoding/json" @@ -21,7 +21,8 @@ import ( "path" "time" - "0xacab.org/leap/bitmask-systray/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/config" + "golang.org/x/text/message" ) const ( @@ -30,18 +31,24 @@ const ( ) var ( - configPath = path.Join(bitmask.ConfigPath, "systray.json") + configPath = path.Join(config.Path, "systray.json") ) -type systrayConfig struct { +// SystrayConfig holds the configuration of the systray +type SystrayConfig struct { LastNotification time.Time Donated time.Time SelectGateway bool UserStoppedVPN bool + Provider string `json:"-"` + ApplicationName string `json:"-"` + Version string `json:"-"` + Printer *message.Printer `json:"-"` } -func parseConfig() *systrayConfig { - var conf systrayConfig +// ParseConfig reads the configuration from the configuration file +func ParseConfig() *SystrayConfig { + var conf SystrayConfig f, err := os.Open(configPath) if err != nil { @@ -55,30 +62,30 @@ func parseConfig() *systrayConfig { return &conf } -func (c *systrayConfig) setUserStoppedVPN(vpnStopped bool) error { +func (c *SystrayConfig) setUserStoppedVPN(vpnStopped bool) error { c.UserStoppedVPN = vpnStopped return c.save() } -func (c *systrayConfig) hasDonated() bool { +func (c *SystrayConfig) hasDonated() bool { return c.Donated.Add(oneMonth).After(time.Now()) } -func (c *systrayConfig) needsNotification() bool { +func (c *SystrayConfig) needsNotification() bool { return !c.hasDonated() && c.LastNotification.Add(oneDay).Before(time.Now()) } -func (c *systrayConfig) setNotification() error { +func (c *SystrayConfig) setNotification() error { c.LastNotification = time.Now() return c.save() } -func (c *systrayConfig) setDonated() error { +func (c *SystrayConfig) setDonated() error { c.Donated = time.Now() return c.save() } -func (c *systrayConfig) save() error { +func (c *SystrayConfig) save() error { f, err := os.Create(configPath) if err != nil { return err diff --git a/notificator.go b/pkg/systray/notificator.go index c2988be..e23b9d1 100644 --- a/notificator.go +++ b/pkg/systray/notificator.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( "io/ioutil" @@ -44,10 +44,10 @@ By using this application, you agree to the Terms of Service available at https: ) type notificator struct { - conf *systrayConfig + conf *SystrayConfig } -func newNotificator(conf *systrayConfig) *notificator { +func newNotificator(conf *SystrayConfig) *notificator { n := notificator{conf} go n.donations() return &n @@ -57,8 +57,8 @@ func (n *notificator) donations() { for { time.Sleep(time.Hour) if n.conf.needsNotification() { - letsDonate := dialog.Message(printer.Sprintf(donationText, applicationName)). - Title(printer.Sprintf("Donate")). + letsDonate := dialog.Message(n.conf.Printer.Sprintf(donationText, n.conf.ApplicationName)). + Title(n.conf.Printer.Sprintf("Donate")). Icon(getIconPath()). YesNo() n.conf.setNotification() @@ -77,29 +77,29 @@ func (n *notificator) about(version string) { version = string(_version) } } - dialog.Message(printer.Sprintf(aboutText, applicationName, version)). - Title(printer.Sprintf("About")). + dialog.Message(n.conf.Printer.Sprintf(aboutText, n.conf.ApplicationName, version)). + Title(n.conf.Printer.Sprintf("About")). Icon(getIconPath()). Info() } func (n *notificator) initFailure(err error) { dialog.Message(err.Error()). - Title(printer.Sprintf("Initialization error")). + Title(n.conf.Printer.Sprintf("Initialization error")). Icon(getIconPath()). Error() } func (n *notificator) authAgent() { - dialog.Message(printer.Sprintf(missingAuthAgent)). - Title(printer.Sprintf("Missing authentication agent")). + dialog.Message(n.conf.Printer.Sprintf(missingAuthAgent)). + Title(n.conf.Printer.Sprintf("Missing authentication agent")). Icon(getIconPath()). Error() } func (n *notificator) errorStartingVPN(err error) { - dialog.Message(printer.Sprintf(errorStartingVPN, applicationName, err)). - Title(printer.Sprintf("Error starting VPN")). + dialog.Message(n.conf.Printer.Sprintf(errorStartingVPN, n.conf.ApplicationName, err)). + Title(n.conf.Printer.Sprintf("Error starting VPN")). Icon(getIconPath()). Error() } diff --git a/pid.go b/pkg/systray/pid.go index 2c283ac..6a1b32c 100644 --- a/pid.go +++ b/pkg/systray/pid.go @@ -1,4 +1,4 @@ -package main +package systray import ( "fmt" @@ -10,11 +10,11 @@ import ( "strings" "syscall" - "0xacab.org/leap/bitmask-systray/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/config" "github.com/mitchellh/go-ps" ) -var pidFile = filepath.Join(bitmask.ConfigPath, "systray.pid") +var pidFile = filepath.Join(config.Path, "systray.pid") func acquirePID() error { pid := syscall.Getpid() diff --git a/pid_test.go b/pkg/systray/pid_test.go index 2c92641..dda8384 100644 --- a/pid_test.go +++ b/pkg/systray/pid_test.go @@ -1,4 +1,4 @@ -package main +package systray import ( "syscall" diff --git a/main.go b/pkg/systray/run.go index 2683a88..0457ed4 100644 --- a/main.go +++ b/pkg/systray/run.go @@ -13,61 +13,25 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( - "flag" - "fmt" - "io" "log" "os" - "path" - "runtime" - "0xacab.org/leap/bitmask-systray/bitmask" - "github.com/jmshal/go-locale" - "golang.org/x/text/message" + "0xacab.org/leap/bitmask-systray/pkg/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/config" ) -const ( - provider = "riseup.net" - applicationName = "RiseupVPN" -) - -var version string -var printer *message.Printer - -func main() { - // on OSX sometimes the systray doesn't work (bitmask-systray#52) - // locking the main thread into an OS thread fixes the problem - runtime.LockOSThread() - - logger, err := configureLogger() - if err != nil { - log.Println("Can't configure logger: ", err) - } else { - defer logger.Close() - } - - conf := parseConfig() - initPrinter() - - flag.BoolVar(&conf.SelectGateway, "select-gateway", false, "Enable gateway selection") - versionFlag := flag.Bool("version", false, "Version of the bitmask-systray") - flag.Parse() - if *versionFlag { - fmt.Println(version) - os.Exit(0) - } - +func Run(conf *SystrayConfig) { bt := bmTray{conf: conf} go initialize(conf, &bt) bt.start() } -func initialize(conf *systrayConfig, bt *bmTray) { - if _, err := os.Stat(bitmask.ConfigPath); os.IsNotExist(err) { - os.MkdirAll(bitmask.ConfigPath, os.ModePerm) +func initialize(conf *SystrayConfig, bt *bmTray) { + if _, err := os.Stat(config.Path); os.IsNotExist(err) { + os.MkdirAll(config.Path, os.ModePerm) } err := acquirePID() @@ -78,7 +42,7 @@ func initialize(conf *systrayConfig, bt *bmTray) { notify := newNotificator(conf) - b, err := initBitmask() + b, err := bitmask.Init(conf.Printer) if err != nil { notify.initFailure(err) return @@ -87,7 +51,7 @@ func initialize(conf *systrayConfig, bt *bmTray) { go checkAndStartBitmask(b, notify, conf) go listenSignals(b) - as := newAutostart(applicationName, getIconPath()) + as := bitmask.NewAutostart(conf.ApplicationName, getIconPath()) err = as.Enable() if err != nil { log.Printf("Error enabling autostart: %v", err) @@ -95,7 +59,7 @@ func initialize(conf *systrayConfig, bt *bmTray) { bt.loop(b, notify, as) } -func checkAndStartBitmask(b bitmask.Bitmask, notify *notificator, conf *systrayConfig) { +func checkAndStartBitmask(b bitmask.Bitmask, notify *notificator, conf *SystrayConfig) { err := checkAndInstallHelpers(b, notify) if err != nil { log.Printf("Is bitmask running? %v", err) @@ -128,29 +92,12 @@ func checkAndInstallHelpers(b bitmask.Bitmask, notify *notificator) error { return nil } -func maybeStartVPN(b bitmask.Bitmask, conf *systrayConfig) error { +func maybeStartVPN(b bitmask.Bitmask, conf *SystrayConfig) error { if conf.UserStoppedVPN { return nil } - err := b.StartVPN(provider) + err := b.StartVPN(conf.Provider) conf.setUserStoppedVPN(false) return err } - -func configureLogger() (io.Closer, error) { - logFile, err := os.OpenFile(path.Join(bitmask.ConfigPath, "systray.log"), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) - if err == nil { - log.SetOutput(io.MultiWriter(logFile, os.Stderr)) - } - return logFile, err -} - -func initPrinter() { - locale, err := go_locale.DetectLocale() - if err != nil { - log.Println("Error detecting the system locale: ", err) - } - - printer = message.NewPrinter(message.MatchLanguage(locale, "en")) -} diff --git a/signal_unix.go b/pkg/systray/signal_unix.go index 37b3908..06b59ae 100644 --- a/signal_unix.go +++ b/pkg/systray/signal_unix.go @@ -14,14 +14,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( "os" "os/signal" "syscall" - "0xacab.org/leap/bitmask-systray/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/bitmask" ) func listenSignals(bm bitmask.Bitmask) { diff --git a/signal_windows.go b/pkg/systray/signal_windows.go index 7e0eb3d..f96212c 100644 --- a/signal_windows.go +++ b/pkg/systray/signal_windows.go @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( - "0xacab.org/leap/bitmask-systray/bitmask" + "0xacab.org/leap/bitmask-systray/pkg/bitmask" ) func listenSignals(bm bitmask.Bitmask) { diff --git a/systray.go b/pkg/systray/systray.go index c6c75e4..3505958 100644 --- a/systray.go +++ b/pkg/systray/systray.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -package main +package systray import ( "fmt" @@ -22,15 +22,15 @@ import ( "os/signal" "time" - "0xacab.org/leap/bitmask-systray/bitmask" "0xacab.org/leap/bitmask-systray/icon" + "0xacab.org/leap/bitmask-systray/pkg/bitmask" "github.com/getlantern/systray" "github.com/skratchdot/open-golang/open" ) type bmTray struct { bm bitmask.Bitmask - conf *systrayConfig + conf *SystrayConfig notify *notificator waitCh chan bool mStatus *systray.MenuItem @@ -41,7 +41,7 @@ type bmTray struct { mAbout *systray.MenuItem mQuit *systray.MenuItem activeGateway *gatewayTray - autostart autostart + autostart bitmask.Autostart } type gatewayTray struct { @@ -61,6 +61,7 @@ func (bt *bmTray) onExit() { } func (bt *bmTray) onReady() { + printer := bt.conf.Printer systray.SetIcon(icon.Off) bt.mStatus = systray.AddMenuItem(printer.Sprintf("Checking status..."), "") @@ -83,7 +84,7 @@ func (bt *bmTray) onReady() { bt.mQuit = systray.AddMenuItem(printer.Sprintf("Quit"), "") } -func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as autostart) { +func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as bitmask.Autostart) { bt.bm = bm bt.notify = notify bt.autostart = as @@ -107,7 +108,7 @@ func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as autostart) { case <-bt.mTurnOn.ClickedCh: log.Println("on") bt.changeStatus("starting") - bt.bm.StartVPN(provider) + bt.bm.StartVPN(bt.conf.Provider) bt.conf.setUserStoppedVPN(false) case <-bt.mTurnOff.ClickedCh: log.Println("off") @@ -122,11 +123,11 @@ func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as autostart) { open.Run("https://riseup.net/vpn/donate") case <-bt.mAbout.ClickedCh: bitmaskVersion, err := bt.bm.Version() - versionStr := version + versionStr := bt.conf.Version if err != nil { log.Printf("Error getting version: %v", err) } else if bitmaskVersion != "" { - versionStr = fmt.Sprintf("%s (bitmaskd %s)", version, bitmaskVersion) + versionStr = fmt.Sprintf("%s (bitmaskd %s)", bt.conf.Version, bitmaskVersion) } bt.notify.about(versionStr) @@ -152,16 +153,16 @@ func (bt *bmTray) loop(bm bitmask.Bitmask, notify *notificator, as autostart) { } func (bt *bmTray) addGateways() { - gatewayList, err := bt.bm.ListGateways(provider) + gatewayList, err := bt.bm.ListGateways(bt.conf.Provider) if err != nil { log.Printf("Gateway initialization error: %v", err) return } - mGateway := systray.AddMenuItem(printer.Sprintf("Route traffic through"), "") + mGateway := systray.AddMenuItem(bt.conf.Printer.Sprintf("Route traffic through"), "") mGateway.Disable() for i, city := range gatewayList { - menuItem := systray.AddMenuItem(city, printer.Sprintf("Use %s %v gateway", applicationName, city)) + menuItem := systray.AddMenuItem(city, bt.conf.Printer.Sprintf("Use %s %v gateway", bt.conf.ApplicationName, city)) gateway := gatewayTray{menuItem, city} if i == 0 { @@ -191,6 +192,7 @@ func (bt *bmTray) addGateways() { } func (bt *bmTray) changeStatus(status string) { + printer := bt.conf.Printer if bt.waitCh != nil { bt.waitCh <- true bt.waitCh = nil @@ -201,14 +203,14 @@ func (bt *bmTray) changeStatus(status string) { case "on": systray.SetIcon(icon.On) bt.mTurnOff.SetTitle(printer.Sprintf("Turn off")) - statusStr = printer.Sprintf("%s on", applicationName) + statusStr = printer.Sprintf("%s on", bt.conf.ApplicationName) bt.mTurnOn.Hide() bt.mTurnOff.Show() case "off": systray.SetIcon(icon.Off) bt.mTurnOn.SetTitle(printer.Sprintf("Turn on")) - statusStr = printer.Sprintf("%s off", applicationName) + statusStr = printer.Sprintf("%s off", bt.conf.ApplicationName) bt.mTurnOn.Show() bt.mTurnOff.Hide() @@ -216,14 +218,14 @@ func (bt *bmTray) changeStatus(status string) { bt.waitCh = make(chan bool) go bt.waitIcon() bt.mTurnOff.SetTitle(printer.Sprintf("Cancel")) - statusStr = printer.Sprintf("Connecting to %s", applicationName) + statusStr = printer.Sprintf("Connecting to %s", bt.conf.ApplicationName) bt.mTurnOn.Hide() bt.mTurnOff.Show() case "stopping": bt.waitCh = make(chan bool) go bt.waitIcon() - statusStr = printer.Sprintf("Stopping %s", applicationName) + statusStr = printer.Sprintf("Stopping %s", bt.conf.ApplicationName) bt.mTurnOn.Hide() bt.mTurnOff.Hide() @@ -231,7 +233,7 @@ func (bt *bmTray) changeStatus(status string) { systray.SetIcon(icon.Blocked) bt.mTurnOn.SetTitle(printer.Sprintf("Retry")) bt.mTurnOff.SetTitle(printer.Sprintf("Turn off")) - statusStr = printer.Sprintf("%s blocking internet", applicationName) + statusStr = printer.Sprintf("%s blocking internet", bt.conf.ApplicationName) bt.mTurnOn.Show() bt.mTurnOff.Show() } diff --git a/tools/transifex/Makefile b/tools/transifex/Makefile new file mode 100644 index 0000000..bf5bf2b --- /dev/null +++ b/tools/transifex/Makefile @@ -0,0 +1,8 @@ + +all: build generate_json + +build: + go build + +generate_json: + ./transifex g2t ../../locales/en-US/out.gotext.json messages.json diff --git a/transifex/main.go b/tools/transifex/main.go index 37bae97..37bae97 100644 --- a/transifex/main.go +++ b/tools/transifex/main.go diff --git a/transifex/messages.json b/tools/transifex/messages.json index 19610a8..40a4145 100644 --- a/transifex/messages.json +++ b/tools/transifex/messages.json @@ -19,7 +19,7 @@ "Use {ApplicationName} {City} gateway": "Use {ApplicationName} {City} gateway", "aboutText": "{ApplicationName} is an easy, fast, and secure VPN service from riseup.net. {ApplicationName} does not require a user account, keep logs, or track you in any way.\n\t \nThis service is paid for entirely by donations from users like you. Please donate at https://riseup.net/vpn/donate.\n\t\t\nBy using this application, you agree to the Terms of Service available at https://riseup.net/tos. This service is provide as-is, without any warranty, and is intended for people who work to make the world a better place.\n\n\n{ApplicationName_1} version: {Version}", "donationText": "The {ApplicationName} service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\t\nDo you want to donate now?", - "errorMsg": "An error has ocurred initializing {ApplicationName}: {Err}", + "errorMsg": "An error has ocurred initializing the VPN: {Err}", "errorStartingVPN": "Can't connect to {ApplicationName}: {Err}", "missingAuthAgent": "Could not find a polkit authentication agent. Please run one and try again.", "{ApplicationName} blocking internet": "{ApplicationName} blocking internet", diff --git a/transifex/Makefile b/transifex/Makefile deleted file mode 100644 index aad1d3e..0000000 --- a/transifex/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -all: build generate_json - -build: - go build - -generate_json: - ./transifex g2t ../locales/en-US/out.gotext.json messages.json |