nitmproxy
nitmproxy copied to clipboard
Protect channel when used in Android VpnService
Under android when using a VpnService it is necessary to mark a socket as handled by the VpnService otherwise a loop results and the network traffic is routed to the VpnService again. See https://stackoverflow.com/questions/43463044/protecting-socket-when-using-netty4-on-android-with-Service.
A new method protect could be added to com.github.chhsiao90.nitmproxy.channel.BackendChannelBootstrap, which would be called on success on the io.netty.channel.ChannelFuture and get the Channel. By default this would be a no op, but a handler logic could be passed with the config. The VpnService.protect method needs a socket or socket ID, I was wondering if the ChannelId of Netty provides this or what could be done to achieve the goal. How to get the underlying socket or the socket ID?