FuturraGroup / OpenVPNXor

Library for simple connection via OpenVPN protocol with Xor patch.
MIT License
10 stars 2 forks source link

Not connecting to tunnel server #7

Closed manglikankit closed 9 months ago

manglikankit commented 9 months ago

Hi Can someone help to to create a tunnel connection. I have configured everything but still while I try to connect then app is not trying to connect to the tunnel server. Any specific reason for the same.

sergey-zhuravel commented 9 months ago

please write more details, everything works for me

manglikankit commented 9 months ago

First I've imported the lib using : platform :ios, '11.0' use_frameworks!

def sharedPods pod 'OpenVPNXor' end

target 'Example VPN' do sharedPods end

target 'PacketTunnelOpenVPN' do sharedPods end

Then added the below line into AppDelegate class OpenVPNManager.setup(openvpnPacketTunnelIdentifier: "myidentifier", appGroupIdentifier: "group.mygroupName")

Added the PacketTunnelProvider class configuration as mentioned

Passing the data ;

let configurationFileContent = // .ovpn config data let login = "username" let pass = "password"

OpenVPNManager.shared.configureVPN(openVPNConfiguration: configurationFileContent, login: login, pass:pass) { success in if success { /// Profile saved successfully. } else { /// Error saving profile. See the description of the error in the delegate method - VpnManagerConnectionFailed } }

Once profile is being saved then calling next method : OpenVPNManager.shared.connectVPN { errorDescription in /// If an error occurred while connecting, the errorDescription variable will contain a description of the error. }

From here I'm unable to debug further even none of following case is calling.

OpenVPNManager.shared.onVPNStatusChange = { (status) in switch status { case .invalid: / @const VPNStatusDisconnected The VPN is disconnected. */ break case .disconnected: /* @const VPNStatusDisconnected The VPN is disconnected. / break case .connecting: / @const VPNStatusConnecting The VPN is connecting. */ break case .connected: / @const VPNStatusConnected The VPN is connected. */ break case .reasserting: /* @const VPNStatusReasserting The VPN is reconnecting following loss of underlying network connectivity. / break case .disconnecting: / @const VPNStatusDisconnecting The VPN is disconnecting. */ break } }

sergey-zhuravel commented 9 months ago

in the "configurationFileContent" variable you need to write the server config with the ".ovpn" configuration file

manglikankit commented 9 months ago

I got my issue and now its working. Thanks Sergey for your support.