mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 10:03:40 +01:00
Reduce proxy check timeout
This commit is contained in:
parent
708f6810c4
commit
e00faf23a5
2 changed files with 2 additions and 4 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,5 +1,3 @@
|
||||||
{
|
{
|
||||||
"python.linting.pycodestyleEnabled": true,
|
|
||||||
"python.linting.enabled": true,
|
|
||||||
"python.analysis.typeCheckingMode": "basic"
|
"python.analysis.typeCheckingMode": "basic"
|
||||||
}
|
}
|
|
@ -854,13 +854,13 @@ class OtherCog(commands.Cog):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def check_proxy(url: str = "socks5://localhost:1090"):
|
async def check_proxy(url: str = "socks5://localhost:1090"):
|
||||||
client = httpx.AsyncClient(http2=True)
|
client = httpx.AsyncClient(http2=True, timeout=3)
|
||||||
my_ip4 = (await client.get("https://api.ipify.org")).text
|
my_ip4 = (await client.get("https://api.ipify.org")).text
|
||||||
real_ips = [my_ip4]
|
real_ips = [my_ip4]
|
||||||
await client.aclose()
|
await client.aclose()
|
||||||
|
|
||||||
# Check the proxy
|
# Check the proxy
|
||||||
client = httpx.AsyncClient(http2=True, proxies=url)
|
client = httpx.AsyncClient(http2=True, proxies=url, timeout=3)
|
||||||
try:
|
try:
|
||||||
response = await client.get(
|
response = await client.get(
|
||||||
"https://1.1.1.1/cdn-cgi/trace",
|
"https://1.1.1.1/cdn-cgi/trace",
|
||||||
|
|
Loading…
Reference in a new issue