macOS: Add WireGuardNetworkExtensionmacOS target

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-12-27 15:44:49 +05:30
parent f6772dc353
commit 573f9640de
4 changed files with 233 additions and 6 deletions

View File

@ -55,6 +55,8 @@
6FB1BD6021D2607A00A991BF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FB1BD5F21D2607A00A991BF /* AppDelegate.swift */; };
6FB1BD6221D2607E00A991BF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6FB1BD6121D2607E00A991BF /* Assets.xcassets */; };
6FB1BD6521D2607E00A991BF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6FB1BD6321D2607E00A991BF /* MainMenu.xib */; };
6FB1BD9421D4BFE700A991BF /* PacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FB1BD9321D4BFE700A991BF /* PacketTunnelProvider.swift */; };
6FB1BD9921D4BFE700A991BF /* WireGuardNetworkExtensionmacOS.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 6FB1BD9121D4BFE600A991BF /* WireGuardNetworkExtensionmacOS.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
6FDEF7E421846C1A00D8FBF6 /* libwg-go.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FDEF7E321846C1A00D8FBF6 /* libwg-go.a */; };
6FDEF7E62185EFB200D8FBF6 /* QRScanViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FDEF7E52185EFAF00D8FBF6 /* QRScanViewController.swift */; };
6FDEF7FB21863B6100D8FBF6 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 6FDEF7F621863B6100D8FBF6 /* unzip.c */; };
@ -92,6 +94,13 @@
remoteGlobalIDString = 6F5D0C19218352EF000F85AD;
remoteInfo = WireGuardNetworkExtension;
};
6FB1BD9721D4BFE700A991BF /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6FF4AC0C211EC46F002C96EB /* Project object */;
proxyType = 1;
remoteGlobalIDString = 6FB1BD9021D4BFE600A991BF;
remoteInfo = WireGuardNetworkExtensionmacOS;
};
6FDEF7E121846C0000D8FBF6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6FF4AC0C211EC46F002C96EB /* Project object */;
@ -113,6 +122,17 @@
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
6FB1BD9D21D4BFE700A991BF /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
6FB1BD9921D4BFE700A991BF /* WireGuardNetworkExtensionmacOS.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@ -162,12 +182,16 @@
6F919ED7218C65C50023B400 /* wireguard_doc_logo_64x64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wireguard_doc_logo_64x64.png; sourceTree = "<group>"; };
6F919ED8218C65C50023B400 /* wireguard_doc_logo_320x320.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = wireguard_doc_logo_320x320.png; sourceTree = "<group>"; };
6FB1017821C57DE600766195 /* MockTunnels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTunnels.swift; sourceTree = "<group>"; };
6FB1BD5D21D2607A00A991BF /* WireGuardmacOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = WireGuardmacOS.app; path = WireGuard.app; sourceTree = BUILT_PRODUCTS_DIR; };
6FB1BD5D21D2607A00A991BF /* WireGuard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WireGuard.app; sourceTree = BUILT_PRODUCTS_DIR; };
6FB1BD5F21D2607A00A991BF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6FB1BD6121D2607E00A991BF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6FB1BD6421D2607E00A991BF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
6FB1BD6621D2607E00A991BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6FB1BD6721D2607E00A991BF /* WireGuardmacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WireGuardmacOS.entitlements; sourceTree = "<group>"; };
6FB1BD9121D4BFE600A991BF /* WireGuardNetworkExtensionmacOS.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WireGuardNetworkExtensionmacOS.appex; sourceTree = BUILT_PRODUCTS_DIR; };
6FB1BD9321D4BFE700A991BF /* PacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PacketTunnelProvider.swift; sourceTree = "<group>"; };
6FB1BD9521D4BFE700A991BF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6FB1BD9621D4BFE700A991BF /* WireGuardNetworkExtensionmacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WireGuardNetworkExtensionmacOS.entitlements; sourceTree = "<group>"; };
6FDEF7E321846C1A00D8FBF6 /* libwg-go.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libwg-go.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6FDEF7E52185EFAF00D8FBF6 /* QRScanViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QRScanViewController.swift; sourceTree = "<group>"; };
6FDEF7F621863B6100D8FBF6 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
@ -213,6 +237,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6FB1BD8E21D4BFE600A991BF /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
6FF4AC11211EC46F002C96EB /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -367,6 +398,16 @@
path = WireGuardmacOS;
sourceTree = "<group>";
};
6FB1BD9221D4BFE700A991BF /* WireGuardNetworkExtensionmacOS */ = {
isa = PBXGroup;
children = (
6FB1BD9321D4BFE700A991BF /* PacketTunnelProvider.swift */,
6FB1BD9521D4BFE700A991BF /* Info.plist */,
6FB1BD9621D4BFE700A991BF /* WireGuardNetworkExtensionmacOS.entitlements */,
);
path = WireGuardNetworkExtensionmacOS;
sourceTree = "<group>";
};
6FDEF7E72186320E00D8FBF6 /* ZipArchive */ = {
isa = PBXGroup;
children = (
@ -417,6 +458,7 @@
6FF4AC16211EC46F002C96EB /* WireGuard */,
6F5D0C1B218352EF000F85AD /* WireGuardNetworkExtension */,
6FB1BD5E21D2607A00A991BF /* WireGuardmacOS */,
6FB1BD9221D4BFE700A991BF /* WireGuardNetworkExtensionmacOS */,
6FF4AC15211EC46F002C96EB /* Products */,
6FF4AC452120B9E0002C96EB /* Frameworks */,
);
@ -427,7 +469,8 @@
children = (
6FF4AC14211EC46F002C96EB /* WireGuardiOS.app */,
6F5D0C1A218352EF000F85AD /* WireGuardNetworkExtensioniOS.appex */,
6FB1BD5D21D2607A00A991BF /* WireGuardmacOS.app */,
6FB1BD5D21D2607A00A991BF /* WireGuard.app */,
6FB1BD9121D4BFE600A991BF /* WireGuardNetworkExtensionmacOS.appex */,
);
name = Products;
sourceTree = "<group>";
@ -521,15 +564,34 @@
6FB1BD5921D2607A00A991BF /* Sources */,
6FB1BD5A21D2607A00A991BF /* Frameworks */,
6FB1BD5B21D2607A00A991BF /* Resources */,
6FB1BD9D21D4BFE700A991BF /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
6FB1BD9821D4BFE700A991BF /* PBXTargetDependency */,
);
name = WireGuardmacOS;
productName = WireGuardmacOS;
productReference = 6FB1BD5D21D2607A00A991BF /* WireGuard.app */;
productType = "com.apple.product-type.application";
};
6FB1BD9021D4BFE600A991BF /* WireGuardNetworkExtensionmacOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6FB1BD9C21D4BFE700A991BF /* Build configuration list for PBXNativeTarget "WireGuardNetworkExtensionmacOS" */;
buildPhases = (
6FB1BD8D21D4BFE600A991BF /* Sources */,
6FB1BD8E21D4BFE600A991BF /* Frameworks */,
6FB1BD8F21D4BFE600A991BF /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = WireGuardmacOS;
productName = WireGuardmacOS;
productReference = 6FB1BD5D21D2607A00A991BF /* WireGuardmacOS.app */;
productType = "com.apple.product-type.application";
name = WireGuardNetworkExtensionmacOS;
productName = WireGuardNetworkExtensionmacOS;
productReference = 6FB1BD9121D4BFE600A991BF /* WireGuardNetworkExtensionmacOS.appex */;
productType = "com.apple.product-type.app-extension";
};
6FF4AC13211EC46F002C96EB /* WireGuardiOS */ = {
isa = PBXNativeTarget;
@ -570,6 +632,9 @@
6FB1BD5C21D2607A00A991BF = {
CreatedOnToolsVersion = 10.1;
};
6FB1BD9021D4BFE600A991BF = {
CreatedOnToolsVersion = 10.1;
};
6FDEF7DD21846BC100D8FBF6 = {
CreatedOnToolsVersion = 10.0;
};
@ -605,6 +670,7 @@
6FDEF7DD21846BC100D8FBF6 /* WireGuardGoBridgeiOS */,
6FB1BD5C21D2607A00A991BF /* WireGuardmacOS */,
6FDAA03421CE69D000FA6925 /* WireGuardGoBridgemacOS */,
6FB1BD9021D4BFE600A991BF /* WireGuardNetworkExtensionmacOS */,
);
};
/* End PBXProject section */
@ -626,6 +692,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6FB1BD8F21D4BFE600A991BF /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
6FF4AC12211EC46F002C96EB /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -770,6 +843,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6FB1BD8D21D4BFE600A991BF /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6FB1BD9421D4BFE700A991BF /* PacketTunnelProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
6FF4AC10211EC46F002C96EB /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -831,6 +912,11 @@
target = 6F5D0C19218352EF000F85AD /* WireGuardNetworkExtensioniOS */;
targetProxy = 6F5D0C20218352EF000F85AD /* PBXContainerItemProxy */;
};
6FB1BD9821D4BFE700A991BF /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 6FB1BD9021D4BFE600A991BF /* WireGuardNetworkExtensionmacOS */;
targetProxy = 6FB1BD9721D4BFE700A991BF /* PBXContainerItemProxy */;
};
6FDEF7E221846C0000D8FBF6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 6FDEF7DD21846BC100D8FBF6 /* WireGuardGoBridgeiOS */;
@ -914,6 +1000,7 @@
6FB1BD6821D2607E00A991BF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = WireGuardmacOS/WireGuardmacOS.entitlements;
@ -941,6 +1028,7 @@
6FB1BD6921D2607E00A991BF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = WireGuardmacOS/WireGuardmacOS.entitlements;
@ -962,6 +1050,57 @@
};
name = Release;
};
6FB1BD9A21D4BFE700A991BF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = WireGuardNetworkExtensionmacOS/WireGuardNetworkExtensionmacOS.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = WireGuardNetworkExtensionmacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(APP_ID_MACOS).network-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
6FB1BD9B21D4BFE700A991BF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_ENTITLEMENTS = WireGuardNetworkExtensionmacOS/WireGuardNetworkExtensionmacOS.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
INFOPLIST_FILE = WireGuardNetworkExtensionmacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "$(APP_ID_MACOS).network-extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
};
name = Release;
};
6FDAA03621CE69D000FA6925 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -1193,6 +1332,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6FB1BD9C21D4BFE700A991BF /* Build configuration list for PBXNativeTarget "WireGuardNetworkExtensionmacOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6FB1BD9A21D4BFE700A991BF /* Debug */,
6FB1BD9B21D4BFE700A991BF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6FDAA03521CE69D000FA6925 /* Build configuration list for PBXLegacyTarget "WireGuardGoBridgemacOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>WireGuardNetworkExtensionmacOS</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 WireGuard LLC. All rights reserved.</string>
</dict>
</plist>

View File

@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018 WireGuard LLC. All Rights Reserved.
import NetworkExtension
class PacketTunnelProvider: NEPacketTunnelProvider {
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
// Add code here to start the process of connecting the tunnel.
}
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
// Add code here to start the process of stopping the tunnel.
completionHandler()
}
override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)?) {
// Add code here to handle the message.
if let handler = completionHandler {
handler(messageData)
}
}
override func sleep(completionHandler: @escaping () -> Void) {
// Add code here to get ready to sleep.
completionHandler()
}
override func wake() {
// Add code here to wake up.
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
</dict>
</plist>