summaryrefslogtreecommitdiffstats
path: root/g4f/providers
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-26 11:30:17 +0100
committerGitHub <noreply@github.com>2024-02-26 11:30:17 +0100
commit36e7665613c4a8ff373d90401ae804f7a334feab (patch)
tree1c5bd93c13f845b8554da3290e124116e251663f /g4f/providers
parentMerge pull request #1630 from hlohaus/flow (diff)
parentAdd proxy connector to GeminiPro (diff)
downloadgpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.gz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.bz2
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.lz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.xz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.zst
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.zip
Diffstat (limited to 'g4f/providers')
-rw-r--r--g4f/providers/helper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/g4f/providers/helper.py b/g4f/providers/helper.py
index 49d033d1..c027216b 100644
--- a/g4f/providers/helper.py
+++ b/g4f/providers/helper.py
@@ -51,11 +51,14 @@ def get_random_hex() -> str:
"""
return secrets.token_hex(16).zfill(32)
-def get_connector(connector: BaseConnector = None, proxy: str = None) -> Optional[BaseConnector]:
+def get_connector(connector: BaseConnector = None, proxy: str = None, rdns: bool = False) -> Optional[BaseConnector]:
if proxy and not connector:
try:
from aiohttp_socks import ProxyConnector
- connector = ProxyConnector.from_url(proxy)
+ if proxy.startswith("socks5h://"):
+ proxy = proxy.replace("socks5h://", "socks5://")
+ rdns = True
+ connector = ProxyConnector.from_url(proxy, rdns=rdns)
except ImportError:
raise MissingRequirementsError('Install "aiohttp_socks" package for proxy support')
return connector \ No newline at end of file