NE: Logging: Log file should begin with version numbers and tunnel name

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-12-04 16:27:31 +05:30
parent bf86731879
commit 290bd192a0
3 changed files with 36 additions and 0 deletions

View File

@ -378,6 +378,7 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 6F5D0C25218352EF000F85AD /* Build configuration list for PBXNativeTarget "WireGuardNetworkExtension" */; buildConfigurationList = 6F5D0C25218352EF000F85AD /* Build configuration list for PBXNativeTarget "WireGuardNetworkExtension" */;
buildPhases = ( buildPhases = (
6F61F1EC21BA4D4700483816 /* Extract wireguard-go Version */,
6F5D0C16218352EF000F85AD /* Sources */, 6F5D0C16218352EF000F85AD /* Sources */,
6F5D0C17218352EF000F85AD /* Frameworks */, 6F5D0C17218352EF000F85AD /* Frameworks */,
6F5D0C18218352EF000F85AD /* Resources */, 6F5D0C18218352EF000F85AD /* Resources */,
@ -506,6 +507,25 @@
shellScript = "exec make -C \"$PROJECT_DIR/../wireguard-go-bridge\" version-header\n"; shellScript = "exec make -C \"$PROJECT_DIR/../wireguard-go-bridge\" version-header\n";
showEnvVarsInLog = 0; 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 */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */

View File

@ -42,6 +42,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
// Configure logging // Configure logging
configureLogger() 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") wg_log(.info, staticMessage: "Starting tunnel")
// Resolve endpoint domains // 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 { private func withStringsAsGoStrings<R>(_ str1: String, _ str2: String, closure: (gostring_t, gostring_t) -> R) -> R {

View File

@ -1 +1,2 @@
#include "../../wireguard-go-bridge/wireguard.h" #include "../../wireguard-go-bridge/wireguard.h"
#include "wireguard-go-version.h"