Open nirwanrajat opened 4 years ago
Hi @nirwanrajat,
I've never done split tunneling myself but I would recommend to take a look at routes configuration. NEPacketTunnelNetworkSettings
has ipv4Settings
and ipv6Settings
properties. Both of them have two arrays includedRoutes
and excludedRoutes
. routingMethod
property that belongs to the NEPacketTunnelProvider also maybe useful.
Hi @ss-abramchuk
Thanks for your response. As i look in code "routes configuration" is done inside the library. All the properties of NEPacketTunnelNetworkSettings is also set in library. So i think i have to made some changes in library routes configuration code.
Please suggest.
Actually, you don't need to change anything in the library. You can override NEPacketTunnelNetworkSettings
in one of the delegate methods. This one to be precise -> openVPNAdapter(openVPNAdapter:configureTunnelWithNetworkSettings:completionHandler:)
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 = [""]
networkSettings?.ipv4Settings?.excludedRoutes = [NEIPv4Route(destinationAddress: "xxx.xx.xxx.xx", subnetMask: "255.255.255.0")]
// Specify the network settings for the current tunneling session.
setTunnelNetworkSettings(networkSettings) { (error) in
completionHandler(error == nil ? self.packetFlow : nil)
}
}
this is working code snippet
@ss-abramchuk using this library can we implement active/in-active VPN while VPN is connected or we have only option i.e, disconnect the VPN ?
Hi @basheerpaliyathu
Thanks for your response.....i have implemented this. Can you please confirm one thing can we pass domain name in destination address. Suppose we have to exclude youtube traffic so how we exclude that or there is any way to getting youtube destination address?
@nirwanrajat did you achieve split tunneling for applications, for example i am using vpn on my macos app and i want skype to not use by pass vpn.
@NasrullahKhan no i am not able to achieve. I think split tunneling can not be do.
Hi guys, is there a way to pass a list of apps that only can use the vpn connection? example: I only need "WhatsApp, viber, others apps" to use the vpn other apps will bypass the vpn connection. Thank you in advance.
Did anyone figure out how to bypass VPN on specific apps?=) It's strange, that there is no any useful info/example how to do it...
Hi,
Thanks for providing a wonderful library and for your support.
Can you please tell, how can we implement Split Tunnel using this library?