How to set socks data proxy in PacketTunnelProvider?

Hi:

Use HTTPServer property of NEProxySettings can proxy HTTP data.But how to proxy socks data?

Accepted Reply

Last I checked iOS does not support SOCKS proxies. While lots of support for SOCKS is in the system, because the code is shared by iOS and macOS, there’s no supported way to configure it:

  • In Settings your only proxy option is HTTP.

  • Likewise for the

    Proxies
    dictionary within the VPN payload (
    com.apple.vpn.managed
    ) in a configuration profile.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

How to set socks data proxy in PacketTunnelProvider?

What platform are you working on?

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"

iOS

Last I checked iOS does not support SOCKS proxies. While lots of support for SOCKS is in the system, because the code is shared by iOS and macOS, there’s no supported way to configure it:

  • In Settings your only proxy option is HTTP.

  • Likewise for the

    Proxies
    dictionary within the VPN payload (
    com.apple.vpn.managed
    ) in a configuration profile.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
Hello Quinn,
thanks for all the replies about NE around the forum, really helped me a lot to understand the framework a bit more!
Anyway, are SOCKS not supported still? I'm trying to figure out how to set the tunnel to use SOCKS, with no luck indeed - I managed to have a tunnel up and running but only with HTTP/HTTPS proxy, "SOCKSEnabled = NO".
  • I would avoid using SOCKs Proxy's or any type of PAC with a Packet Tunnel on iOS. One reason I say this is because traffic is meant to be routed through the tunnel, not off in different directions. When I see this type of behavior I am inclined to think that a Packet Tunnel is being used for traffic interception only, which is not what a Packet Tunnel on iOS is meant to be used for. If you want to proxy traffic on iOS, check out NEAppProxyProvider.

Add a Comment

Hi meaton, thanks for your reply. I'm working on a study project on my own, totally not publishing on App Store. My goal is exactly to monitor my iPhone traffic, including system applications connections: I've found few projects on App Store that are able to do that and I would like to replicate that behaviour, "If they can do it, I can do it too" approach. I read from docs that NEAppProxyProvider target a particular app: I'm going to test if I can apply this logic to a system application too, or, by only using .matchDomains, I can target particular domains and all the apps connecting to them.

My goal is exactly to monitor my iPhone traffic, including system applications connections

Monitoring iPhone traffic is by default the behavior of a NEFilterDataProvider, which is also available on iOS. For your project, I would have a look at this API and it's adjacent provider on iOS NEFilterControlProvider.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

I've tested FilterDataProvider as long with its FilterControlProvider: I'm able to see traffic and to read bytes from it but I'm afraid it's not the entire traffic generated or received by my iPhone. I'm overriding all handle* functions but still, some traffic is not going there; I've even activated the flight mode to let it reconnect and create new flows.

Results are different between what I see by using FilterData/Control and the app using a TunnelProvider (and more magic in it I'm trying to replicate): from that app I can see way more connections happening, and I'm trying to understand why.