This is a demo project which contains the steps to create App with TunnelRay library
Environment requirements:
- XCode: > 13.1
- Cocoapods: > 1.11.2
Detail steps
TunnelRay
library imported, and add some demo used UI
Part 1: Create a new project with the -
Close the XCode, go to the project folder, create a new file named
Podfile
with the following content:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'
## change to your target name
target 'Demo' do
use_frameworks!
pod 'TunnelRay', '>= 1.0.6'
end
- Run the following command to install the dependencies.
$ pod install
$ open -a xcode Demo.xcworkspace
Note: please always open your project with {Name}.xcworkspace instead of {Name}.xcodeproj
- Drag the following files from this project to your project under the corresponding location, and check the
Copy item if needed
:
Part 2: Create entitlements and Extension:
-
Add Network Extension as a new target with name
tunnel-extension
-
After the extension created, set up the entitlement to match the app on the extension like following:
-
Remove the
PacketTunnelProvider,swift
and Copy the following items from the this project to your project by dragging.- tunnel-extension/PacketTunnelProvider.swift
- tunnel-extension/libleaf/*
- tunnel-extension/Subnet.swift
- tunnel-extension/TunnelRay-Bridging-Header.h
- tunnel-extension/TunnelRayTunnelStore.swift
-
Append the following changed to the Podfile, and re-run the
pod install
command
target 'tunnel-extension' do
use_frameworks!
pod 'TunnelRay', '>= 1.0.6'
end