diff --git a/WireGuard/WireGuard.xcodeproj/project.pbxproj b/WireGuard/WireGuard.xcodeproj/project.pbxproj index d308075..a7db4ab 100644 --- a/WireGuard/WireGuard.xcodeproj/project.pbxproj +++ b/WireGuard/WireGuard.xcodeproj/project.pbxproj @@ -378,6 +378,7 @@ isa = PBXNativeTarget; buildConfigurationList = 6F5D0C25218352EF000F85AD /* Build configuration list for PBXNativeTarget "WireGuardNetworkExtension" */; buildPhases = ( + 6F61F1EC21BA4D4700483816 /* Extract wireguard-go Version */, 6F5D0C16218352EF000F85AD /* Sources */, 6F5D0C17218352EF000F85AD /* Frameworks */, 6F5D0C18218352EF000F85AD /* Resources */, @@ -506,6 +507,25 @@ shellScript = "exec make -C \"$PROJECT_DIR/../wireguard-go-bridge\" version-header\n"; showEnvVarsInLog = 0; }; + 6F61F1EC21BA4D4700483816 /* Extract wireguard-go Version */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Extract wireguard-go Version"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec make -C \"$PROJECT_DIR/../wireguard-go-bridge\" version-header\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift index 1635921..b28a704 100644 --- a/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift +++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift @@ -42,6 +42,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider { // Configure logging configureLogger() + wg_log(.info, message: "WireGuard for iOS version \(appVersion())") + wg_log(.info, message: "WireGuard Go backend version \(goBackendVersion())") + wg_log(.info, message: "Tunnel interface name: \(tunnelConfiguration.interface.name)") + wg_log(.info, staticMessage: "Starting tunnel") // Resolve endpoint domains @@ -157,6 +161,17 @@ class PacketTunnelProvider: NEPacketTunnelProvider { } } + func appVersion() -> String { + var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown version" + if let appBuild = Bundle.main.infoDictionary?["CFBundleVersion"] as? String { + appVersion += " (\(appBuild))" + } + return appVersion + } + + func goBackendVersion() -> String { + return WIREGUARD_GO_VERSION + } } private func withStringsAsGoStrings(_ str1: String, _ str2: String, closure: (gostring_t, gostring_t) -> R) -> R { diff --git a/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension-Bridging-Header.h b/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension-Bridging-Header.h index 8184ff0..95d3f4b 100644 --- a/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension-Bridging-Header.h +++ b/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension-Bridging-Header.h @@ -1 +1,2 @@ #include "../../wireguard-go-bridge/wireguard.h" +#include "wireguard-go-version.h"