File tree 1 file changed +9
-4
lines changed
app/src/main/java/tech/httptoolkit/android
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 {
168
168
val vpnInterface = Builder ()
169
169
.addAddress(VPN_IP_ADDRESS , 32 )
170
170
.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
171
180
.apply {
172
181
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
173
182
// Where possible, we want to explicitly set the proxy in addition to
@@ -177,10 +186,6 @@ class ProxyVpnService : VpnService(), IProtectSocket {
177
186
setHttpProxy(ProxyInfo .buildDirectProxy(proxyConfig.ip, proxyConfig.port))
178
187
}
179
188
}
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
-
184
189
.apply {
185
190
// We exclude ourselves from interception, so we can still make network requests
186
191
// separately, primarily because otherwise pinging with isReachable is recursive.
You can’t perform that action at this time.
0 commit comments