summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-06-04 20:39:35 +0200
committerRuben Pollan <meskio@sindominio.net>2018-06-04 20:39:35 +0200
commit8c3ba3a2d6a3db9d277c9d6b7532d125b39e1676 (patch)
treeb0ee3f0075f6d83346eef01c7f65d0542088165a
parent67e258a7a2217300a43c8aa0636bfe4d4aef6bdb (diff)
[feat] notify if it can't start the VPN0.0.1
- Resolves: #35
-rw-r--r--catalog.go108
-rw-r--r--locales/en-US/messages.gotext.json35
-rw-r--r--locales/es-ES/messages.gotext.json31
-rw-r--r--locales/pt-BR/messages.gotext.json31
-rw-r--r--main.go14
-rw-r--r--notificator.go8
6 files changed, 169 insertions, 58 deletions
diff --git a/catalog.go b/catalog.go
index e0558c6..b559ca3 100644
--- a/catalog.go
+++ b/catalog.go
@@ -37,44 +37,46 @@ func init() {
}
var messageKeyToIndex = map[string]int{
- "%s blocking internet": 24,
+ "%s blocking internet": 26,
"%s is an easy, fast, and secure VPN service from riseup.net. %s does not require a user account, keep logs, or track you in any way.\n\t \nThis service paid for entirely by donations from users like you. Please donate at riseup.net/vpn/donate.\n\t\t\nBy using this application, you agree to the Terms of Service available at 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.": 2,
- "%s off": 20,
- "%s on": 19,
+ "%s off": 22,
+ "%s on": 21,
"About": 3,
- "About...": 15,
+ "About...": 17,
+ "Can't connect to %s: %v": 8,
"Can't contact bitmask": 5,
- "Cancel": 11,
- "Cancel connection to %s": 12,
- "Checking status...": 8,
- "Connecting to %s": 21,
+ "Cancel": 13,
+ "Cancel connection to %s": 14,
+ "Checking status...": 10,
+ "Connecting to %s": 23,
"Could not find a polkit authentication agent. Please run one and try again.": 6,
- "Donate": 1,
- "Donate...": 14,
- "Help...": 13,
+ "Donate": 1,
+ "Donate...": 16,
+ "Error starting VPN": 9,
+ "Help...": 15,
"Is bitmaskd running? Start bitmask and try again.": 4,
"Missing authentication agent": 7,
- "Quit": 16,
- "Retry": 23,
- "Route traffic through": 17,
- "Stopping %s": 22,
+ "Quit": 18,
+ "Retry": 25,
+ "Route traffic through": 19,
+ "Stopping %s": 24,
"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": 10,
- "Turn on": 9,
- "Use %s %v gateway": 18,
+ "Turn off": 12,
+ "Turn on": 11,
+ "Use %s %v gateway": 20,
}
-var en_USIndex = []uint32{ // 26 elements
+var en_USIndex = []uint32{ // 28 elements
0x00000000, 0x000000fd, 0x00000104, 0x000002d6,
0x000002dc, 0x0000030e, 0x00000324, 0x00000370,
- 0x0000038d, 0x000003a0, 0x000003a8, 0x000003b1,
- 0x000003b8, 0x000003d3, 0x000003db, 0x000003e5,
- 0x000003ee, 0x000003f3, 0x00000409, 0x00000421,
- 0x0000042a, 0x00000434, 0x00000448, 0x00000457,
- 0x0000045d, 0x00000475,
-} // Size: 128 bytes
+ 0x0000038d, 0x000003ab, 0x000003be, 0x000003d1,
+ 0x000003d9, 0x000003e2, 0x000003e9, 0x00000404,
+ 0x0000040c, 0x00000416, 0x0000041f, 0x00000424,
+ 0x0000043a, 0x00000452, 0x0000045b, 0x00000465,
+ 0x00000479, 0x00000488, 0x0000048e, 0x000004a6,
+} // Size: 136 bytes
-const en_USData string = "" + // Size: 1141 bytes
+const en_USData string = "" + // Size: 1190 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 " +
@@ -88,23 +90,24 @@ const en_USData string = "" + // Size: 1141 bytes
"eople who work to make the world a better place.\x02About\x02Is bitmaskd" +
" running? Start bitmask and try again.\x02Can't contact bitmask\x02Could" +
" not find a polkit authentication agent. Please run one and try again." +
- "\x02Missing authentication agent\x02Checking status...\x02Turn on\x02Tur" +
- "n off\x02Cancel\x02Cancel connection to %[1]s\x02Help...\x02Donate..." +
- "\x02About...\x02Quit\x02Route traffic through\x02Use %[1]s %[2]v gateway" +
- "\x02%[1]s on\x02%[1]s off\x02Connecting to %[1]s\x02Stopping %[1]s\x02Re" +
- "try\x02%[1]s blocking internet"
+ "\x02Missing authentication agent\x02Can't connect to %[1]s: %[2]v\x02Err" +
+ "or starting VPN\x02Checking status...\x02Turn on\x02Turn off\x02Cancel" +
+ "\x02Cancel connection to %[1]s\x02Help...\x02Donate...\x02About...\x02Qu" +
+ "it\x02Route traffic through\x02Use %[1]s %[2]v gateway\x02%[1]s on\x02%[" +
+ "1]s off\x02Connecting to %[1]s\x02Stopping %[1]s\x02Retry\x02%[1]s block" +
+ "ing internet"
-var es_ESIndex = []uint32{ // 26 elements
+var es_ESIndex = []uint32{ // 28 elements
0x00000000, 0x000000ec, 0x000000f1, 0x000002de,
0x000002e8, 0x00000327, 0x00000348, 0x000003af,
- 0x000003d1, 0x000003ea, 0x000003f3, 0x000003fa,
- 0x00000403, 0x00000420, 0x00000429, 0x00000431,
- 0x0000043e, 0x00000445, 0x00000458, 0x00000479,
- 0x00000489, 0x00000497, 0x000004ab, 0x000004c3,
- 0x000004ce, 0x000004e8,
-} // Size: 128 bytes
+ 0x000003d1, 0x000003f4, 0x0000040c, 0x00000425,
+ 0x0000042e, 0x00000435, 0x0000043e, 0x0000045b,
+ 0x00000464, 0x0000046c, 0x00000479, 0x00000480,
+ 0x00000493, 0x000004b4, 0x000004c4, 0x000004d2,
+ 0x000004e6, 0x000004fe, 0x00000509, 0x00000523,
+} // Size: 136 bytes
-const es_ESData string = "" + // Size: 1256 bytes
+const es_ESData string = "" + // Size: 1315 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" +
@@ -119,21 +122,22 @@ const es_ESData string = "" + // Size: 1256 bytes
" corriendo bitmaskd? Arranca bitmask y prueba de nuevo.\x02No se pudo co" +
"ntactar con bitmask\x02No se pudo encontrar ningún agente de autenticaci" +
"on de polkit. Por favor lanza uno y prueba de nuevo.\x02Falta un agente " +
- "de autenticación\x02Comprobando el estado...\x02Encender\x02Apagar\x02Ca" +
- "ncelar\x02Cancela la conexión a %[1]s\x02Ayuda...\x02Dona...\x02Acerca d" +
- "e...\x02Cerrar\x02Salir a través de\x02Usa la salida de %[1]s por %[2]v" +
- "\x02%[1]s encendida\x02%[1]s apagada\x02Connectando a %[1]s\x02Desconnec" +
- "tando de %[1]s\x02Reintentar\x02%[1]s bloqueando internet"
+ "de autenticación\x02No puedo conectar con %[1]s: %[2]v\x02Error arrancan" +
+ "do la VPN\x02Comprobando el estado...\x02Encender\x02Apagar\x02Cancelar" +
+ "\x02Cancela la conexión a %[1]s\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\x02Connectando a %[1]s\x02Desconnectando" +
+ " de %[1]s\x02Reintentar\x02%[1]s bloqueando internet"
-var pt_BRIndex = []uint32{ // 26 elements
+var pt_BRIndex = []uint32{ // 28 elements
0x00000000, 0x00000000, 0x00000013, 0x00000013,
0x00000013, 0x0000006d, 0x00000099, 0x0000010a,
- 0x00000135, 0x00000154, 0x0000015a, 0x00000163,
- 0x0000016c, 0x00000189, 0x00000192, 0x000001a8,
- 0x000001a8, 0x000001af, 0x000001cd, 0x000001eb,
- 0x000001fe, 0x00000214, 0x00000231, 0x0000024c,
- 0x0000025d, 0x0000027f,
-} // Size: 128 bytes
+ 0x00000135, 0x00000135, 0x00000135, 0x00000154,
+ 0x0000015a, 0x00000163, 0x0000016c, 0x00000189,
+ 0x00000192, 0x000001a8, 0x000001a8, 0x000001af,
+ 0x000001cd, 0x000001eb, 0x000001fe, 0x00000214,
+ 0x00000231, 0x0000024c, 0x0000025d, 0x0000027f,
+} // Size: 136 bytes
const pt_BRData string = "" + // Size: 639 bytes
"\x02Fazer uma doação\x02Você tem certeza que bitmaskd está sendo executa" +
@@ -147,4 +151,4 @@ const pt_BRData string = "" + // Size: 639 bytes
"tá sendo iniciada\x02A %[1]s está sendo parada\x02Tentar novamente\x02%[" +
"1]s está bloqueando a Internet"
- // Total table size 3420 bytes (3KiB); checksum: F4A4AF34
+ // Total table size 3552 bytes (3KiB); checksum: 1E25D489
diff --git a/locales/en-US/messages.gotext.json b/locales/en-US/messages.gotext.json
index d4f007f..4b67041 100644
--- a/locales/en-US/messages.gotext.json
+++ b/locales/en-US/messages.gotext.json
@@ -98,6 +98,41 @@
"fuzzy": true
},
{
+ "id": [
+ "errorStartingVPN",
+ "Can't connect to {ApplicationName}: {Err}"
+ ],
+ "message": "Can't connect to {ApplicationName}: {Err}",
+ "translation": "Can't connect to {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": "Error starting VPN",
+ "message": "Error starting VPN",
+ "translation": "Error starting VPN",
+ "translatorComment": "Copied from source.",
+ "fuzzy": true
+ },
+ {
"id": "Checking status...",
"message": "Checking status...",
"translation": "Checking status..."
diff --git a/locales/es-ES/messages.gotext.json b/locales/es-ES/messages.gotext.json
index e950c0e..b3b2d24 100644
--- a/locales/es-ES/messages.gotext.json
+++ b/locales/es-ES/messages.gotext.json
@@ -82,6 +82,37 @@
"translation": "Falta un agente de autenticación"
},
{
+ "id": [
+ "errorStartingVPN",
+ "Can't connect to {ApplicationName}: {Err}"
+ ],
+ "message": "Can't connect to {ApplicationName}: {Err}",
+ "translation": "No puedo conectar con {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": "Error starting VPN",
+ "message": "Error starting VPN",
+ "translation": "Error arrancando la VPN"
+ },
+ {
"id": "Checking status...",
"message": "Checking status...",
"translation": "Comprobando el estado..."
diff --git a/locales/pt-BR/messages.gotext.json b/locales/pt-BR/messages.gotext.json
index 7d16697..522b653 100644
--- a/locales/pt-BR/messages.gotext.json
+++ b/locales/pt-BR/messages.gotext.json
@@ -82,6 +82,37 @@
"translation": "Um agente de autenticação está faltando"
},
{
+ "id": [
+ "errorStartingVPN",
+ "Can't connect to {ApplicationName}: {Err}"
+ ],
+ "message": "Can't connect to {ApplicationName}: {Err}",
+ "translation": "",
+ "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": "Error starting VPN",
+ "message": "Error starting VPN",
+ "translation": ""
+ },
+ {
"id": "Checking status...",
"message": "Checking status...",
"translation": "Verificando o estado da VPN..."
diff --git a/main.go b/main.go
index 503d4ff..ddea432 100644
--- a/main.go
+++ b/main.go
@@ -75,7 +75,11 @@ func checkAndStartBitmask(b *bitmask.Bitmask, notify *notificator, conf *systray
log.Printf("Is bitmask running? %v", err)
os.Exit(1)
}
- maybeStartVPN(b, conf)
+ err = maybeStartVPN(b, conf)
+ if err != nil {
+ log.Println("Error starting VPN: ", err)
+ notify.errorStartingVPN(err)
+ }
}
func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) error {
@@ -97,16 +101,14 @@ func checkAndInstallHelpers(b *bitmask.Bitmask, notify *notificator) error {
return nil
}
-func maybeStartVPN(b *bitmask.Bitmask, conf *systrayConfig) {
+func maybeStartVPN(b *bitmask.Bitmask, conf *systrayConfig) error {
if conf.UserStoppedVPN {
- return
+ return nil
}
err := b.StartVPN(provider)
- if err != nil {
- log.Println("Error starting VPN: ", err)
- }
conf.setUserStoppedVPN(false)
+ return err
}
func initPrinter() {
diff --git a/notificator.go b/notificator.go
index 353bbeb..dc7993c 100644
--- a/notificator.go
+++ b/notificator.go
@@ -34,6 +34,7 @@ This service paid for entirely by donations from users like you. Please donate a
By using this application, you agree to the Terms of Service available at 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.`
missingAuthAgent = `Could not find a polkit authentication agent. Please run one and try again.`
+ errorStartingVPN = `Can't connect to %s: %v`
notRunning = `Is bitmaskd running? Start bitmask and try again.`
svgFileName = "riseupvpn.svg"
)
@@ -87,6 +88,13 @@ func (n *notificator) authAgent() {
Error()
}
+func (n *notificator) errorStartingVPN(err error) {
+ dialog.Message(printer.Sprintf(errorStartingVPN, applicationName, err)).
+ Title(printer.Sprintf("Error starting VPN")).
+ Icon(getSVGPath()).
+ Error()
+}
+
func getSVGPath() string {
wd, _ := os.Getwd()
svgPath := path.Join(wd, svgFileName)