aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-04 16:27:31 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:19 +0530
commit290bd192a011ac80aab166443e4654d4b7db684b (patch)
tree2adc1fe8647d8193d5503ab4d7d94932f7fcd953
parentNE: Logging: Make it clear which calls to wg_log use String and which use StaticString (diff)
downloadwireguard-apple-290bd192a011ac80aab166443e4654d4b7db684b.tar.xz
wireguard-apple-290bd192a011ac80aab166443e4654d4b7db684b.zip
NE: Logging: Log file should begin with version numbers and tunnel name
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard.xcodeproj/project.pbxproj20
-rw-r--r--WireGuard/WireGuardNetworkExtension/PacketTunnelProvider.swift15
-rw-r--r--WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension-Bridging-Header.h1
3 files changed, 36 insertions, 0 deletions
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<R>(_ 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"