How to Avoid Circular Connections in Android VPN

  Kiến thức lập trình

I have a proxy core written in Golang, which I have compiled as an AAR (Android Archive) to use in my Android Kotlin app. When I start the VPN using vpnservice.Builder, I route all traffic to my proxy app builder.route("0.0.0.0", 0). However, I am encountering a problem with circular connections.

Here’s what happens:

1-The proxy client tries to connect to the proxy server.
2-The request loops back to the client because all traffic is routed to my proxy client app.

I found the protect() method in the Android documentation, which can protect a socket and route connections through the network stack instead of the VPN interface. While this method is useful, my app creates a new socket in the Golang code for each new connection on the device. As a result, I cannot protect a large number of connections per second in Android.

How can I handle this problem to avoid circular connections in my proxy app?

Any suggestions or alternative approaches would be greatly appreciated.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT