Skip to content

Commit d8ad698

Browse files
committed
feat: add XPC communication to Network Extension
1 parent 8b338a2 commit d8ad698

File tree

10 files changed

+383
-14
lines changed

10 files changed

+383
-14
lines changed

Coder Desktop/Coder Desktop.xcodeproj/project.pbxproj

Lines changed: 154 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
3B0916612D41B9690064DEA8 /* VPNXPC.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 3B0916552D41B9690064DEA8 /* VPNXPC.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1011
961679332CFF117300B2B6DF /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 961679322CFF117300B2B6DF /* NetworkExtension.framework */; };
1112
9616793D2CFF117300B2B6DF /* com.coder.Coder-Desktop.VPN.systemextension in Embed System Extensions */ = {isa = PBXBuildFile; fileRef = 961679302CFF117300B2B6DF /* com.coder.Coder-Desktop.VPN.systemextension */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1213
AA3B3DA92D2D23860099996A /* VPNLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA3B3DA12D2D23860099996A /* VPNLib.framework */; };
@@ -27,6 +28,13 @@
2728
/* End PBXBuildFile section */
2829

2930
/* Begin PBXContainerItemProxy section */
31+
3B09165F2D41B9690064DEA8 /* PBXContainerItemProxy */ = {
32+
isa = PBXContainerItemProxy;
33+
containerPortal = 961678F42CFF100D00B2B6DF /* Project object */;
34+
proxyType = 1;
35+
remoteGlobalIDString = 3B0916542D41B9690064DEA8;
36+
remoteInfo = VPNXPC;
37+
};
3038
961679102CFF100E00B2B6DF /* PBXContainerItemProxy */ = {
3139
isa = PBXContainerItemProxy;
3240
containerPortal = 961678F42CFF100D00B2B6DF /* Project object */;
@@ -107,6 +115,17 @@
107115
/* End PBXContainerItemProxy section */
108116

109117
/* Begin PBXCopyFilesBuildPhase section */
118+
3B0916622D41B9690064DEA8 /* Embed XPC Services */ = {
119+
isa = PBXCopyFilesBuildPhase;
120+
buildActionMask = 2147483647;
121+
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
122+
dstSubfolderSpec = 16;
123+
files = (
124+
3B0916612D41B9690064DEA8 /* VPNXPC.xpc in Embed XPC Services */,
125+
);
126+
name = "Embed XPC Services";
127+
runOnlyForDeploymentPostprocessing = 0;
128+
};
110129
961679422CFF117300B2B6DF /* Embed System Extensions */ = {
111130
isa = PBXCopyFilesBuildPhase;
112131
buildActionMask = 2147483647;
@@ -132,6 +151,7 @@
132151
/* End PBXCopyFilesBuildPhase section */
133152

134153
/* Begin PBXFileReference section */
154+
3B0916552D41B9690064DEA8 /* VPNXPC.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = VPNXPC.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
135155
961678FC2CFF100D00B2B6DF /* Coder Desktop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Coder Desktop.app"; sourceTree = BUILT_PRODUCTS_DIR; };
136156
9616790F2CFF100E00B2B6DF /* Coder DesktopTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Coder DesktopTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
137157
961679192CFF100E00B2B6DF /* Coder DesktopUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Coder DesktopUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -144,6 +164,13 @@
144164
/* End PBXFileReference section */
145165

146166
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
167+
3B0916652D41B9690064DEA8 /* Exceptions for "VPNXPC" folder in "VPNXPC" target */ = {
168+
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
169+
membershipExceptions = (
170+
Info.plist,
171+
);
172+
target = 3B0916542D41B9690064DEA8 /* VPNXPC */;
173+
};
147174
AA3B3DB62D2D23860099996A /* Exceptions for "VPNLib" folder in "VPNLib" target */ = {
148175
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
149176
membershipExceptions = (
@@ -171,6 +198,14 @@
171198
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
172199

173200
/* Begin PBXFileSystemSynchronizedRootGroup section */
201+
3B0916562D41B9690064DEA8 /* VPNXPC */ = {
202+
isa = PBXFileSystemSynchronizedRootGroup;
203+
exceptions = (
204+
3B0916652D41B9690064DEA8 /* Exceptions for "VPNXPC" folder in "VPNXPC" target */,
205+
);
206+
path = VPNXPC;
207+
sourceTree = "<group>";
208+
};
174209
961678FE2CFF100D00B2B6DF /* Coder Desktop */ = {
175210
isa = PBXFileSystemSynchronizedRootGroup;
176211
path = "Coder Desktop";
@@ -223,6 +258,13 @@
223258
/* End PBXFileSystemSynchronizedRootGroup section */
224259

225260
/* Begin PBXFrameworksBuildPhase section */
261+
3B0916522D41B9690064DEA8 /* Frameworks */ = {
262+
isa = PBXFrameworksBuildPhase;
263+
buildActionMask = 2147483647;
264+
files = (
265+
);
266+
runOnlyForDeploymentPostprocessing = 0;
267+
};
226268
961678F92CFF100D00B2B6DF /* Frameworks */ = {
227269
isa = PBXFrameworksBuildPhase;
228270
buildActionMask = 2147483647;
@@ -308,6 +350,7 @@
308350
AA3B3DAE2D2D23860099996A /* VPNLibTests */,
309351
AA3B40922D2FC8560099996A /* CoderSDK */,
310352
AA3B409E2D2FC8560099996A /* CoderSDKTests */,
353+
3B0916562D41B9690064DEA8 /* VPNXPC */,
311354
961679312CFF117300B2B6DF /* Frameworks */,
312355
961678FD2CFF100D00B2B6DF /* Products */,
313356
);
@@ -324,6 +367,7 @@
324367
AA3B3DA82D2D23860099996A /* VPNLibTests.xctest */,
325368
AA3B40912D2FC8560099996A /* CoderSDK.framework */,
326369
AA3B40982D2FC8560099996A /* CoderSDKTests.xctest */,
370+
3B0916552D41B9690064DEA8 /* VPNXPC.xpc */,
327371
);
328372
name = Products;
329373
sourceTree = "<group>";
@@ -356,6 +400,28 @@
356400
/* End PBXHeadersBuildPhase section */
357401

358402
/* Begin PBXNativeTarget section */
403+
3B0916542D41B9690064DEA8 /* VPNXPC */ = {
404+
isa = PBXNativeTarget;
405+
buildConfigurationList = 3B0916662D41B9690064DEA8 /* Build configuration list for PBXNativeTarget "VPNXPC" */;
406+
buildPhases = (
407+
3B0916512D41B9690064DEA8 /* Sources */,
408+
3B0916522D41B9690064DEA8 /* Frameworks */,
409+
3B0916532D41B9690064DEA8 /* Resources */,
410+
);
411+
buildRules = (
412+
);
413+
dependencies = (
414+
);
415+
fileSystemSynchronizedGroups = (
416+
3B0916562D41B9690064DEA8 /* VPNXPC */,
417+
);
418+
name = VPNXPC;
419+
packageProductDependencies = (
420+
);
421+
productName = VPNXPC;
422+
productReference = 3B0916552D41B9690064DEA8 /* VPNXPC.xpc */;
423+
productType = "com.apple.product-type.xpc-service";
424+
};
359425
961678FB2CFF100D00B2B6DF /* Coder Desktop */ = {
360426
isa = PBXNativeTarget;
361427
buildConfigurationList = 961679232CFF100F00B2B6DF /* Build configuration list for PBXNativeTarget "Coder Desktop" */;
@@ -364,13 +430,15 @@
364430
961678F92CFF100D00B2B6DF /* Frameworks */,
365431
961678FA2CFF100D00B2B6DF /* Resources */,
366432
961679422CFF117300B2B6DF /* Embed System Extensions */,
433+
3B0916622D41B9690064DEA8 /* Embed XPC Services */,
367434
);
368435
buildRules = (
369436
);
370437
dependencies = (
371438
AA8BC33C2D0060E700E1ABAA /* PBXTargetDependency */,
372439
9616793C2CFF117300B2B6DF /* PBXTargetDependency */,
373440
AA3B40A32D2FC8560099996A /* PBXTargetDependency */,
441+
3B0916602D41B9690064DEA8 /* PBXTargetDependency */,
374442
);
375443
fileSystemSynchronizedGroups = (
376444
961678FE2CFF100D00B2B6DF /* Coder Desktop */,
@@ -566,6 +634,9 @@
566634
LastSwiftUpdateCheck = 1620;
567635
LastUpgradeCheck = 1620;
568636
TargetAttributes = {
637+
3B0916542D41B9690064DEA8 = {
638+
CreatedOnToolsVersion = 16.2;
639+
};
569640
961678FB2CFF100D00B2B6DF = {
570641
CreatedOnToolsVersion = 16.1;
571642
};
@@ -626,11 +697,19 @@
626697
AA3B3DA72D2D23860099996A /* VPNLibTests */,
627698
AA3B40902D2FC8560099996A /* CoderSDK */,
628699
AA3B40972D2FC8560099996A /* CoderSDKTests */,
700+
3B0916542D41B9690064DEA8 /* VPNXPC */,
629701
);
630702
};
631703
/* End PBXProject section */
632704

633705
/* Begin PBXResourcesBuildPhase section */
706+
3B0916532D41B9690064DEA8 /* Resources */ = {
707+
isa = PBXResourcesBuildPhase;
708+
buildActionMask = 2147483647;
709+
files = (
710+
);
711+
runOnlyForDeploymentPostprocessing = 0;
712+
};
634713
961678FA2CFF100D00B2B6DF /* Resources */ = {
635714
isa = PBXResourcesBuildPhase;
636715
buildActionMask = 2147483647;
@@ -690,6 +769,13 @@
690769
/* End PBXResourcesBuildPhase section */
691770

692771
/* Begin PBXSourcesBuildPhase section */
772+
3B0916512D41B9690064DEA8 /* Sources */ = {
773+
isa = PBXSourcesBuildPhase;
774+
buildActionMask = 2147483647;
775+
files = (
776+
);
777+
runOnlyForDeploymentPostprocessing = 0;
778+
};
693779
961678F82CFF100D00B2B6DF /* Sources */ = {
694780
isa = PBXSourcesBuildPhase;
695781
buildActionMask = 2147483647;
@@ -749,6 +835,11 @@
749835
/* End PBXSourcesBuildPhase section */
750836

751837
/* Begin PBXTargetDependency section */
838+
3B0916602D41B9690064DEA8 /* PBXTargetDependency */ = {
839+
isa = PBXTargetDependency;
840+
target = 3B0916542D41B9690064DEA8 /* VPNXPC */;
841+
targetProxy = 3B09165F2D41B9690064DEA8 /* PBXContainerItemProxy */;
842+
};
752843
961679112CFF100E00B2B6DF /* PBXTargetDependency */ = {
753844
isa = PBXTargetDependency;
754845
target = 961678FB2CFF100D00B2B6DF /* Coder Desktop */;
@@ -811,6 +902,54 @@
811902
/* End PBXTargetDependency section */
812903

813904
/* Begin XCBuildConfiguration section */
905+
3B0916632D41B9690064DEA8 /* Debug */ = {
906+
isa = XCBuildConfiguration;
907+
buildSettings = {
908+
CODE_SIGN_ENTITLEMENTS = VPNXPC/VPNXPC.entitlements;
909+
CODE_SIGN_IDENTITY = "Apple Development";
910+
CODE_SIGN_STYLE = Automatic;
911+
COMBINE_HIDPI_IMAGES = YES;
912+
CURRENT_PROJECT_VERSION = 1;
913+
DEVELOPMENT_TEAM = 4399GN35BJ;
914+
ENABLE_HARDENED_RUNTIME = YES;
915+
GENERATE_INFOPLIST_FILE = YES;
916+
INFOPLIST_FILE = VPNXPC/Info.plist;
917+
INFOPLIST_KEY_CFBundleDisplayName = VPNXPC;
918+
INFOPLIST_KEY_NSHumanReadableCopyright = "";
919+
MACOSX_DEPLOYMENT_TARGET = 14.6;
920+
MARKETING_VERSION = 1.0;
921+
PRODUCT_BUNDLE_IDENTIFIER = "com.coder.Coder-Desktop.VPNXPC";
922+
PRODUCT_NAME = "$(TARGET_NAME)";
923+
SKIP_INSTALL = YES;
924+
SWIFT_EMIT_LOC_STRINGS = YES;
925+
SWIFT_VERSION = 5.0;
926+
};
927+
name = Debug;
928+
};
929+
3B0916642D41B9690064DEA8 /* Release */ = {
930+
isa = XCBuildConfiguration;
931+
buildSettings = {
932+
CODE_SIGN_ENTITLEMENTS = VPNXPC/VPNXPC.entitlements;
933+
CODE_SIGN_IDENTITY = "Apple Development";
934+
CODE_SIGN_STYLE = Automatic;
935+
COMBINE_HIDPI_IMAGES = YES;
936+
CURRENT_PROJECT_VERSION = 1;
937+
DEVELOPMENT_TEAM = 4399GN35BJ;
938+
ENABLE_HARDENED_RUNTIME = YES;
939+
GENERATE_INFOPLIST_FILE = YES;
940+
INFOPLIST_FILE = VPNXPC/Info.plist;
941+
INFOPLIST_KEY_CFBundleDisplayName = VPNXPC;
942+
INFOPLIST_KEY_NSHumanReadableCopyright = "";
943+
MACOSX_DEPLOYMENT_TARGET = 14.6;
944+
MARKETING_VERSION = 1.0;
945+
PRODUCT_BUNDLE_IDENTIFIER = "com.coder.Coder-Desktop.VPNXPC";
946+
PRODUCT_NAME = "$(TARGET_NAME)";
947+
SKIP_INSTALL = YES;
948+
SWIFT_EMIT_LOC_STRINGS = YES;
949+
SWIFT_VERSION = 5.0;
950+
};
951+
name = Release;
952+
};
814953
961679212CFF100F00B2B6DF /* Debug */ = {
815954
isa = XCBuildConfiguration;
816955
buildSettings = {
@@ -1148,7 +1287,7 @@
11481287
DYLIB_COMPATIBILITY_VERSION = 1;
11491288
DYLIB_CURRENT_VERSION = 1;
11501289
DYLIB_INSTALL_NAME_BASE = "@rpath";
1151-
ENABLE_MODULE_VERIFIER = NO;
1290+
ENABLE_MODULE_VERIFIER = YES;
11521291
GENERATE_INFOPLIST_FILE = YES;
11531292
INFOPLIST_KEY_NSHumanReadableCopyright = "";
11541293
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -1185,7 +1324,7 @@
11851324
DYLIB_COMPATIBILITY_VERSION = 1;
11861325
DYLIB_CURRENT_VERSION = 1;
11871326
DYLIB_INSTALL_NAME_BASE = "@rpath";
1188-
ENABLE_MODULE_VERIFIER = NO;
1327+
ENABLE_MODULE_VERIFIER = YES;
11891328
GENERATE_INFOPLIST_FILE = YES;
11901329
INFOPLIST_KEY_NSHumanReadableCopyright = "";
11911330
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -1248,6 +1387,7 @@
12481387
buildSettings = {
12491388
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
12501389
CODE_SIGN_IDENTITY = "";
1390+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
12511391
CODE_SIGN_STYLE = Automatic;
12521392
COMBINE_HIDPI_IMAGES = YES;
12531393
CURRENT_PROJECT_VERSION = 1;
@@ -1256,7 +1396,7 @@
12561396
DYLIB_COMPATIBILITY_VERSION = 1;
12571397
DYLIB_CURRENT_VERSION = 1;
12581398
DYLIB_INSTALL_NAME_BASE = "@rpath";
1259-
ENABLE_MODULE_VERIFIER = NO;
1399+
ENABLE_MODULE_VERIFIER = YES;
12601400
GENERATE_INFOPLIST_FILE = YES;
12611401
INFOPLIST_KEY_NSHumanReadableCopyright = "";
12621402
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -1285,6 +1425,7 @@
12851425
buildSettings = {
12861426
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
12871427
CODE_SIGN_IDENTITY = "";
1428+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
12881429
CODE_SIGN_STYLE = Automatic;
12891430
COMBINE_HIDPI_IMAGES = YES;
12901431
CURRENT_PROJECT_VERSION = 1;
@@ -1293,7 +1434,7 @@
12931434
DYLIB_COMPATIBILITY_VERSION = 1;
12941435
DYLIB_CURRENT_VERSION = 1;
12951436
DYLIB_INSTALL_NAME_BASE = "@rpath";
1296-
ENABLE_MODULE_VERIFIER = NO;
1437+
ENABLE_MODULE_VERIFIER = YES;
12971438
GENERATE_INFOPLIST_FILE = YES;
12981439
INFOPLIST_KEY_NSHumanReadableCopyright = "";
12991440
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -1354,6 +1495,15 @@
13541495
/* End XCBuildConfiguration section */
13551496

13561497
/* Begin XCConfigurationList section */
1498+
3B0916662D41B9690064DEA8 /* Build configuration list for PBXNativeTarget "VPNXPC" */ = {
1499+
isa = XCConfigurationList;
1500+
buildConfigurations = (
1501+
3B0916632D41B9690064DEA8 /* Debug */,
1502+
3B0916642D41B9690064DEA8 /* Release */,
1503+
);
1504+
defaultConfigurationIsVisible = 0;
1505+
defaultConfigurationName = Release;
1506+
};
13571507
961678F72CFF100D00B2B6DF /* Build configuration list for PBXProject "Coder Desktop" */ = {
13581508
isa = XCConfigurationList;
13591509
buildConfigurations = (

Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ struct DesktopApp: App {
2020
@MainActor
2121
class AppDelegate: NSObject, NSApplicationDelegate {
2222
private var menuBarExtra: FluidMenuBarExtra?
23-
let vpn: PreviewVPN
23+
let vpn: CoderVPNService
2424
let session: PreviewSession
2525

2626
override init() {
27+
vpn = CoderVPNService()
2728
// TODO: Replace with real implementations
28-
vpn = PreviewVPN()
2929
session = PreviewSession()
3030
}
3131

3232
func applicationDidFinishLaunching(_: Notification) {
3333
menuBarExtra = FluidMenuBarExtra(title: "Coder Desktop", image: "MenuBarIcon") {
34-
VPNMenu<PreviewVPN, PreviewSession>().frame(width: 256)
34+
VPNMenu<CoderVPNService, PreviewSession>().frame(width: 256)
3535
.environmentObject(self.vpn)
3636
.environmentObject(self.session)
3737
}

0 commit comments

Comments
 (0)