Is it safe to turn includeAllNetworks() to true?
thanks
OK, let’s start with some basics. What platform are you targeting?I have several questions to ask.
Destination IP (NETunnelProviderRoutingMethodDestinationIP)
Source app (NETunnelProviderRoutingMethodSourceApplication)
That’s a good place to start (-:I think for now I will use Destination IP as the default choice.
Code Block settings.ipv4Settings = NEIPv4Settings(addresses: ["127.0.0.1", "0.0.0.0"], subnetMasks: ["255.255.255.0", "255.255.255.0"]) settings.ipv4Settings?.includedRoutes = [NEIPv4Route.default()] settings.ipv4Settings?.excludedRoutes = [NEIPv4Route(destinationAddress: "127.0.0.1", subnetMask: "255.255.255.255")]
Code Block self.queue.async { while(true){ self.packetFlow.readPackets{ (packets: [Data], protocols: [NSNumber]) in for packet in packets{ self.handle_packet(data: packet) } } } }
Code Block settings.ipv4Settings?.includedRoutes = [NEIPv4Route.default()]
Code Block let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: …) let settings4 = NEIPv4Settings(addresses: […], subnetMasks: […]) settings4.includedRoutes = [NEIPv4Route.default()] // … fill in the rest of `settings4` … settings.ipv4Settings = settings4
Code Block settings.ipv4Settings?.excludedRoutes = [NEIPv4Route(destinationAddress: "127.0.0.1", subnetMask: "255.255.255.255")]
Code Block while (true) { … }
Code Block func startNextRead() { self.packetFlow.readPacketObjects { packets in … process `packets` … self.startNextRead() } }
It’s hard to say without more info. Earlier I wrote:I use a fake ip address for tunnel remote address for testing only
right now … Would this cause problem?
and I was hoping to get all that info, along with the destination address of a packet that you expect to receive but don’t.what are you supply for the tunnelRemoteAddress, addresses, and
subnetMasks values?
I want to get all the packet that is going to leave my device.
To be clear, that’s not going to happen no matter what you do here. The best you can do with an iOS packet tunnel is claim the default route. Traffic that’s bound to a specific interface will no go through your tunnel.
What are you trying to build? A VPN client? Or something else? The reason I ask is that most VPN client developers don’t ever need to reference 127.0.0.1.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Well the reason I use 127.0.0.1 is because I kind have a misunderstanding of how these numbers work. According to my understanding, the Array in "address:" include the Dest address of the packet. So if the Dest address is in the array I assume it will route to my TUN, am I correct? Then I will no longer need to add 127.0.0.1 to the array. what I'm trying to do is to have a device work as a middle device that can monitor the packet flow. so I understand there's some packets will be bonded to specific interface. I'm searching for a most wide-range solution.
oh wait a second, I know what the address means. I see another routing method on official website .networkRule could you please explain how this works?
Please answer my question from earlier:
What are you trying to build? A VPN client? Or something else?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"