Post

Replies

Boosts

Views

Activity

Issues with VOIP Calls on iOS Local Proxy Server using NEPacketTunnelProvider
Hi there! I recently used SwiftNIO example - Connect Proxy with NEPacketTunnelProvider to set up a local proxy server which support HTTPS proxy. I also referenced this link to simultaneously support HTTP proxy. It works great when opening web pages in browsers like Safari or Chrome! However, when I use some instant messenger app to make VOIP calls, I can't make successful calls. What could be the possible reason for this? I want my proxy server to intercept only HTTP/HTTPS requests but not interfere with or block VOIP calls. Is there any configuration parameter that can achieve this? I'm sorry, but I don't have a strong background in proxy servers and VOIP. I would greatly appreciate any guidance or insights. Here is how I start Packet Tunnel and Proxy Server: let tunnelNetworkSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: localhostIP) let proxySettings = NEProxySettings() proxySettings.httpServer = NEProxyServer(address: localhostIP, port: localhostHttpPort) proxySettings.httpsServer = NEProxyServer(address: localhostIP, port: localhostHttpsPort) proxySettings.autoProxyConfigurationEnabled = false proxySettings.httpEnabled = true proxySettings.httpsEnabled = true proxySettings.excludeSimpleHostnames = true proxySettings.exceptionList = ["192.168.0.0/16", "10.0.0.0/8", "172.16.0.0/12", "127.0.0.1", "localhost", "*.local"] tunnelNetworkSettings.proxySettings = proxySettings tunnelNetworkSettings.ipv4Settings = NEIPv4Settings(addresses: ["10.8.0.2"], subnetMasks: ["255.255.255.0"]) tunnelNetworkSettings.mtu = 1500 let dns = NEDNSSettings(servers: ["8.8.8.8"]) dns.matchDomains = [""] tunnelNetworkSettings.dnsSettings = dns tunnelNetworkSettings.ipv4Settings?.includedRoutes = [NEIPv4Route.default()] tunnelNetworkSettings.ipv4Settings?.excludedRoutes = [ NEIPv4Route(destinationAddress: "192.168.0.0", subnetMask: "255.255.0.0"), NEIPv4Route(destinationAddress: "10.0.0.0", subnetMask: "255.0.0.0"), NEIPv4Route(destinationAddress: "172.16.0.0", subnetMask: "255.240.0.0") ] setTunnelNetworkSettings(tunnelNetworkSettings) { error in self.pendingCompletion?(error) self.pendingCompletion = nil } And how I've used SwiftNIO: let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount) let bootstrap = ServerBootstrap(group: group) .serverChannelOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR), value: 1) .childChannelOption(ChannelOptions.socket(SOL_SOCKET, SO_REUSEADDR), value: 1) .childChannelInitializer { channel in channel.pipeline.addHandler(ByteToMessageHandler(HTTPRequestDecoder(leftOverBytesStrategy: .forwardBytes))) .flatMap { channel.pipeline .addHandler(HTTPResponseEncoder()) } .flatMap { if channel.localAddress?.port == self.localhostHttpPort { channel.pipeline .addHandler(ConnectHttpHandler()) } else { channel.pipeline .addHandler(ConnectHttpsHandler()) } } }
5
1
939
Nov ’23