File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
app/src/main/java/tech/httptoolkit/android Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,15 @@ class ProxyVpnService : VpnService(), IProtectSocket {
168168 val vpnInterface = Builder ()
169169 .addAddress(VPN_IP_ADDRESS , 32 )
170170 .addRoute(ALL_ROUTES , 0 )
171+ .apply {
172+ // On Android 10+ VPNs are assumed as metered by default, unless we explicitly
173+ // specify otherwise:
174+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
175+ setMetered(false )
176+ }
177+ }
178+ .setMtu(MAX_PACKET_LEN ) // Limit the packet size to the buffer used by ProxyVpnRunnable
179+ .setBlocking(true ) // We use a blocking loop to read in ProxyVpnRunnable
171180 .apply {
172181 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
173182 // Where possible, we want to explicitly set the proxy in addition to
@@ -177,10 +186,6 @@ class ProxyVpnService : VpnService(), IProtectSocket {
177186 setHttpProxy(ProxyInfo .buildDirectProxy(proxyConfig.ip, proxyConfig.port))
178187 }
179188 }
180-
181- .setMtu(MAX_PACKET_LEN ) // Limit the packet size to the buffer used by ProxyVpnRunnable
182- .setBlocking(true ) // We use a blocking loop to read in ProxyVpnRunnable
183-
184189 .apply {
185190 // We exclude ourselves from interception, so we can still make network requests
186191 // separately, primarily because otherwise pinging with isReachable is recursive.
You can’t perform that action at this time.
0 commit comments