How can I create a tun interface?

Hello,

I would like to achieve this in order to parse DNS datagrams:


  1. Set the system DNS to some private address, let's say A.
  2. Route A to tun interface.
  3. Parse the DNS request received


How do I create an instance of a TUN interface inside a subclass of NEPacketTunnelProvider?

I don't understand that very well. Any clue?

Thanks a lot.

Network Extension providers do not give you direct access to TUN interfaces. Rather, the TUN interface is abstracted via various APIs. For example, for a packet tunnel provider you transfer packets to and from the TCP/IP stack via a

NEPacketTunnelFlow
object which you access via the
packetFlow
property.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How can I create a tun interface?
 
 
Q