tunnel: report git commit as wgVersion

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2021-02-12 18:04:36 +01:00
parent 8768acee68
commit 8523979c9c
20 changed files with 36 additions and 21 deletions

View File

@ -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)

View File

@ -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() {}

View File

@ -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
)

View File

@ -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=

View File

@ -212,7 +212,7 @@
<string name="type_name_go_userspace">Go userspace</string>
<string name="type_name_kernel_module">Kernelmodul</string>
<string name="unknown_error">Unbekannter Fehler</string>
<string name="version_summary">%1$s Backend v%2$s</string>
<string name="version_summary">%1$s Backend %2$s</string>
<string name="version_summary_checking">Überprüfe %s Backend-Version</string>
<string name="version_summary_unknown">Unbekannte %s Version</string>
<string name="version_title">WireGuard für Android v%s</string>

View File

@ -163,7 +163,7 @@
<string name="type_name_go_userspace">Ir al espacio de usuario</string>
<string name="type_name_kernel_module">Módulo Kernel</string>
<string name="unknown_error">Error desconocido</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">Comprobando versión de backend %s</string>
<string name="version_summary_unknown">Versión %s desconocida</string>
<string name="version_title">WireGuard para Android -%s</string>

View File

@ -212,7 +212,7 @@
<string name="type_name_go_userspace">Nom de l\'espace utilisateur</string>
<string name="type_name_kernel_module">Module noyau</string>
<string name="unknown_error">Erreur inconnue</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">Vérification de la version %s du backend</string>
<string name="version_summary_unknown">Version %s inconnue</string>
<string name="version_title">WireGuard pour Android v%s</string>

View File

@ -203,7 +203,7 @@
<string name="type_name_go_userspace">userspace पे जाए </string>
<string name="type_name_kernel_module">कर्नेल मॉड्यूल</string>
<string name="unknown_error">अज्ञात त्रुटि</string>
<string name="version_summary">%1$s बैकएंड v%2$s</string>
<string name="version_summary">%1$s बैकएंड %2$s</string>
<string name="version_summary_checking">%s बैकएंड संस्करण की जाँच कर रहा है</string>
<string name="version_summary_unknown">अज्ञात %s संस्करण</string>
<string name="version_title">WireGuard for Android v%s</string>

View File

@ -162,7 +162,7 @@
<string name="type_name_go_userspace">userspace पे जाए </string>
<string name="type_name_kernel_module">कर्नेल मॉड्यूल</string>
<string name="unknown_error">अज्ञात त्रुटि</string>
<string name="version_summary">%1$s बैकएंड v%2$s</string>
<string name="version_summary">%1$s बैकएंड %2$s</string>
<string name="version_summary_checking">%s बैकएंड संस्करण की जाँच कर रहा है</string>
<string name="version_summary_unknown">अज्ञात %s संस्करण</string>
<string name="version_title">WireGuard for Android v%s</string>

View File

@ -199,7 +199,7 @@
<string name="type_name_go_userspace">Ke userspace</string>
<string name="type_name_kernel_module">Modul kernel</string>
<string name="unknown_error">Eror tidak diketahui</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">Mengecek versi backend %s</string>
<string name="version_summary_unknown">Versi %s Tidak diketahui</string>
<string name="version_title">WireGuard untuk Android v%s</string>

View File

@ -212,7 +212,7 @@
<string name="type_name_go_userspace">Spazio utente Go</string>
<string name="type_name_kernel_module">Modulo kernel</string>
<string name="unknown_error">Errore sconosciuto</string>
<string name="version_summary">Backend %1$s v%2$s</string>
<string name="version_summary">Backend %1$s %2$s</string>
<string name="version_summary_checking">Controllo versione backend %s</string>
<string name="version_summary_unknown">Versione %s sconosciuta</string>
<string name="version_title">WireGuard per Android v%s</string>

View File

@ -199,7 +199,7 @@
<string name="type_name_go_userspace">Go ユーザースペース</string>
<string name="type_name_kernel_module">カーネルモジュール</string>
<string name="unknown_error">未知のエラー</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">%s バックエンドのバージョンを確認中</string>
<string name="version_summary_unknown">未知の %s バージョン</string>
<string name="version_title">WireGuard for Android v%s</string>

View File

@ -212,7 +212,7 @@
<string name="type_name_go_userspace">ਵਰਤੋਂ-ਸਪੇਸ ਤੇ ਜਾਓ</string>
<string name="type_name_kernel_module">ਕਰਨਲ ਮੋਡੀਊਲ</string>
<string name="unknown_error">ਅਣਪਛਾਤੀ ਗਲਤੀ</string>
<string name="version_summary">%1$s ਬੈਕਐਂਡ v%2$s</string>
<string name="version_summary">%1$s ਬੈਕਐਂਡ %2$s</string>
<string name="version_summary_checking">%s ਬੈਕਐਂਡ ਵਰਜ਼ਨ ਦੀ ਜਾਂਚ ਕੀਤੀ ਜਾ ਰਹੀ ਹੈ</string>
<string name="version_summary_unknown">ਅਣਪਛਾਤਾ %s ਵਰਜਨ</string>
<string name="version_title">Android ਲਈ WireGuard v%s</string>

View File

@ -238,7 +238,7 @@
<string name="type_name_go_userspace">Przestrzeń użytkownika Go</string>
<string name="type_name_kernel_module">Moduł jądra</string>
<string name="unknown_error">Nieznany błąd</string>
<string name="version_summary">Implementacja %1$s v%2$s</string>
<string name="version_summary">Implementacja %1$s %2$s</string>
<string name="version_summary_checking">Sprawdzanie wersji %s implementacji</string>
<string name="version_summary_unknown">Nieznana %s wersja</string>
<string name="version_title">WireGuard dla systemu Android v%s</string>

View File

@ -225,7 +225,7 @@
<string name="type_name_go_userspace">Spațiu de utilizator Go</string>
<string name="type_name_kernel_module">Modul nucleu</string>
<string name="unknown_error">Eroare necunoscută</string>
<string name="version_summary">Bibliotecă %1$s v%2$s</string>
<string name="version_summary">Bibliotecă %1$s %2$s</string>
<string name="version_summary_checking">Se verifică versiunea bibliotecii %s</string>
<string name="version_summary_unknown">Versiune %s necunoscută</string>
<string name="version_title">WireGuard pentru Android v%s</string>

View File

@ -238,7 +238,7 @@
<string name="type_name_go_userspace">Перейти в пользовательское пространство</string>
<string name="type_name_kernel_module">Модуль ядра</string>
<string name="unknown_error">Неизвестная ошибка</string>
<string name="version_summary">%1$s v%2$s</string>
<string name="version_summary">%1$s %2$s</string>
<string name="version_summary_checking">Проверка версии %s</string>
<string name="version_summary_unknown">Неизвестная версия %s</string>
<string name="version_title">WireGuard для Android v%s</string>

View File

@ -238,7 +238,7 @@
<string name="type_name_go_userspace">Uporabniški prostor Go</string>
<string name="type_name_kernel_module">Modul jedra</string>
<string name="unknown_error">Neznana napaka</string>
<string name="version_summary">Zaledje %1$s v%2$s</string>
<string name="version_summary">Zaledje %1$s %2$s</string>
<string name="version_summary_checking">Preverjam verzijo zaledja %s</string>
<string name="version_summary_unknown">Neznana verzija %s</string>
<string name="version_title">WireGuard za Android v%s</string>

View File

@ -212,7 +212,7 @@
<string name="type_name_go_userspace">Kullanıcı alanına git</string>
<string name="type_name_kernel_module">Çekirdek modülü</string>
<string name="unknown_error">Bilinmeyen hata</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">%s arka uç sürümü kontrol ediliyor</string>
<string name="version_summary_unknown">Bilinmeyen %s sürümü</string>
<string name="version_title">Android için WireGuard v%s</string>

View File

@ -199,7 +199,7 @@
<string name="type_name_go_userspace">Go userspace</string>
<string name="type_name_kernel_module">Kernel module</string>
<string name="unknown_error">未知错误</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">正在检查 %s backend 版本</string>
<string name="version_summary_unknown">未知的 %s 版本</string>
<string name="version_title">WireGuard for Android v%s</string>

View File

@ -219,7 +219,7 @@
<string name="type_name_go_userspace">Go userspace</string>
<string name="type_name_kernel_module">Kernel module</string>
<string name="unknown_error">Unknown error</string>
<string name="version_summary">%1$s backend v%2$s</string>
<string name="version_summary">%1$s backend %2$s</string>
<string name="version_summary_checking">Checking %s backend version</string>
<string name="version_summary_unknown">Unknown %s version</string>
<string name="version_title">WireGuard for Android v%s</string>