Prioritize Android VPN TCP handshakes
This commit is contained in:
@@ -30,8 +30,8 @@ android {
|
||||
applicationId "su.cin.rapvpn"
|
||||
minSdk 26
|
||||
targetSdk 35
|
||||
versionCode 199
|
||||
versionName "0.2.199"
|
||||
versionCode 200
|
||||
versionName "0.2.200"
|
||||
buildConfigField "String", "DEFAULT_BACKEND_URL", "\"${normalizeGradleString(defaultBackendUrl)}\""
|
||||
buildConfigField "String", "DEFAULT_CLUSTER_ID", "\"${normalizeGradleString(defaultClusterId)}\""
|
||||
buildConfigField "String", "DEFAULT_ORGANIZATION_ID", "\"${normalizeGradleString(defaultOrganizationId)}\""
|
||||
|
||||
@@ -2267,8 +2267,15 @@ public class RapVpnService extends VpnService {
|
||||
}
|
||||
|
||||
private boolean isTCPPriorityPacket(byte[] packet, int length) {
|
||||
TCPFlow flow = tcpFlow(packet, length);
|
||||
if (flow == null) {
|
||||
return false;
|
||||
}
|
||||
boolean syn = (flow.flags & 0x02) != 0;
|
||||
boolean fin = (flow.flags & 0x01) != 0;
|
||||
boolean rst = (flow.flags & 0x04) != 0;
|
||||
return syn || fin || rst;
|
||||
}
|
||||
|
||||
private boolean clampIPv4TCPMSS(byte[] packet, int length, int maxMss) {
|
||||
if (packet == null || length < 40 || maxMss <= 0 || ((packet[0] >> 4) & 0x0f) != 4) {
|
||||
@@ -3532,6 +3539,8 @@ public class RapVpnService extends VpnService {
|
||||
|| "source_drop".equals(state)
|
||||
|| "normalize_drop".equals(state)
|
||||
|| "length_drop".equals(state)
|
||||
|| "tcp_syn_ack".equals(state)
|
||||
|| "tcp_mss_clamp".equals(state)
|
||||
|| ("downlink".equals(prefix) && !"batch".equals(state) && !"restart".equals(state) && !"running".equals(state))
|
||||
|| ("downlink_writer".equals(prefix) && !"write".equals(state) && !"writer_idle".equals(state));
|
||||
if (!important && now - lastRuntimeDetailAt < RUNTIME_DETAIL_INTERVAL_MS) {
|
||||
|
||||
Reference in New Issue
Block a user