Tunnelling VPN traffic through a local proxy server with NEPacketTunnelProvider

I have my custom tunnelling functionality written in Golang and compiled with gomobile into a framework. My custom tunnelling functionality exposes a local HTTP and Socks proxy through which apps can tunnel traffic. This works perfectly on android by using tun2socks. How can I do something similar on iOS? Thanks.

For anyone who might be interested in the solution, I solved this by using a tun2socks-like library for iOS (leaf) which can be found on Github.

The corresponding leaf configuration looks like this:

[General]
loglevel = warn
dns-server = 8.8.8.8, 8.8.4.4
tun-fd = replaceMeWithFd

[Proxy]
Direct = direct
Socks = socks, 127.0.0.1, 10808

[Rule]
FINAL, Socks

Could you please be more precise about the Github repository you used? Thank you in advance.

Tunnelling VPN traffic through a local proxy server with NEPacketTunnelProvider
 
 
Q