Rework App+Kit as monorepository (#1055)

Simplify development and maintenance immensely by making this a
monorepository:

- Convert PassepartoutKit and VPN bindings to local packages
  - OpenVPN/OpenSSL
  - WireGuard/Go
- Make PassepartoutKit available via
  - Source submodule for production (private)
- [Binary XCFramework for
development](https://github.com/passepartoutvpn/passepartoutkit)
 - Add PassepartoutKit Demo in root
   - Deploy package later
This commit is contained in:
Davide 2025-01-13 12:26:53 +01:00 committed by GitHub
parent 537c5fd12c
commit 1942b82ebb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
578 changed files with 28871 additions and 130 deletions

View File

@ -25,5 +25,5 @@ jobs:
access_token: ${{ secrets.ACCESS_TOKEN }}
- name: "Run tests"
run: |
cd Library
cd Packages/App
swift test

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Packages/PassepartoutKit"]
path = Packages/PassepartoutKit
url = git@github.com:passepartoutvpn/passepartoutkit-source.git

View File

@ -6,8 +6,8 @@ included:
- Passepartout/Tests
- Passepartout/Tunnel
- Passepartout/UITests
- Library/Sources
- Library/Tests
- Packages/App/Sources
- Packages/App/Tests
analyzer_rules:
- unused_declaration
- unused_import

View File

@ -0,0 +1,630 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
0E0A13E82BA5943800D06664 /* Demo+OpenVPN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0A13E72BA5943800D06664 /* Demo+OpenVPN.swift */; };
0E0A13EC2BA5C10400D06664 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0A13EB2BA5C10400D06664 /* Shared.swift */; };
0E0A13ED2BA5C11200D06664 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0A13EB2BA5C10400D06664 /* Shared.swift */; };
0E179B2F2B8A6D2C0053163E /* DemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E179B2A2B8A6D2C0053163E /* DemoApp.swift */; };
0E179B302B8A6D2C0053163E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E179B2B2B8A6D2C0053163E /* ContentView.swift */; };
0E336F682B9232CD00BE7BA6 /* Demo+Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E336F662B9232CD00BE7BA6 /* Demo+Profile.swift */; };
0E8445A82BD8E7360019DF51 /* Files in Resources */ = {isa = PBXBuildFile; fileRef = 0E8445A72BD8E7360019DF51 /* Files */; };
0E9CFB7B2B8B34C0009C8D82 /* Shared+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E9CFB7A2B8B34C0009C8D82 /* Shared+App.swift */; };
0EA088D52D352AF5004FC100 /* ExternalDependencies in Frameworks */ = {isa = PBXBuildFile; productRef = 0EA088D42D352AF5004FC100 /* ExternalDependencies */; };
0EA088D72D352AF8004FC100 /* ExternalDependencies in Frameworks */ = {isa = PBXBuildFile; productRef = 0EA088D62D352AF8004FC100 /* ExternalDependencies */; };
0EC332CA2B8A1808000B9C2F /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EC332C92B8A1808000B9C2F /* NetworkExtension.framework */; };
0EC332CD2B8A1808000B9C2F /* PacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC332CC2B8A1808000B9C2F /* PacketTunnelProvider.swift */; };
0EC332D22B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 0EC332C82B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0ED5F8FA2BB34C8C007F8E85 /* Demo+WireGuard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED5F8F92BB34C8C007F8E85 /* Demo+WireGuard.swift */; };
0ED5F8FF2BB3562E007F8E85 /* Shared+Tunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED5F8FD2BB3561F007F8E85 /* Shared+Tunnel.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
0EC332D02B8A1808000B9C2F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0E06D1872B87629100176E1D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 0EC332C72B8A1808000B9C2F;
remoteInfo = Tunnel;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0EC332D62B8A1808000B9C2F /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
0EC332D22B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0E06D18F2B87629100176E1D /* PassepartoutKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PassepartoutKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
0E0A13E72BA5943800D06664 /* Demo+OpenVPN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Demo+OpenVPN.swift"; sourceTree = "<group>"; };
0E0A13EB2BA5C10400D06664 /* Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shared.swift; sourceTree = "<group>"; };
0E179B252B8A6D2C0053163E /* App.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
0E179B2A2B8A6D2C0053163E /* DemoApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoApp.swift; sourceTree = "<group>"; };
0E179B2B2B8A6D2C0053163E /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
0E336F662B9232CD00BE7BA6 /* Demo+Profile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Demo+Profile.swift"; sourceTree = "<group>"; };
0E8445A72BD8E7360019DF51 /* Files */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Files; sourceTree = "<group>"; };
0E94EE5D2B93571800588243 /* Tunnel.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Tunnel.plist; sourceTree = "<group>"; };
0E9CFB7A2B8B34C0009C8D82 /* Shared+App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Shared+App.swift"; sourceTree = "<group>"; };
0EA088D32D352A68004FC100 /* ExternalDependencies */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = ExternalDependencies; sourceTree = "<group>"; };
0EC332C82B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = PassepartoutKitDemoTunnel.appex; sourceTree = BUILT_PRODUCTS_DIR; };
0EC332C92B8A1808000B9C2F /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
0EC332CC2B8A1808000B9C2F /* PacketTunnelProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PacketTunnelProvider.swift; sourceTree = "<group>"; };
0EC332CF2B8A1808000B9C2F /* Tunnel.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Tunnel.entitlements; sourceTree = "<group>"; };
0ED5F8F92BB34C8C007F8E85 /* Demo+WireGuard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Demo+WireGuard.swift"; sourceTree = "<group>"; };
0ED5F8FB2BB354B3007F8E85 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
0ED5F8FD2BB3561F007F8E85 /* Shared+Tunnel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Shared+Tunnel.swift"; sourceTree = "<group>"; };
0EFC561A2BB7032800D1C21E /* App.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = App.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0EC332C52B8A1808000B9C2F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0EA088D72D352AF8004FC100 /* ExternalDependencies in Frameworks */,
0EC332CA2B8A1808000B9C2F /* NetworkExtension.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0ED27CBF2B9331FF0089E26B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0EA088D52D352AF5004FC100 /* ExternalDependencies in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0E06D1862B87629100176E1D = {
isa = PBXGroup;
children = (
0E9CFB802B8B352A009C8D82 /* Demo */,
0E65068B2B950AC7008FC8F2 /* Packages */,
0E06D1902B87629100176E1D /* Products */,
0E06D1A32B8762AD00176E1D /* Frameworks */,
);
sourceTree = "<group>";
};
0E06D1902B87629100176E1D /* Products */ = {
isa = PBXGroup;
children = (
0E06D18F2B87629100176E1D /* PassepartoutKitDemo.app */,
0EC332C82B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex */,
);
name = Products;
sourceTree = "<group>";
};
0E06D1A32B8762AD00176E1D /* Frameworks */ = {
isa = PBXGroup;
children = (
0EC332C92B8A1808000B9C2F /* NetworkExtension.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0E179B242B8A6D2C0053163E /* App */ = {
isa = PBXGroup;
children = (
0ED5F9042BB35781007F8E85 /* Configuration */,
0E8445A72BD8E7360019DF51 /* Files */,
0EFC561A2BB7032800D1C21E /* App.plist */,
0E179B252B8A6D2C0053163E /* App.entitlements */,
0E179B2B2B8A6D2C0053163E /* ContentView.swift */,
0E179B2A2B8A6D2C0053163E /* DemoApp.swift */,
);
path = App;
sourceTree = "<group>";
};
0E65068B2B950AC7008FC8F2 /* Packages */ = {
isa = PBXGroup;
children = (
);
name = Packages;
sourceTree = "<group>";
};
0E9CFB7C2B8B34CC009C8D82 /* Shared */ = {
isa = PBXGroup;
children = (
0E0A13EB2BA5C10400D06664 /* Shared.swift */,
0E9CFB7A2B8B34C0009C8D82 /* Shared+App.swift */,
0ED5F8FD2BB3561F007F8E85 /* Shared+Tunnel.swift */,
);
path = Shared;
sourceTree = "<group>";
};
0E9CFB802B8B352A009C8D82 /* Demo */ = {
isa = PBXGroup;
children = (
0E179B242B8A6D2C0053163E /* App */,
0E9CFB7C2B8B34CC009C8D82 /* Shared */,
0EC332CB2B8A1808000B9C2F /* Tunnel */,
0EA088D32D352A68004FC100 /* ExternalDependencies */,
0ED5F8FB2BB354B3007F8E85 /* Config.xcconfig */,
);
path = Demo;
sourceTree = "<group>";
};
0EC332CB2B8A1808000B9C2F /* Tunnel */ = {
isa = PBXGroup;
children = (
0E94EE5D2B93571800588243 /* Tunnel.plist */,
0EC332CF2B8A1808000B9C2F /* Tunnel.entitlements */,
0EC332CC2B8A1808000B9C2F /* PacketTunnelProvider.swift */,
);
path = Tunnel;
sourceTree = "<group>";
};
0ED5F9042BB35781007F8E85 /* Configuration */ = {
isa = PBXGroup;
children = (
0E0A13E72BA5943800D06664 /* Demo+OpenVPN.swift */,
0E336F662B9232CD00BE7BA6 /* Demo+Profile.swift */,
0ED5F8F92BB34C8C007F8E85 /* Demo+WireGuard.swift */,
);
path = Configuration;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0E06D18E2B87629100176E1D /* PassepartoutKitDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0E06D19E2B87629200176E1D /* Build configuration list for PBXNativeTarget "PassepartoutKitDemo" */;
buildPhases = (
0E06D18B2B87629100176E1D /* Sources */,
0ED27CBF2B9331FF0089E26B /* Frameworks */,
0E06D18D2B87629100176E1D /* Resources */,
0EC332D62B8A1808000B9C2F /* Embed Foundation Extensions */,
);
buildRules = (
);
dependencies = (
0EC332D12B8A1808000B9C2F /* PBXTargetDependency */,
);
name = PassepartoutKitDemo;
productName = PassepartoutKit;
productReference = 0E06D18F2B87629100176E1D /* PassepartoutKitDemo.app */;
productType = "com.apple.product-type.application";
};
0EC332C72B8A1808000B9C2F /* PassepartoutKitDemoTunnel */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0EC332D32B8A1808000B9C2F /* Build configuration list for PBXNativeTarget "PassepartoutKitDemoTunnel" */;
buildPhases = (
0EC332C42B8A1808000B9C2F /* Sources */,
0EC332C52B8A1808000B9C2F /* Frameworks */,
0EC332C62B8A1808000B9C2F /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = PassepartoutKitDemoTunnel;
packageProductDependencies = (
0EA088D62D352AF8004FC100 /* ExternalDependencies */,
);
productName = Tunnel;
productReference = 0EC332C82B8A1808000B9C2F /* PassepartoutKitDemoTunnel.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0E06D1872B87629100176E1D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1520;
LastUpgradeCheck = 1610;
TargetAttributes = {
0E06D18E2B87629100176E1D = {
CreatedOnToolsVersion = 15.2;
};
0EC332C72B8A1808000B9C2F = {
CreatedOnToolsVersion = 15.2;
};
};
};
buildConfigurationList = 0E06D18A2B87629100176E1D /* Build configuration list for PBXProject "Demo" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 0E06D1862B87629100176E1D;
packageReferences = (
);
productRefGroup = 0E06D1902B87629100176E1D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0E06D18E2B87629100176E1D /* PassepartoutKitDemo */,
0EC332C72B8A1808000B9C2F /* PassepartoutKitDemoTunnel */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
0E06D18D2B87629100176E1D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E8445A82BD8E7360019DF51 /* Files in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EC332C62B8A1808000B9C2F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
0E06D18B2B87629100176E1D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E0A13EC2BA5C10400D06664 /* Shared.swift in Sources */,
0ED5F8FA2BB34C8C007F8E85 /* Demo+WireGuard.swift in Sources */,
0E0A13E82BA5943800D06664 /* Demo+OpenVPN.swift in Sources */,
0E179B2F2B8A6D2C0053163E /* DemoApp.swift in Sources */,
0E179B302B8A6D2C0053163E /* ContentView.swift in Sources */,
0E9CFB7B2B8B34C0009C8D82 /* Shared+App.swift in Sources */,
0E336F682B9232CD00BE7BA6 /* Demo+Profile.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EC332C42B8A1808000B9C2F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EC332CD2B8A1808000B9C2F /* PacketTunnelProvider.swift in Sources */,
0E0A13ED2BA5C11200D06664 /* Shared.swift in Sources */,
0ED5F8FF2BB3562E007F8E85 /* Shared+Tunnel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
0EC332D12B8A1808000B9C2F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 0EC332C72B8A1808000B9C2F /* PassepartoutKitDemoTunnel */;
targetProxy = 0EC332D02B8A1808000B9C2F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
0E06D19C2B87629200176E1D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0ED5F8FB2BB354B3007F8E85 /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
EXCLUDED_ARCHS = x86_64;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "$(TARGET_NAME)";
INFOPLIST_KEY_NSHumanReadableCopyright = "$(CFG_COPYRIGHT)";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
TVOS_DEPLOYMENT_TARGET = 17.0;
};
name = Debug;
};
0E06D19D2B87629200176E1D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0ED5F8FB2BB354B3007F8E85 /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
EXCLUDED_ARCHS = x86_64;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "$(TARGET_NAME)";
INFOPLIST_KEY_NSHumanReadableCopyright = "$(CFG_COPYRIGHT)";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_STRICT_CONCURRENCY = complete;
TVOS_DEPLOYMENT_TARGET = 17.0;
};
name = Release;
};
0E06D19F2B87629200176E1D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Demo/App/App.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DTDYD63ZX9;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = Demo/App/App.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Davide De Rosa. All rights reserved.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "$(CFG_APP_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
};
name = Debug;
};
0E06D1A02B87629200176E1D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Demo/App/App.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DTDYD63ZX9;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
INFOPLIST_FILE = Demo/App/App.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 Davide De Rosa. All rights reserved.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "$(CFG_APP_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
};
name = Release;
};
0EC332D42B8A1808000B9C2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Demo/Tunnel/Tunnel.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DTDYD63ZX9;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Demo/Tunnel/Tunnel.plist;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../../Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../../../../Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "$(CFG_TUNNEL_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6";
};
name = Debug;
};
0EC332D52B8A1808000B9C2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = Demo/Tunnel/Tunnel.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DTDYD63ZX9;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Demo/Tunnel/Tunnel.plist;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../../Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../../../../Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "$(CFG_TUNNEL_ID)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0E06D18A2B87629100176E1D /* Build configuration list for PBXProject "Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0E06D19C2B87629200176E1D /* Debug */,
0E06D19D2B87629200176E1D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0E06D19E2B87629200176E1D /* Build configuration list for PBXNativeTarget "PassepartoutKitDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0E06D19F2B87629200176E1D /* Debug */,
0E06D1A02B87629200176E1D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0EC332D32B8A1808000B9C2F /* Build configuration list for PBXNativeTarget "PassepartoutKitDemoTunnel" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EC332D42B8A1808000B9C2F /* Debug */,
0EC332D52B8A1808000B9C2F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCSwiftPackageProductDependency section */
0EA088D42D352AF5004FC100 /* ExternalDependencies */ = {
isa = XCSwiftPackageProductDependency;
productName = ExternalDependencies;
};
0EA088D62D352AF8004FC100 /* ExternalDependencies */ = {
isa = XCSwiftPackageProductDependency;
productName = ExternalDependencies;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 0E06D1872B87629100176E1D /* Project object */;
}

View File

@ -0,0 +1,32 @@
{
"pins" : [
{
"identity" : "openssl-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/openssl-apple",
"state" : {
"revision" : "685680e3adbfccdeef84d37fc5732b0031f188c7",
"version" : "3.2.108"
}
},
{
"identity" : "wg-go-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wg-go-apple",
"state" : {
"revision" : "860e82efaf261da37483a5f51555be83e5a79ad3",
"version" : "0.0.20240714"
}
},
{
"identity" : "wireguard-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wireguard-apple",
"state" : {
"revision" : "d8bcdf22f1e75d80caac874f302dee86194bb71d",
"version" : "1.1.2"
}
}
],
"version" : 2
}

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0EC332C72B8A1808000B9C2F"
BuildableName = "PassepartoutKitDemoTunnel.appex"
BlueprintName = "PassepartoutKitDemoTunnel"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0E06D18E2B87629100176E1D"
BuildableName = "PassepartoutKitDemo.app"
BlueprintName = "PassepartoutKitDemo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

30
Demo/App/App.entitlements Normal file
View File

@ -0,0 +1,30 @@
<?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.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(CFG_GROUP_ID)</string>
</array>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFG_GROUP_ID)</string>
</array>
</dict>
</plist>

17
Demo/App/App.plist Normal file
View File

@ -0,0 +1,17 @@
<?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>AppConfig</key>
<dict>
<key>team_id</key>
<string>$(CFG_TEAM_ID)</string>
<key>app_id</key>
<string>$(CFG_APP_ID)</string>
<key>group_id</key>
<string>$(CFG_GROUP_ID)</string>
<key>tunnel_id</key>
<string>$(CFG_TUNNEL_ID)</string>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,61 @@
//
// Demo+VPN.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 3/16/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutKit
import PassepartoutOpenVPNOpenSSL
extension OpenVPN {
static var demoModule: OpenVPNModule {
do {
let parser = StandardOpenVPNParser()
let result = try parser.parsed(fromURL: Constants.demoURL)
let builder = result.configuration.builder()
var module = OpenVPNModule.Builder(configurationBuilder: builder)
module.credentials = Constants.demoCredentials
return try module.tryBuild()
} catch {
fatalError("Unable to build: \(error)")
}
}
}
private enum Constants {
static let demoURL = Bundle.main.url(forResource: "Files/test-protonvpn", withExtension: "ovpn")!
static let demoCredentials: OpenVPN.Credentials = {
var builder = OpenVPN.Credentials.Builder()
if let url = Bundle.main.url(forResource: "Files/test-protonvpn", withExtension: "txt"),
let content = try? String(contentsOf: url, encoding: .utf8) {
let lines = content.split(separator: "\n")
if lines.count == 2 {
builder.username = String(lines[0])
builder.password = String(lines[1])
}
}
return builder.build()
}()
}

View File

@ -0,0 +1,77 @@
//
// Demo+Profile.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 2/22/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutKit
extension Profile {
static let demo: Profile = {
do {
guard let uuid = UUID(uuidString: "B316870C-4970-4981-8CE7-95700B2C33EC") else {
fatalError("No UUID")
}
var profile = Profile.Builder(id: uuid)
profile.name = "PassepartoutKitDemo"
let ovpn = OpenVPN.demoModule
profile.modules.append(ovpn)
let wg = WireGuard.demoModule
profile.modules.append(wg)
var dns = DNSModule.Builder()
dns.protocolType = .https
dns.servers = ["1.1.1.1"]
dns.dohURL = "https://1.1.1.1/dns-query"
profile.modules.append(try dns.tryBuild())
var ip = IPModule.Builder()
ip.ipv4 = IPSettings(subnet: nil)
.including(routes: [.init(defaultWithGateway: nil)])
// ip.ipv4 = IPSettings(subnet: nil)
// .excluding(routes: [
// .init(Subnet(rawValue: "192.168.43.0/24"), nil)
// ])
profile.modules.append(ip.tryBuild())
//
// var onDemand = OnDemandModule.Builder()
// onDemand.policy = .excluding
// onDemand.withSSIDs = ["iPhonx": true]
// profile.modules.append(onDemand.tryBuild())
//
// var filterModule = FilterModule.Builder()
// filterModule.disabledMask = [.dns]
// profile.modules.append(filterModule.tryBuild())
profile.activeModulesIds = [ovpn.id, dns.id, ip.id]
// profile.activeModulesIds = [wg.id]
return try profile.tryBuild()
} catch {
fatalError("Cannot build: \(error)")
}
}()
}

View File

@ -0,0 +1,45 @@
//
// Demo+WireGuard.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 3/26/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutKit
import PassepartoutWireGuardGo
extension WireGuard {
static var demoModule: WireGuardModule {
do {
let wg = try String(contentsOf: Constants.demoURL)
let builder = try StandardWireGuardParser().configuration(from: wg).builder()
let module = WireGuardModule.Builder(configurationBuilder: builder)
return try module.tryBuild()
} catch {
fatalError("Unable to build: \(error)")
}
}
}
private enum Constants {
static let demoURL = Bundle.main.url(forResource: "Files/test-protonvpn", withExtension: "wg")!
}

324
Demo/App/ContentView.swift Normal file
View File

@ -0,0 +1,324 @@
//
// ContentView.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 2/22/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import PassepartoutKit
import SwiftUI
private enum ButtonAction {
case connect
case disconnect
}
struct ContentView: View {
@State
private var profile: Profile = .demo
@StateObject
private var vpn: Tunnel = .shared
@State
private var buttonAction: ButtonAction = .connect
@State
private var dataCount: DataCount?
@State
private var isLoadingDebugLog = false
@State
private var isDebugLogPresented = false
@State
private var debugLog: [String] = []
private let timer = Timer.publish(every: 2.0, on: .main, in: .common)
.autoconnect()
var body: some View {
List {
modulesSection
vpnSection
advancedSection
}
.navigationTitle("Passepartout")
.onReceive(vpn.$status) {
buttonAction = ButtonAction(forStatus: $0)
}
.onReceive(timer) { _ in
guard vpn.status == .active else {
dataCount = nil
return
}
dataCount = Demo.environment.environmentValue(forKey: TunnelEnvironmentKeys.dataCount)
}
.sheet(isPresented: $isDebugLogPresented) {
debugLogView
}
.task {
do {
try await vpn.prepare(purge: false)
} catch {
print(error.localizedDescription)
}
}
}
}
private extension ContentView {
var modulesSection: some View {
Section {
ForEach(profile.modules, id: \.id) { module in
HStack {
Button(module.moduleHandler.id.name) {
onTapModule(module)
}
if profile.isActiveModule(withId: module.id) {
Spacer()
Image(systemName: "checkmark")
}
}
}
} header: {
Text("Modules")
}
}
var vpnSection: some View {
Section {
Button(buttonAction.title) {
onButton()
}
HStack {
Text("Status")
Spacer()
Text(vpn.status.localizedDescription)
}
dataCountDescription.map(Text.init)
} header: {
Text("VPN")
}
}
var advancedSection: some View {
Section {
HStack {
Button("Debug log") {
onDebugLog()
}
.disabled(isLoadingDebugLog)
if isLoadingDebugLog {
Spacer()
ProgressView()
}
}
#if !os(tvOS)
if profile.firstConnectionModule(ofType: OpenVPNModule.self, ifActive: true) != nil {
NavigationLink("Server configuration") {
serverConfigurationView
}
}
#endif
} header: {
Text("Advanced")
}
}
}
private extension ContentView {
var debugLogView: some View {
NavigationStack {
List {
ForEach(Array(debugLog.enumerated()), id: \.offset) { entry in
Text(entry.element)
}
}
.navigationTitle("Debug log")
.toolbar {
Button {
isDebugLogPresented = false
} label: {
Image(systemName: "xmark")
}
}
.monospaced()
#if os(macOS)
.frame(minWidth: 600.0, minHeight: 400.0)
#endif
}
}
#if !os(tvOS)
var serverConfigurationView: some View {
Demo.environment.environmentValue(forKey: TunnelEnvironmentKeys.OpenVPN.serverConfiguration)
.map {
TextEditor(text: .constant(String(describing: $0)))
.monospaced()
.padding()
}
}
#endif
}
// MARK: - Actions
private extension ContentView {
func onTapModule(_ module: Module) {
var builder = profile.builder()
if module is ConnectionModule {
builder.toggleExclusiveModule(withId: module.id) {
$0 is ConnectionModule
}
} else {
builder.toggleModule(withId: module.id)
}
do {
profile = try builder.tryBuild()
} catch {
print("Unable to toggle module: \(error)")
}
}
func onButton() {
Task {
do {
switch buttonAction {
case .connect:
try await vpn.install(profile, connect: true) {
"PassepartoutKitDemo: \($0.name)"
}
case .disconnect:
try await vpn.disconnect()
}
} catch {
print("Unable to start VPN: \(error.localizedDescription)")
}
}
}
func onDebugLog() {
isLoadingDebugLog = true
Task {
defer {
isLoadingDebugLog = false
}
do {
try await fetchDebugLog()
isDebugLogPresented = true
} catch {
print("Unable to fetch debug log: \(error)")
}
}
}
func fetchDebugLog() async throws {
guard vpn.status != .inactive else {
if PassepartoutConfiguration.shared.hasLocalLogger {
debugLog = try String(contentsOf: Demo.Log.tunnelURL)
.split(separator: "\n")
.map(String.init)
}
return
}
let interval: TimeInterval = 24 * 60 * 60 // 1 day
let message: Message.Input
message = .localLog(sinceLast: interval, maxLevel: Demo.Log.maxLevel)
guard let output = try await vpn.sendMessage(message) else {
return
}
guard case .debugLog(let log) = output else {
debugLog = []
return
}
debugLog = log
.lines
.map(Demo.Log.formattedLine)
}
}
private extension ButtonAction {
init(forStatus status: TunnelStatus) {
switch status {
case .inactive:
self = .connect
default:
self = .disconnect
}
}
}
// MARK: - L10n
private extension ButtonAction {
var title: String {
switch self {
case .connect:
return "Connect"
case .disconnect:
return "Disconnect"
}
}
}
private extension TunnelStatus {
var localizedDescription: String {
switch self {
case .inactive:
return "Inactive"
case .activating:
return "Activating"
case .active:
return "Active"
case .deactivating:
return "Deactivating"
}
}
}
private extension ContentView {
var dataCountDescription: String? {
guard vpn.status == .active, let dataCount else {
return nil
}
let down = dataCount.received.descriptionAsDataUnit
let up = dataCount.sent.descriptionAsDataUnit
return "\(down)\(up)"
}
}
// MARK: - Previews
#Preview {
ContentView()
}

48
Demo/App/DemoApp.swift Normal file
View File

@ -0,0 +1,48 @@
//
// DemoApp.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 2/22/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import PassepartoutKit
import SwiftUI
@main
struct DemoApp: App {
init() {
PassepartoutConfiguration.shared.logsModules = true
PassepartoutConfiguration.shared.setLocalLogger(options: .init(
url: Demo.Log.appURL,
maxNumberOfLines: Demo.Log.maxNumberOfLines,
maxLevel: Demo.Log.maxLevel,
mapper: Demo.Log.formattedLine
))
}
var body: some Scene {
WindowGroup {
NavigationStack {
ContentView()
}
}
}
}

1
Demo/App/Files/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
test-*

35
Demo/Config.xcconfig Normal file
View File

@ -0,0 +1,35 @@
//
// Config.xcconfig
// PassepartoutKit
//
// Created by Davide De Rosa on 3/26/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
CFG_TEAM_ID = DTDYD63ZX9
CFG_APP_ID = com.algoritmico.PassepartoutKit.Demo
CFG_TUNNEL_ID = $(CFG_APP_ID).Tunnel
CFG_GROUP_ID = group.$(CFG_APP_ID)
CFG_COPYRIGHT = Copyright © 2024 Davide De Rosa. All rights reserved.
#include? "Secret.xcconfig"

8
Demo/ExternalDependencies/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

View File

@ -0,0 +1,38 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "ExternalDependencies",
platforms: [
.iOS(.v16),
.macOS(.v13),
.tvOS(.v17)
],
products: [
.library(
name: "ExternalDependencies",
targets: ["ExternalDependencies"]
)
],
dependencies: [
.package(path: "../../Packages/PassepartoutKit-Framework"),
.package(path: "../../Packages/PassepartoutOpenVPNOpenSSL"),
.package(path: "../../Packages/PassepartoutWireGuardGo")
],
targets: [
.target(
name: "ExternalDependencies",
dependencies: [
"PassepartoutKit-Framework",
"PassepartoutOpenVPNOpenSSL",
"PassepartoutWireGuardGo"
]
),
.testTarget(
name: "ExternalDependenciesTests",
dependencies: ["ExternalDependencies"]
)
]
)

View File

@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book

View File

@ -0,0 +1,13 @@
import ExternalDependencies
import PassepartoutKit
import XCTest
final class ExternalDependenciesTests: XCTestCase {
func testExample() throws {
// XCTest Documentation
// https://developer.apple.com/documentation/xctest
// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
}
}

View File

@ -0,0 +1,52 @@
//
// Shared+App.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 2/25/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import PassepartoutKit
extension Demo.Log {
static let appURL = Demo.cachesURL.appending(component: "app.log")
}
// MARK: - Implementations
extension Registry {
static let shared = Registry()
}
extension Tunnel {
static let shared = Tunnel(strategy: {
#if targetEnvironment(simulator)
FakeTunnelStrategy(
environment: .shared
)
#else
NETunnelStrategy(
bundleIdentifier: Demo.tunnelBundleIdentifier,
coder: Demo.neProtocolCoder,
environment: .shared
)
#endif
}())
}

View File

@ -0,0 +1,65 @@
//
// Shared+Tunnel.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 3/26/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutKit
import PassepartoutOpenVPNOpenSSL
import PassepartoutWireGuardGo
// MARK: - Implementations
extension Registry {
static let shared = Registry(
withKnownHandlers: true,
allImplementations: [
OpenVPNModule.Implementation(
importer: StandardOpenVPNParser(),
connectionBlock: {
try await OpenVPNConnection(
parameters: $0,
module: $1,
cachesURL: Demo.moduleURL(for: "OpenVPN")
)
}
),
WireGuardModule.Implementation(
keyGenerator: StandardWireGuardKeyGenerator(),
importer: StandardWireGuardParser(),
connectionBlock: {
try WireGuardConnection(
parameters: $0,
module: $1
)
}
)
]
)
}
extension NEProtocolDecoder where Self == KeychainNEProtocolCoder {
static var shared: Self {
Demo.neProtocolCoder
}
}

117
Demo/Shared/Shared.swift Normal file
View File

@ -0,0 +1,117 @@
//
// Shared.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 3/16/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutKit
import PassepartoutWireGuardGo
enum Demo {
}
// MARK: Constants
extension Demo {
private static let appConfig = BundleConfiguration(.main, key: "AppConfig")!
static var teamIdentifier: String {
appConfig.value(forKey: "team_id")!
}
static var appIdentifier: String {
appConfig.value(forKey: "app_id")!
}
static var appGroupIdentifier: String {
appConfig.value(forKey: "group_id")!
}
static var tunnelBundleIdentifier: String {
appConfig.value(forKey: "tunnel_id")!
}
static var cachesURL: URL {
guard let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) else {
fatalError("Unable to access App Group container")
}
return url.appending(components: "Library", "Caches")
}
static func moduleURL(for name: String) -> URL {
do {
let url = cachesURL.appendingPathComponent(name)
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
return url
} catch {
fatalError("No access to caches directory")
}
}
}
extension Demo {
enum Log {
static let tunnelURL = Demo.cachesURL.appending(component: "tunnel.log")
static let maxNumberOfLines = 2000
static let maxLevel: DebugLog.Level = .info
static let saveInterval = 60000
static func formattedLine(_ line: DebugLog.Line) -> String {
let ts = line.timestamp
.formatted(
.dateTime
.hour(.twoDigits(amPM: .omitted))
.minute()
.second()
)
return "\(ts) - \(line.message)"
}
}
}
// MARK: - Implementations
extension Demo {
static var neProtocolCoder: KeychainNEProtocolCoder {
KeychainNEProtocolCoder(
tunnelBundleIdentifier: Demo.tunnelBundleIdentifier,
registry: .shared,
coder: CodableProfileCoder(),
keychain: AppleKeychain(group: "\(teamIdentifier).\(appGroupIdentifier)")
)
}
static var environment: AppGroupEnvironment {
AppGroupEnvironment(appGroup: appGroupIdentifier)
}
}
extension TunnelEnvironment where Self == AppGroupEnvironment {
static var shared: Self {
Demo.environment
}
}

View File

@ -0,0 +1,90 @@
//
// PacketTunnelProvider.swift
// PassepartoutKit
//
// Created by Davide De Rosa on 2/24/24.
// Copyright (c) 2024 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of PassepartoutKit.
//
// PassepartoutKit is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PassepartoutKit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with PassepartoutKit. If not, see <http://www.gnu.org/licenses/>.
//
@preconcurrency import NetworkExtension
import PassepartoutKit
final class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
private var fwd: NEPTPForwarder?
override init() {
PassepartoutConfiguration.shared.logsModules = true
PassepartoutConfiguration.shared.setLocalLogger(options: .init(
url: Demo.Log.tunnelURL,
maxNumberOfLines: Demo.Log.maxNumberOfLines,
maxLevel: Demo.Log.maxLevel,
mapper: Demo.Log.formattedLine
))
super.init()
}
override func startTunnel(options: [String: NSObject]? = nil) async throws {
do {
fwd = try await NEPTPForwarder(
provider: self,
decoder: .shared,
registry: .shared,
environment: .shared
)
try await fwd?.startTunnel(options: options)
} catch {
flushLog()
throw error
}
}
override func stopTunnel(with reason: NEProviderStopReason) async {
await fwd?.stopTunnel(with: reason)
fwd = nil
flushLog()
}
override func cancelTunnelWithError(_ error: Error?) {
flushLog()
super.cancelTunnelWithError(error)
}
override func handleAppMessage(_ messageData: Data) async -> Data? {
await fwd?.handleAppMessage(messageData)
}
override func wake() {
fwd?.wake()
}
override func sleep() async {
await fwd?.sleep()
}
}
private extension PacketTunnelProvider {
func flushLog() {
try? PassepartoutConfiguration.shared.saveLog()
Task {
try? await Task.sleep(milliseconds: Demo.Log.saveInterval)
flushLog()
}
}
}

View File

@ -0,0 +1,28 @@
<?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.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider</string>
</array>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(CFG_GROUP_ID)</string>
</array>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFG_GROUP_ID)</string>
</array>
</dict>
</plist>

24
Demo/Tunnel/Tunnel.plist Normal file
View File

@ -0,0 +1,24 @@
<?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>AppConfig</key>
<dict>
<key>team_id</key>
<string>$(CFG_TEAM_ID)</string>
<key>app_id</key>
<string>$(CFG_APP_ID)</string>
<key>group_id</key>
<string>$(CFG_GROUP_ID)</string>
<key>tunnel_id</key>
<string>$(CFG_TUNNEL_ID)</string>
</dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,59 @@
{
"pins" : [
{
"identity" : "dtfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/DTFoundation.git",
"state" : {
"revision" : "a61be65dd7d5b2cde3acabd13bf320b71f2907a5",
"version" : "1.7.19"
}
},
{
"identity" : "generic-json-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/iwill/generic-json-swift",
"state" : {
"revision" : "0a06575f4038b504e78ac330913d920f1630f510",
"version" : "2.0.2"
}
},
{
"identity" : "kvitto",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Cocoanetics/Kvitto",
"state" : {
"revision" : "88888674d772ddcf19671159ed0022cb0bc37be2",
"version" : "1.0.6"
}
},
{
"identity" : "openssl-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/openssl-apple",
"state" : {
"revision" : "685680e3adbfccdeef84d37fc5732b0031f188c7",
"version" : "3.2.108"
}
},
{
"identity" : "wg-go-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wg-go-apple",
"state" : {
"revision" : "860e82efaf261da37483a5f51555be83e5a79ad3",
"version" : "0.0.20240714"
}
},
{
"identity" : "wireguard-apple",
"kind" : "remoteSourceControl",
"location" : "https://github.com/passepartoutvpn/wireguard-apple",
"state" : {
"revision" : "d8bcdf22f1e75d80caac874f302dee86194bb71d",
"version" : "1.1.2"
}
}
],
"version" : 2
}

View File

@ -4,7 +4,7 @@
import PackageDescription
let package = Package(
name: "Library",
name: "App",
defaultLocalization: "en",
platforms: [
.iOS(.v16),
@ -43,10 +43,6 @@ let package = Package(
name: "LegacyV2",
targets: ["LegacyV2"]
),
.library(
name: "PassepartoutImplementations",
targets: ["PassepartoutImplementations"]
),
.library(
name: "TunnelLibrary",
targets: ["CommonLibrary"]
@ -61,15 +57,8 @@ let package = Package(
)
],
dependencies: [
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.14.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "8ced87ec9ea088603798be820ab8e2f1e71c2196"),
// .package(path: "../../passepartoutkit-source"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "1.0.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "12c8b9166ba2bf98b63d3ebc5b561ac2ac5a2f86"),
// .package(path: "../../passepartoutkit-source-openvpn-openssl"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", from: "1.0.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", revision: "279d1bb152e55162dcd2ac58208abf5e37a0a8d8"),
// .package(path: "../../passepartoutkit-source-wireguard-go"),
.package(path: "../PassepartoutOpenVPNOpenSSL"),
.package(path: "../PassepartoutWireGuardGo"),
.package(url: "https://github.com/Cocoanetics/Kvitto", from: "1.0.0")
],
targets: [
@ -155,7 +144,8 @@ let package = Package(
dependencies: [
"CommonIAP",
"CommonUtils",
.product(name: "PassepartoutKit", package: "passepartoutkit-source")
"PassepartoutOpenVPNOpenSSL",
"PassepartoutWireGuardGo"
],
resources: [
.process("Resources")
@ -167,22 +157,11 @@ let package = Package(
),
.target(
name: "LegacyV2",
dependencies: [
"CommonLibrary",
"PassepartoutImplementations"
],
dependencies: ["CommonLibrary"],
resources: [
.process("Profiles.xcdatamodeld")
]
),
.target(
name: "PassepartoutImplementations",
dependencies: [
.product(name: "PassepartoutKit", package: "passepartoutkit-source"),
.product(name: "PassepartoutOpenVPNOpenSSL", package: "passepartoutkit-source-openvpn-openssl"),
.product(name: "PassepartoutWireGuardGo", package: "passepartoutkit-source-wireguard-go")
]
),
.target(
name: "UIAccessibility"
),

Some files were not shown because too many files have changed in this diff Show More