Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/cpp/libs/fptn
Submodule fptn updated from a99db5 to b17063
26 changes: 20 additions & 6 deletions app/src/main/cpp/src/https_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,44 @@ Java_org_fptn_vpn_services_websocket_NativeHttpsClientImpl_nativeCreate(
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityMode;
}
/* Chrome */
else if (censorship_strategy_name == "SNI-REALITY-CHROME-147") {
else if (censorship_strategy_name == "SNI-REALITY-CHROME-149") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome149;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-148") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome148;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-147") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome147;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-146") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome146;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-145") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome145;
}
/* Firefox */
else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-149") {
else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-151") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox151;
} else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-150") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox150;
} else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-149") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox149;
}
/* Yandex */
else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26;
else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26-4") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26_4;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26-3") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26_3;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-25") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex25;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-24") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex24;
}
/* Safari */
else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26;
else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26-5") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26_5;
} else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26-4") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26_4;
}

SPDLOG_INFO("HTTPS client censorship strategy: {}", censorship_strategy_name);

auto* https_client = new WrapperHttpsClient(env, global_object_ref,
std::move(host), port, std::move(sni), std::move(md5_fingerprint), censorship_strategy);
return reinterpret_cast<jlong>(https_client);
Expand Down
36 changes: 25 additions & 11 deletions app/src/main/cpp/src/websocket_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,51 @@ Java_org_fptn_vpn_services_websocket_NativeWebSocketClientImpl_nativeCreate(
fptn::protocol::https::CensorshipStrategy censorship_strategy =
fptn::protocol::https::CensorshipStrategy::kSni;
if (censorship_strategy_name == "SNI") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSni;
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSni;
} else if (censorship_strategy_name == "OBFUSCATION") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kTlsObfuscator;
} else if (censorship_strategy_name == "SNI-REALITY") { // deprecated
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityMode;
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityMode;
}
/* Chrome */
else if (censorship_strategy_name == "SNI-REALITY-CHROME-147") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome147;
else if (censorship_strategy_name == "SNI-REALITY-CHROME-149") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome149;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-148") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome148;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-147") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome147;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-146") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome146;
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome146;
} else if (censorship_strategy_name == "SNI-REALITY-CHROME-145") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeChrome145;
}
/* Firefox */
else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-149") {
else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-151") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox151;
} else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-150") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox150;
} else if (censorship_strategy_name == "SNI-REALITY-FIREFOX-149") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeFirefox149;
}
/* Yandex */
else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26;
else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26-4") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26_4;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-26-3") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex26_3;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-25") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex25;
} else if (censorship_strategy_name == "SNI-REALITY-YANDEX-24") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex24;
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeYandex24;
}
/* Safari */
else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26;
else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26-5") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26_5;
} else if (censorship_strategy_name == "SNI-REALITY-SAFARI-26-4") {
censorship_strategy = fptn::protocol::https::CensorshipStrategy::kSniRealityModeSafari26_4;
}

SPDLOG_INFO("Censorship strategy selected: {}", censorship_strategy_name);

jobject global_object_ref = env->NewWeakGlobalRef(thiz);
auto* websocket_client = new WrapperWebsocketClient(
global_object_ref,
Expand Down
22 changes: 14 additions & 8 deletions app/src/main/java/org/fptn/vpn/enums/SniSpoofingMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

public enum SniSpoofingMode {
SNI,
/* Chrome */
SNI_REALITY_CHROME_147,
SNI_REALITY_CHROME_146,
SNI_REALITY_CHROME_145,
/* Firefox */
SNI_REALITY_FIREFOX_149,
/* Yandex Browser */
SNI_REALITY_YANDEX_26,
SNI_REALITY_YANDEX_26_4,
SNI_REALITY_YANDEX_26_3,
SNI_REALITY_YANDEX_25,
SNI_REALITY_YANDEX_24,
/* Firefox */
SNI_REALITY_FIREFOX_151,
SNI_REALITY_FIREFOX_150,
SNI_REALITY_FIREFOX_149,
/* Safari */
SNI_REALITY_SAFARI_26
SNI_REALITY_SAFARI_26_5,
SNI_REALITY_SAFARI_26_4,
/* Chrome */
SNI_REALITY_CHROME_149,
SNI_REALITY_CHROME_148,
SNI_REALITY_CHROME_147,
SNI_REALITY_CHROME_146,
SNI_REALITY_CHROME_145,
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public static ServerEntity findFastestServer(List<ServerEntity> serverEntityList
} finally {
executor.shutdownNow();
}
} else {
} /* else {
// Must never happen
throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
}
// throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
} */
return null;
}

Expand Down Expand Up @@ -92,7 +92,8 @@ public static SpeedTestResult findServerByLogin(List<ServerEntity> serverEntityL
executor.shutdownNow();
}
}
throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
return null;
//throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
}

private static List<ServerEntity> selectServersForTesting(List<ServerEntity> servers) {
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/org/fptn/vpn/services/vpn/FptnService.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,6 @@ private void connect(ServerEntity serverEntity, String sniHostname, String preFe
}
int maxReconnectCount = SharedPrefUtils.getReconnectAttemptsCount(this);
int delayBetweenAttempts = SharedPrefUtils.getDelayBetweenReconnect(this);
XLog.tag(TAG).i("Connection params [bypass=%s, maxRetries=%d, retryDelay=%ds, watchIP=%b, watchNetwork=%b]",
SharedPrefUtils.getBypassCensorshipMethod(this),
maxReconnectCount, delayBetweenAttempts,
reconnectOnChangeIPEnabled, reconnectOnChangeNetworkTypeEnabled);

FptnConnection connection;

Expand All @@ -492,6 +488,11 @@ private void connect(ServerEntity serverEntity, String sniHostname, String preFe
if (bypassCensorshipMethod == BypassCensorshipMethod.SNI_REALITY) {
sniSpoofingMode = SharedPrefUtils.getSniSpoofingMode(this);
}
XLog.tag(TAG).i("Connection params [bypass=%s, spoofingMode=%s, maxRetries=%d, retryDelay=%ds, watchIP=%b, watchNetwork=%b]",
bypassCensorshipMethod,
sniSpoofingMode,
maxReconnectCount, delayBetweenAttempts,
reconnectOnChangeIPEnabled, reconnectOnChangeNetworkTypeEnabled);

PerAppVpnMode perAppVpnMode = SharedPrefUtils.getPerAppVPNMode(this);
List<AppInfo> appInfos = new ArrayList<>();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/fptn/vpn/utils/token/TokenUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public List<ServerEntity> parseToken(String token) throws PVNClientException {

if (serverDtoList.isEmpty()) {
XLog.tag(TAG).e("Token parsed but no servers found — token may be invalid or expired");
throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
// throw new PVNClientException(ErrorCode.SERVER_LIST_NULL_OR_EMPTY);
}

return serverDtoList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,34 @@ public void onEditSNIServer(View view) {
private String getSniSpoofingModeFriendlyName(SniSpoofingMode mode) {
return switch (mode) {
case SNI -> getString(R.string.sni);
case SNI_REALITY_CHROME_149 ->
getString(R.string.sni_reality_radio_button_label_chrome_149);
case SNI_REALITY_CHROME_148 ->
getString(R.string.sni_reality_radio_button_label_chrome_148);
case SNI_REALITY_CHROME_147 ->
getString(R.string.sni_reality_radio_button_label_chrome_147);
case SNI_REALITY_CHROME_146 ->
getString(R.string.sni_reality_radio_button_label_chrome_146);
case SNI_REALITY_CHROME_145 ->
getString(R.string.sni_reality_radio_button_label_chrome_145);
case SNI_REALITY_FIREFOX_151 ->
getString(R.string.sni_reality_radio_button_label_firefox_151);
case SNI_REALITY_FIREFOX_150 ->
getString(R.string.sni_reality_radio_button_label_firefox_150);
case SNI_REALITY_FIREFOX_149 ->
getString(R.string.sni_reality_radio_button_label_firefox_149);
case SNI_REALITY_YANDEX_26 ->
getString(R.string.sni_reality_radio_button_label_yandex_26);
case SNI_REALITY_YANDEX_26_4 ->
getString(R.string.sni_reality_radio_button_label_yandex_26_4);
case SNI_REALITY_YANDEX_26_3 ->
getString(R.string.sni_reality_radio_button_label_yandex_26_3);
case SNI_REALITY_YANDEX_25 ->
getString(R.string.sni_reality_radio_button_label_yandex_25);
case SNI_REALITY_YANDEX_24 ->
getString(R.string.sni_reality_radio_button_label_yandex_24);
case SNI_REALITY_SAFARI_26 ->
getString(R.string.sni_reality_radio_button_label_safari_26);
case SNI_REALITY_SAFARI_26_5 ->
getString(R.string.sni_reality_radio_button_label_safari_26_5);
case SNI_REALITY_SAFARI_26_4 ->
getString(R.string.sni_reality_radio_button_label_safari_26_4);
default -> mode.toString();
};
}
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/res/values-fa-rIR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,23 @@ https://play.google.com/store/apps/details?id=org.fptn.vpn
<string name="tls_handshake_obfuscation_radio_button_label">مخفی‌سازی ترافیک (Obfuscation)</string>
<string name="sni_reality_radio_button_label">جعل پیشرفتهٔ دامنه (SNI + REALITY)</string>

<string name="sni_reality_radio_button_label_chrome_149">(Chrome 149) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_chrome_148">(Chrome 148) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_chrome_147">(Chrome 147) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_chrome_146">(Chrome 146) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_chrome_145">(Chrome 145) جعل پیشرفتهٔ دامنه</string>

<string name="sni_reality_radio_button_label_firefox_151">(Firefox 151) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_firefox_150">(Firefox 150) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_firefox_149">(Firefox 149) جعل پیشرفتهٔ دامنه</string>

<string name="sni_reality_radio_button_label_yandex_26">(Yandex 26) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_yandex_26_4">(Yandex 26.4) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_yandex_26_3">(Yandex 26.3) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_yandex_25">Yandex 25) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_yandex_24">Yandex 24) جعل پیشرفتهٔ دامنه</string>

<string name="sni_reality_radio_button_label_safari_26">(Safari 26) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_safari_26_5">(Safari 26.5) جعل پیشرفتهٔ دامنه</string>
<string name="sni_reality_radio_button_label_safari_26_4">(Safari 26.4) جعل پیشرفتهٔ دامنه</string>

<string name="sni_reality_radio_button_label_additional_info">نیازمند یک دامنهٔ واقعی و فعال است (در غیر این صورت ممکن است خطا رخ دهد)</string>

Expand Down
11 changes: 8 additions & 3 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,23 @@ https://play.google.com/store/apps/details?id=org.fptn.vpn
<string name="sni_radio_button_label">Подмена домена</string>
<string name="tls_handshake_obfuscation_radio_button_label">Маскировка трафика (обфускация)</string>
<string name="sni_reality_radio_button_label">Подмена домена (SNI + REALITY)</string>

<string name="sni_reality_radio_button_label_chrome_149">Подмена домена (Chrome 149)</string>
<string name="sni_reality_radio_button_label_chrome_148">Подмена домена (Chrome 148)</string>
<string name="sni_reality_radio_button_label_chrome_147">Подмена домена (Chrome 147)</string>
<string name="sni_reality_radio_button_label_chrome_146">Подмена домена (Chrome 146)</string>
<string name="sni_reality_radio_button_label_chrome_145">Подмена домена (Chrome 145)</string>

<string name="sni_reality_radio_button_label_firefox_151">Подмена домена (Firefox 151)</string>
<string name="sni_reality_radio_button_label_firefox_150">Подмена домена (Firefox 150)</string>
<string name="sni_reality_radio_button_label_firefox_149">Подмена домена (Firefox 149)</string>

<string name="sni_reality_radio_button_label_yandex_26">Подмена домена (Yandex 26)</string>
<string name="sni_reality_radio_button_label_yandex_26_4">Подмена домена (Yandex 26.4)</string>
<string name="sni_reality_radio_button_label_yandex_26_3">Подмена домена (Yandex 26.3)</string>
<string name="sni_reality_radio_button_label_yandex_25">Подмена домена (Yandex 25)</string>
<string name="sni_reality_radio_button_label_yandex_24">Подмена домена (Yandex 24)</string>

<string name="sni_reality_radio_button_label_safari_26">Подмена домена (Safari 26)</string>
<string name="sni_reality_radio_button_label_safari_26_5">Подмена домена (Safari 26.5)</string>
<string name="sni_reality_radio_button_label_safari_26_4">Подмена домена (Safari 26.4)</string>

<string name="sni_reality_radio_button_label_additional_info">Требуется реальный существующий домен (иначе возможны ошибки)</string>

Expand Down
Loading