From 8523979c9c2540b3d1db544674731ccc624f6f96 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 12 Feb 2021 18:04:36 +0100 Subject: tunnel: report git commit as wgVersion Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/backend/GoBackend.java | 2 +- tunnel/tools/libwg-go/api-android.go | 17 ++++++++++++++++- tunnel/tools/libwg-go/go.mod | 2 +- tunnel/tools/libwg-go/go.sum | 4 ++-- ui/src/main/res/values-de/strings.xml | 2 +- ui/src/main/res/values-es-rES/strings.xml | 2 +- ui/src/main/res/values-fr/strings.xml | 2 +- ui/src/main/res/values-hi-rIN/strings.xml | 2 +- ui/src/main/res/values-hi/strings.xml | 2 +- ui/src/main/res/values-id/strings.xml | 2 +- ui/src/main/res/values-it/strings.xml | 2 +- ui/src/main/res/values-ja/strings.xml | 2 +- ui/src/main/res/values-pa-rIN/strings.xml | 2 +- ui/src/main/res/values-pl-rPL/strings.xml | 2 +- ui/src/main/res/values-ro-rRO/strings.xml | 2 +- ui/src/main/res/values-ru/strings.xml | 2 +- ui/src/main/res/values-sl/strings.xml | 2 +- ui/src/main/res/values-tr-rTR/strings.xml | 2 +- ui/src/main/res/values-zh-rCN/strings.xml | 2 +- ui/src/main/res/values/strings.xml | 2 +- 20 files changed, 36 insertions(+), 21 deletions(-) diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java index 85c60349..c7381487 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -278,7 +278,7 @@ public final class GoBackend implements Backend { try (final ParcelFileDescriptor tun = builder.establish()) { if (tun == null) throw new BackendException(Reason.TUN_CREATION_ERROR); - Log.d(TAG, "Go backend v" + wgVersion()); + Log.d(TAG, "Go backend " + wgVersion()); currentTunnelHandle = wgTurnOn(tunnel.getName(), tun.detachFd(), goConfig); } if (currentTunnelHandle < 0) diff --git a/tunnel/tools/libwg-go/api-android.go b/tunnel/tools/libwg-go/api-android.go index 5fce4705..5e85d086 100644 --- a/tunnel/tools/libwg-go/api-android.go +++ b/tunnel/tools/libwg-go/api-android.go @@ -16,6 +16,8 @@ import ( "os" "os/signal" "runtime" + "runtime/debug" + "strings" "unsafe" "golang.org/x/sys/unix" @@ -206,7 +208,20 @@ func wgGetConfig(tunnelHandle int32) *C.char { //export wgVersion func wgVersion() *C.char { - return C.CString(device.WireGuardGoVersion) + info, ok := debug.ReadBuildInfo() + if !ok { + return C.CString("unknown") + } + for _, dep := range info.Deps { + if dep.Path == "golang.zx2c4.com/wireguard" { + parts := strings.Split(dep.Version, "-") + if len(parts) == 3 && len(parts[2]) == 12 { + return C.CString(parts[2][:7]) + } + return C.CString(dep.Version) + } + } + return C.CString("unknown") } func main() {} diff --git a/tunnel/tools/libwg-go/go.mod b/tunnel/tools/libwg-go/go.mod index 8422b2bc..de0a4fda 100644 --- a/tunnel/tools/libwg-go/go.mod +++ b/tunnel/tools/libwg-go/go.mod @@ -5,5 +5,5 @@ go 1.15 require ( golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c - golang.zx2c4.com/wireguard v0.0.0-20210211144856-ef8115f63b22 + golang.zx2c4.com/wireguard v0.0.0-20210212170059-7a0fb5bbb172 ) diff --git a/tunnel/tools/libwg-go/go.sum b/tunnel/tools/libwg-go/go.sum index 391f9d6f..f11afd8b 100644 --- a/tunnel/tools/libwg-go/go.sum +++ b/tunnel/tools/libwg-go/go.sum @@ -18,5 +18,5 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.zx2c4.com/wireguard v0.0.0-20210211144856-ef8115f63b22 h1:7Ct1Jps4o4u2hBFWrg8Rt65VmXfMPTeR0OSXxdq8gMk= -golang.zx2c4.com/wireguard v0.0.0-20210211144856-ef8115f63b22/go.mod h1:r0ExowOoGFfDoLDxx+M9SYbNVsoZ0xviLL+K4f2mt+A= +golang.zx2c4.com/wireguard v0.0.0-20210212170059-7a0fb5bbb172 h1:g1vFilCRox6yINkkKFt+Dj4T22qjxp63yNzR1BjgmEE= +golang.zx2c4.com/wireguard v0.0.0-20210212170059-7a0fb5bbb172/go.mod h1:r0ExowOoGFfDoLDxx+M9SYbNVsoZ0xviLL+K4f2mt+A= diff --git a/ui/src/main/res/values-de/strings.xml b/ui/src/main/res/values-de/strings.xml index 96b62791..c9cde1ee 100644 --- a/ui/src/main/res/values-de/strings.xml +++ b/ui/src/main/res/values-de/strings.xml @@ -212,7 +212,7 @@ Go userspace Kernelmodul Unbekannter Fehler - %1$s Backend v%2$s + %1$s Backend %2$s Überprüfe %s Backend-Version Unbekannte %s Version WireGuard für Android v%s diff --git a/ui/src/main/res/values-es-rES/strings.xml b/ui/src/main/res/values-es-rES/strings.xml index 3595701d..8e6c90d0 100644 --- a/ui/src/main/res/values-es-rES/strings.xml +++ b/ui/src/main/res/values-es-rES/strings.xml @@ -163,7 +163,7 @@ Ir al espacio de usuario Módulo Kernel Error desconocido - %1$s backend v%2$s + %1$s backend %2$s Comprobando versión de backend %s Versión %s desconocida WireGuard para Android -%s diff --git a/ui/src/main/res/values-fr/strings.xml b/ui/src/main/res/values-fr/strings.xml index a0e06e54..00417e02 100644 --- a/ui/src/main/res/values-fr/strings.xml +++ b/ui/src/main/res/values-fr/strings.xml @@ -212,7 +212,7 @@ Nom de l\'espace utilisateur Module noyau Erreur inconnue - %1$s backend v%2$s + %1$s backend %2$s Vérification de la version %s du backend Version %s inconnue WireGuard pour Android v%s diff --git a/ui/src/main/res/values-hi-rIN/strings.xml b/ui/src/main/res/values-hi-rIN/strings.xml index 9443a5f8..f47b1687 100644 --- a/ui/src/main/res/values-hi-rIN/strings.xml +++ b/ui/src/main/res/values-hi-rIN/strings.xml @@ -203,7 +203,7 @@ userspace पे जाए कर्नेल मॉड्यूल अज्ञात त्रुटि - %1$s बैकएंड v%2$s + %1$s बैकएंड %2$s %s बैकएंड संस्करण की जाँच कर रहा है अज्ञात %s संस्करण WireGuard for Android v%s diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml index fa65c119..d0899dff 100644 --- a/ui/src/main/res/values-hi/strings.xml +++ b/ui/src/main/res/values-hi/strings.xml @@ -162,7 +162,7 @@ userspace पे जाए कर्नेल मॉड्यूल अज्ञात त्रुटि - %1$s बैकएंड v%2$s + %1$s बैकएंड %2$s %s बैकएंड संस्करण की जाँच कर रहा है अज्ञात %s संस्करण WireGuard for Android v%s diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml index 774bd2d2..847c6a69 100644 --- a/ui/src/main/res/values-id/strings.xml +++ b/ui/src/main/res/values-id/strings.xml @@ -199,7 +199,7 @@ Ke userspace Modul kernel Eror tidak diketahui - %1$s backend v%2$s + %1$s backend %2$s Mengecek versi backend %s Versi %s Tidak diketahui WireGuard untuk Android v%s diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml index 8aee34bd..92ce6cd2 100644 --- a/ui/src/main/res/values-it/strings.xml +++ b/ui/src/main/res/values-it/strings.xml @@ -212,7 +212,7 @@ Spazio utente Go Modulo kernel Errore sconosciuto - Backend %1$s v%2$s + Backend %1$s %2$s Controllo versione backend %s Versione %s sconosciuta WireGuard per Android v%s diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml index f9146c5d..882f091a 100644 --- a/ui/src/main/res/values-ja/strings.xml +++ b/ui/src/main/res/values-ja/strings.xml @@ -199,7 +199,7 @@ Go ユーザースペース カーネルモジュール 未知のエラー - %1$s backend v%2$s + %1$s backend %2$s %s バックエンドのバージョンを確認中 未知の %s バージョン WireGuard for Android v%s diff --git a/ui/src/main/res/values-pa-rIN/strings.xml b/ui/src/main/res/values-pa-rIN/strings.xml index 5fd7065d..7f68c1de 100644 --- a/ui/src/main/res/values-pa-rIN/strings.xml +++ b/ui/src/main/res/values-pa-rIN/strings.xml @@ -212,7 +212,7 @@ ਵਰਤੋਂ-ਸਪੇਸ ਤੇ ਜਾਓ ਕਰਨਲ ਮੋਡੀਊਲ ਅਣਪਛਾਤੀ ਗਲਤੀ - %1$s ਬੈਕਐਂਡ v%2$s + %1$s ਬੈਕਐਂਡ %2$s %s ਬੈਕਐਂਡ ਵਰਜ਼ਨ ਦੀ ਜਾਂਚ ਕੀਤੀ ਜਾ ਰਹੀ ਹੈ ਅਣਪਛਾਤਾ %s ਵਰਜਨ Android ਲਈ WireGuard v%s diff --git a/ui/src/main/res/values-pl-rPL/strings.xml b/ui/src/main/res/values-pl-rPL/strings.xml index 9971f571..87eada58 100644 --- a/ui/src/main/res/values-pl-rPL/strings.xml +++ b/ui/src/main/res/values-pl-rPL/strings.xml @@ -238,7 +238,7 @@ Przestrzeń użytkownika Go Moduł jądra Nieznany błąd - Implementacja %1$s v%2$s + Implementacja %1$s %2$s Sprawdzanie wersji %s implementacji Nieznana %s wersja WireGuard dla systemu Android v%s diff --git a/ui/src/main/res/values-ro-rRO/strings.xml b/ui/src/main/res/values-ro-rRO/strings.xml index acdd7e0a..87867e37 100644 --- a/ui/src/main/res/values-ro-rRO/strings.xml +++ b/ui/src/main/res/values-ro-rRO/strings.xml @@ -225,7 +225,7 @@ Spațiu de utilizator Go Modul nucleu Eroare necunoscută - Bibliotecă %1$s v%2$s + Bibliotecă %1$s %2$s Se verifică versiunea bibliotecii %s Versiune %s necunoscută WireGuard pentru Android v%s diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml index dcf350a7..4ec20c26 100644 --- a/ui/src/main/res/values-ru/strings.xml +++ b/ui/src/main/res/values-ru/strings.xml @@ -238,7 +238,7 @@ Перейти в пользовательское пространство Модуль ядра Неизвестная ошибка - %1$s v%2$s + %1$s %2$s Проверка версии %s Неизвестная версия %s WireGuard для Android v%s diff --git a/ui/src/main/res/values-sl/strings.xml b/ui/src/main/res/values-sl/strings.xml index ae67e890..34df3187 100644 --- a/ui/src/main/res/values-sl/strings.xml +++ b/ui/src/main/res/values-sl/strings.xml @@ -238,7 +238,7 @@ Uporabniški prostor Go Modul jedra Neznana napaka - Zaledje %1$s v%2$s + Zaledje %1$s %2$s Preverjam verzijo zaledja %s Neznana verzija %s WireGuard za Android v%s diff --git a/ui/src/main/res/values-tr-rTR/strings.xml b/ui/src/main/res/values-tr-rTR/strings.xml index 74d7483c..2585b997 100644 --- a/ui/src/main/res/values-tr-rTR/strings.xml +++ b/ui/src/main/res/values-tr-rTR/strings.xml @@ -212,7 +212,7 @@ Kullanıcı alanına git Çekirdek modülü Bilinmeyen hata - %1$s backend v%2$s + %1$s backend %2$s %s arka uç sürümü kontrol ediliyor Bilinmeyen %s sürümü Android için WireGuard v%s diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml index 7e840f00..1c41b19b 100644 --- a/ui/src/main/res/values-zh-rCN/strings.xml +++ b/ui/src/main/res/values-zh-rCN/strings.xml @@ -199,7 +199,7 @@ Go userspace Kernel module 未知错误 - %1$s backend v%2$s + %1$s backend %2$s 正在检查 %s backend 版本 未知的 %s 版本 WireGuard for Android v%s diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml index d569ccfe..812b2192 100644 --- a/ui/src/main/res/values/strings.xml +++ b/ui/src/main/res/values/strings.xml @@ -219,7 +219,7 @@ Go userspace Kernel module Unknown error - %1$s backend v%2$s + %1$s backend %2$s Checking %s backend version Unknown %s version WireGuard for Android v%s -- cgit v1.2.3