Skip to content

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 50+ tests passed.

fix(geoip): map Seychelles (SC) to a locale (#596)

Jasper160f56da8586
diff --git a/cloakbrowser/geoip.py b/cloakbrowser/geoip.py
index 576f171..319e2a5 100644
--- a/cloakbrowser/geoip.py
+++ b/cloakbrowser/geoip.py
@@ -74,6 +74,7 @@ COUNTRY_LOCALE_MAP: dict[str, str] = {
"CM": "fr-CM", "AO": "pt-AO", "MZ": "pt-MZ", "ZM": "en-ZM", "ZW": "en-ZW",
"HN": "es-HN", "NI": "es-NI", "SV": "es-SV", "PA": "es-PA", "JM": "en-JM",
"TT": "en-TT", "PR": "es-PR",
+ "SC": "en-SC",
}
diff --git a/dotnet/src/CloakBrowser/GeoIp.cs b/dotnet/src/CloakBrowser/GeoIp.cs
index 5bc1e11..8fc7a5e 100644
--- a/dotnet/src/CloakBrowser/GeoIp.cs
+++ b/dotnet/src/CloakBrowser/GeoIp.cs
@@ -74,6 +74,7 @@ public static class GeoIp
["CM"] = "fr-CM", ["AO"] = "pt-AO", ["MZ"] = "pt-MZ", ["ZM"] = "en-ZM", ["ZW"] = "en-ZW",
["HN"] = "es-HN", ["NI"] = "es-NI", ["SV"] = "es-SV", ["PA"] = "es-PA", ["JM"] = "en-JM",
["TT"] = "en-TT", ["PR"] = "es-PR",
+ ["SC"] = "en-SC",
};
/// <summary>
diff --git a/dotnet/tests/CloakBrowser.Tests/MiscTests.cs b/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
index fc30af2..787ae9b 100644
--- a/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
+++ b/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
@@ -27,6 +27,7 @@ public class GeoIpTests
// Extended-coverage entries (parity with Python/JS COUNTRY_LOCALE_MAP).
Assert.Equal("sl-SI", GeoIp.CountryLocaleMap["SI"]);
Assert.Equal("es-PE", GeoIp.CountryLocaleMap["PE"]);
+ Assert.Equal("en-SC", GeoIp.CountryLocaleMap["SC"]);
}
[Fact]
diff --git a/js/src/geoip.ts b/js/src/geoip.ts
index 0a13d0f..608adf5 100644
--- a/js/src/geoip.ts
+++ b/js/src/geoip.ts
@@ -63,6 +63,7 @@ export const COUNTRY_LOCALE_MAP: Record<string, string> = {
CM: "fr-CM", AO: "pt-AO", MZ: "pt-MZ", ZM: "en-ZM", ZW: "en-ZW",
HN: "es-HN", NI: "es-NI", SV: "es-SV", PA: "es-PA", JM: "en-JM",
TT: "en-TT", PR: "es-PR",
+ SC: "en-SC",
};
export interface GeoResult {
diff --git a/js/tests/geoip.test.ts b/js/tests/geoip.test.ts
index c5b6b45..46f1835 100644
--- a/js/tests/geoip.test.ts
+++ b/js/tests/geoip.test.ts
@@ -311,6 +311,10 @@ describe("COUNTRY_LOCALE_MAP", () => {
}
});
+ it("maps Seychelles (issue #591)", () => {
+ expect(COUNTRY_LOCALE_MAP["SC"]).toBe("en-SC");
+ });
+
it("values are BCP 47 language-REGION format", () => {
for (const [code, locale] of Object.entries(COUNTRY_LOCALE_MAP)) {
const parts = locale.split("-");
diff --git a/tests/test_geoip.py b/tests/test_geoip.py
index a96087f..4768768 100644
--- a/tests/test_geoip.py
+++ b/tests/test_geoip.py
@@ -59,6 +59,23 @@ def test_locale_map_has_common_countries():
assert code in COUNTRY_LOCALE_MAP, f"Missing {code}"
+def test_resolve_geo_seychelles_exit_gets_locale():
+ """GeoLite2 places some datacenter exits in Seychelles (issue #591)."""
+ resp = MagicMock()
+ resp.location.time_zone = "Indian/Mahe"
+ resp.country.iso_code = "SC"
+ reader = MagicMock()
+ reader.return_value.__enter__.return_value.city.return_value = resp
+ mock_geoip2 = type("module", (), {"database": type("db", (), {"Reader": reader})})()
+ with patch.dict("sys.modules", {"geoip2": mock_geoip2, "geoip2.database": mock_geoip2.database}):
+ with patch("cloakbrowser.geoip._ensure_geoip_db", return_value=object()):
+ with patch("cloakbrowser.geoip._resolve_exit_ip", return_value="178.20.213.254"):
+ from cloakbrowser.geoip import resolve_proxy_geo_with_ip
+ assert resolve_proxy_geo_with_ip("http://10.50.96.5:8888") == (
+ "Indian/Mahe", "en-SC", "178.20.213.254",
+ )
+
+
def test_locale_map_values_are_bcp47():
"""All locales should be language-REGION format."""
for code, locale in COUNTRY_LOCALE_MAP.items():