mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-06 00:00:03 +08:00
Merge tag '0.2.0' into develop
no message
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.1.0</string>
|
<string>0.2.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|||||||
4
NOTICE
4
NOTICE
@@ -4,7 +4,6 @@ Third party libraries used by the OpenVPNAdapter project:
|
|||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Dependency: https://github.com/OpenVPN/openvpn3
|
Dependency: https://github.com/OpenVPN/openvpn3
|
||||||
Revision: 3e002c83ce2e9f9f40ddcee750d3cfa664238abe
|
|
||||||
License type: GNU Affero General Public License - Version 3.0
|
License type: GNU Affero General Public License - Version 3.0
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
OpenVPN Library
|
OpenVPN Library
|
||||||
@@ -675,7 +674,6 @@ For more information on this, and how to apply and follow the GNU AGPL, see
|
|||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Dependency: https://github.com/ARMmbed/mbedtls
|
Dependency: https://github.com/ARMmbed/mbedtls
|
||||||
Revision: 72ea31b026e1fc61b01662474aa5125817b968bc
|
|
||||||
License type: Apache License - Version 2.0
|
License type: Apache License - Version 2.0
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
mbedTLS Library
|
mbedTLS Library
|
||||||
@@ -886,7 +884,6 @@ limitations under the License.
|
|||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Dependency: https://github.com/chriskohlhoff/asio
|
Dependency: https://github.com/chriskohlhoff/asio
|
||||||
Revision: 72ea31b026e1fc61b01662474aa5125817b968bc
|
|
||||||
License type: Boost Software License - Version 1.0
|
License type: Boost Software License - Version 1.0
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
ASIO Library
|
ASIO Library
|
||||||
@@ -920,7 +917,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Dependency: https://github.com/lz4/lz4
|
Dependency: https://github.com/lz4/lz4
|
||||||
Revision: c10863b98e1503af90616ae99725ecd120265dfb
|
|
||||||
License type: BSD 2-Clause License
|
License type: BSD 2-Clause License
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
LZ4 Library
|
LZ4 Library
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
|
|||||||
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||||
|
|
||||||
s.name = "OpenVPNAdapter"
|
s.name = "OpenVPNAdapter"
|
||||||
s.version = "0.1.0"
|
s.version = "0.2.0"
|
||||||
s.summary = "Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS."
|
s.summary = "Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS."
|
||||||
s.description = <<-DESC
|
s.description = <<-DESC
|
||||||
OpenVPNAdapter is an Objective-C framework that allows to easily configure and establish VPN connection using OpenVPN protocol.
|
OpenVPNAdapter is an Objective-C framework that allows to easily configure and establish VPN connection using OpenVPN protocol.
|
||||||
@@ -143,7 +143,7 @@ Pod::Spec.new do |s|
|
|||||||
|
|
||||||
openvpn.xcconfig = {
|
openvpn.xcconfig = {
|
||||||
"HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{openvpn_path}/**",
|
"HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{openvpn_path}/**",
|
||||||
"OTHER_CPLUSPLUSFLAGS" => "$(OTHER_CFLAGS) -DUSE_ASIO -DUSE_ASIO_THREADLOCAL -DASIO_STANDALONE -DASIO_NO_DEPRECATED -DHAVE_LZ4 -DUSE_MBEDTLS -DOPENVPN_FORCE_TUN_NULL -DUSE_TUN_BUILDER"
|
"OTHER_CPLUSPLUSFLAGS" => "$(OTHER_CFLAGS) -DUSE_ASIO -DUSE_ASIO_THREADLOCAL -DASIO_STANDALONE -DASIO_NO_DEPRECATED -DASIO_HAS_STD_STRING_VIEW -DHAVE_LZ4 -DUSE_MBEDTLS -DOPENVPN_FORCE_TUN_NULL -DUSE_TUN_BUILDER"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -33,7 +33,7 @@ To install OpenVPNAdapter with Cocoapods, add the following lines to your `Podfi
|
|||||||
```ruby
|
```ruby
|
||||||
target 'Your Target Name' do
|
target 'Your Target Name' do
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.1.0'
|
pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.2.0'
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ Then we need to create or load a VPN profile. [`NETunnelProviderManager`](https:
|
|||||||
```swift
|
```swift
|
||||||
NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
|
NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
|
||||||
guard error == nil else {
|
guard error == nil else {
|
||||||
// Handle an occured error
|
// Handle an occurred error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ The next step is to provide VPN settings to the instance of [`NETunnelProviderMa
|
|||||||
```swift
|
```swift
|
||||||
self.providerManager?.loadFromPreferences(completionHandler: { (error) in
|
self.providerManager?.loadFromPreferences(completionHandler: { (error) in
|
||||||
guard error == nil else {
|
guard error == nil else {
|
||||||
// Handle an occured error
|
// Handle an occurred error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ self.providerManager?.loadFromPreferences(completionHandler: { (error) in
|
|||||||
// Save configuration in the Network Extension preferences
|
// Save configuration in the Network Extension preferences
|
||||||
self.providerManager?.saveToPreferences(completionHandler: { (error) in
|
self.providerManager?.saveToPreferences(completionHandler: { (error) in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
// Handle an occured error
|
// Handle an occurred error
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -118,14 +118,14 @@ Start VPN by calling the following code.
|
|||||||
```swift
|
```swift
|
||||||
self.providerManager?.loadFromPreferences(completionHandler: { (error) in
|
self.providerManager?.loadFromPreferences(completionHandler: { (error) in
|
||||||
guard error == nil else {
|
guard error == nil else {
|
||||||
// Handle an occured error
|
// Handle an occurred error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try self.providerManager?.connection.startVPNTunnel()
|
try self.providerManager?.connection.startVPNTunnel()
|
||||||
} catch {
|
} catch {
|
||||||
// Handle an occured error
|
// Handle an occurred error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -247,7 +247,12 @@ extension PacketTunnelProvider: OpenVPNAdapterDelegate {
|
|||||||
// `OpenVPNAdapterPacketFlow` method signatures are similar to `NEPacketTunnelFlow` so
|
// `OpenVPNAdapterPacketFlow` method signatures are similar to `NEPacketTunnelFlow` so
|
||||||
// you can just extend that class to adopt `OpenVPNAdapterPacketFlow` protocol and
|
// you can just extend that class to adopt `OpenVPNAdapterPacketFlow` protocol and
|
||||||
// send `self.packetFlow` to `completionHandler` callback.
|
// send `self.packetFlow` to `completionHandler` callback.
|
||||||
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings, completionHandler: @escaping (OpenVPNAdapterPacketFlow?) -> Void) {
|
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings?, completionHandler: @escaping (OpenVPNAdapterPacketFlow?) -> Void) {
|
||||||
|
// In order to direct all DNS queries first to the VPN DNS servers before the primary DNS servers
|
||||||
|
// send empty string to NEDNSSettings.matchDomains
|
||||||
|
networkSettings?.dnsSettings?.matchDomains = [""]
|
||||||
|
|
||||||
|
// Specify the network settings for the current tunneling session.
|
||||||
setTunnelNetworkSettings(settings) { (error) in
|
setTunnelNetworkSettings(settings) { (error) in
|
||||||
completionHandler(error == nil ? self.packetFlow : nil)
|
completionHandler(error == nil ? self.packetFlow : nil)
|
||||||
}
|
}
|
||||||
@@ -320,7 +325,7 @@ extension NEPacketTunnelFlow: OpenVPNAdapterPacketFlow {}
|
|||||||
Any contributions and suggestions are welcome! But before creating a PR or an issue please read the [Contribution Guide](CONTRIBUTING.md).
|
Any contributions and suggestions are welcome! But before creating a PR or an issue please read the [Contribution Guide](CONTRIBUTING.md).
|
||||||
|
|
||||||
## Acknowledgments
|
## Acknowledgments
|
||||||
Special thanks goes to @JonathanDowning for great help in development of this project and bug fixing.
|
Special thanks goes to [@JonathanDowning](https://github.com/JonathanDowning) for great help in development of this project and bug fixing.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
OpenVPNAdapter is available under the AGPLv3 license. See the [LICENSE](LICENSE) file for more info. Also this project has a few dependencies:
|
OpenVPNAdapter is available under the AGPLv3 license. See the [LICENSE](LICENSE) file for more info. Also this project has a few dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user