Comments (13)
Hi @Richard1202,
You can download Simple macOS OpenVPN Client source code and use it as the example. Despite it is written for macOS the iOS code will be almost the same.
from openvpnadapter.
Thank you for your reply.
OpenVPNAdapter framework is different in sample you sent, I have to use it for iPhone Project.
When can I download source code of them and compile it?
from openvpnadapter.
Hi @ss-abramchuk,
Thank you for creating a wonderful framework and sharing the above Mac Client.
The Mac Client works like a charm with the OVPNs you shared as well as my Server OVPN.
I also created an iOS Client similar to the Mac Client you shared.
Unfortunately, the iOS Client doesn't seem to be working.
The connection request doesn't seem to reach the server at all.
It would very helpful if you could please help me in this regard.
My codebase is here: https://drive.google.com/open?id=1RGF_KOJOc7BKI2NoJRwPEfXDUCdTSkah
Highly appreciate your time and effort.
Thanks and Regards,
Roshit
from openvpnadapter.
Hi @ss-abramchuk
I have downloaded Simple macOS OpenVPN Client source, run code, but can not connect the vpn.
I have a issue, when PacketTunnelProvider exec, i have print some log in startTunnel func, but never
exec
any help best regards.
from openvpnadapter.
I have solved this issue, I need config your info.plist
add
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
Then, you will see your provider be called
from openvpnadapter.
Thank you for the response.
The mentioned NSExtension key was always part of the plist file of the Tunnel Provider.
Should I also add to the plist of main project as well?
I tried adding it to the plist of the project, but the app screen turned Black and non responsive.
from openvpnadapter.
@roshit-omanakuttan
If you create packetTunnel plist will auto generate, info.plist just config at packetTunnel not in you main project. you can call provider code as below
class ViewController: NSViewController {
var manager: NETunnelProviderManager?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
@IBAction func establishVPNConnection(_ sender: Any) {
let callback = { (error: Error?) -> Void in
self.manager?.loadFromPreferences(completionHandler: { (error) in
guard error == nil else {
print("\(error!.localizedDescription)")
return
}
let options: [String : NSObject] = [
"username": "freeopenvpn" as NSString,
"password": "819646439" as NSString
]
do {
// this will call providerTunnerProvider startTunnel method
try self.manager?.connection.startVPNTunnel(options: options)
} catch {
print("\(error.localizedDescription)")
}
})
}
configureVPN(callback: callback)
}
}
extension ViewController {
func configureVPN(callback: @escaping (Error?) -> Void) {
NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
guard error == nil else {
print("\(error!.localizedDescription)")
callback(error)
return
}
self.manager = managers?.first ?? NETunnelProviderManager()
self.manager?.loadFromPreferences(completionHandler: { (error) in
guard error == nil else {
print("\(error!.localizedDescription)")
callback(error)
return
}
let configurationFile = Bundle.main.url(forResource: "freeopenvpn_DE_udp", withExtension: "ovpn")
let configurationContent = try! Data(contentsOf: configurationFile!)
let tunnelProtocol = NETunnelProviderProtocol()
tunnelProtocol.serverAddress = "freeopenvpn.org"
tunnelProtocol.providerBundleIdentifier = "me.ss-abramchuk.openvpn-macos-client.tunnel-provider"
tunnelProtocol.providerConfiguration = ["configuration": configurationContent]
tunnelProtocol.disconnectOnSleep = false
self.manager?.protocolConfiguration = tunnelProtocol
self.manager?.localizedDescription = "OpenVPN macOS Client"
self.manager?.isEnabled = true
self.manager?.saveToPreferences(completionHandler: { (error) in
guard error == nil else {
print("\(error!.localizedDescription)")
callback(error)
return
}
callback(nil)
})
})
}
}
}
Notice: the log of packetTunnelProvider not show xocde console, you should cat in device log .
from openvpnadapter.
@roshit-omanakuttan
This is a simple demo
https://github.com/googleliyang/openvpn_adapter_ios
from openvpnadapter.
@googleliyang
Thank you so much for sharing the Codebase.
I ran the app on my device, but unfortunately I am getting the below logs:
exec connect
connecting
off
from openvpnadapter.
Hi @googleliyang
I am developing OpenVPN in iOS. I followed instruction. But I am unable to achieve it. Can you please share sample project for iOS.
Regards
from openvpnadapter.
@roshit-omanakuttan
This is a simple demo
https://github.com/googleliyang/openvpn_adapter_ios
Above URL doesn't exist now. Can you please share updated URL?
from openvpnadapter.
Hi @ss-abramchuk
Can you please re-share your Simple macOS OpenVPN Client source code download link,
the project not there and we cant download it.
Thanks a lot!
from openvpnadapter.
Hi @jonathanGuez01,
Here is new link to the project.
from openvpnadapter.
Related Issues (20)
- System Network Extension connects to VPN via OpenVPN protocol, but can't view any web pages HOT 2
- v0.7.0 connect failed HOT 5
- Disconnected and reconnected without network HOT 4
- 只在App应用内部使用openVPN, 就不需要使用Application Extension了吧
- Problem with SPM HOT 2
- Not working with iOS 15 and macOS 12.0.
- How to increase timeout during initial handshake? HOT 3
- I don't get call of func startTunnel(options...) on MacOS 10.15.7 but it works good on MacOS 11... HOT 4
- iOS client may not support pac
- 有人碰到过这个问题么,上传应用的时候
- Error setting up TUN/TAP interface
- Did it still work? HOT 4
- When i called removeFromPreferences, get some error
- Can't save config when connecting though "Intent Extension". HOT 1
- About Process IPv4 or IPv6 route
- .OVPN connectivity
- why can not I connect by password and username HOT 1
- Switch Wi-Fi to 4G, and the VPN is closed HOT 4
- not working on mac catalyst HOT 3
- Limit OpenVPN Connection time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openvpnadapter.