I am trying to find the available methods to capture selective IP traffic to tunnel it using an UDP tunneling.
I went through the online resources and found that we can achieve this using PacketTunnelProvider where we will configure the tunnel then define inbound and outbound reader and writer functions.
One another method I found where we open a utun socket, assign source and destination tunnel address of the tunnel endpoints and then start doing read write operations on the utun interface, where our application will be able to read any traffic coming to that interface. (also we need to configure appropriate routes for the utun interface to redirect traffic).
I wanted to understand the difference between the two methods, and in which scenario both should be used?