mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
feat(proxy): add geo country routing to proxy urls
This commit is contained in:
parent
2265fcc513
commit
4fac1a20c3
3 changed files with 60 additions and 11 deletions
|
|
@ -67,13 +67,23 @@ class ProxyProvider(ABC):
|
|||
return None
|
||||
return {"http": proxy_url, "https": proxy_url}
|
||||
|
||||
def get_sticky_proxy_url(self, session_id: str) -> str | None:
|
||||
def get_geo_proxy_url(self, country: str | None = None) -> str | None:
|
||||
"""Return a proxy URL pinned to ``country`` when supported.
|
||||
|
||||
Providers without vendor-specific country routing safely fall back to
|
||||
their ordinary proxy URL.
|
||||
"""
|
||||
return self.get_proxy_url()
|
||||
|
||||
def get_sticky_proxy_url(
|
||||
self, session_id: str, country: str | None = None
|
||||
) -> str | None:
|
||||
"""Return a proxy URL pinned to ``session_id`` when supported.
|
||||
|
||||
Providers without vendor-specific session routing safely fall back to
|
||||
their ordinary proxy URL.
|
||||
"""
|
||||
return self.get_proxy_url()
|
||||
return self.get_geo_proxy_url(country)
|
||||
|
||||
def get_location(self) -> str:
|
||||
"""Return the proxy's configured exit region (e.g. ``"us"``), or ``""``.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue