From c94464197930966b0af51880b092f0ea3d70ac23 Mon Sep 17 00:00:00 2001 From: nex Date: Wed, 29 Nov 2023 11:53:42 +0000 Subject: [PATCH] Add speedtest uri --- cogs/events.py | 2 +- cogs/other.py | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index bacb7b0..a767b30 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -11,7 +11,6 @@ import re import subprocess import textwrap import traceback -import pydantic import warnings from datetime import datetime, timedelta, timezone from pathlib import Path @@ -19,6 +18,7 @@ from typing import Any, Dict, Optional, Tuple import discord import httpx +import pydantic from bs4 import BeautifulSoup from config import guilds from discord.ext import commands, pages, tasks diff --git a/cogs/other.py b/cogs/other.py index 042e88e..19db80f 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -1,14 +1,9 @@ import asyncio -import base64 import fnmatch import functools import glob import io -import ipaddress import json -import typing -import zlib - import math import os import random @@ -19,6 +14,7 @@ import sys import tempfile import textwrap import traceback +import typing from functools import partial from io import BytesIO from pathlib import Path @@ -38,8 +34,8 @@ from discord import Interaction from discord.ext import commands from dns import asyncresolver from PIL import Image -from rich.tree import Tree from rich import print +from rich.tree import Tree from selenium import webdriver from selenium.common.exceptions import WebDriverException from selenium.webdriver.chrome.options import Options as ChromeOptions @@ -2327,19 +2323,20 @@ class OtherCog(commands.Cog): "ash", "hil" ] - SPEED_URL = "https://{}-speed.hetzner.com/1GB.bin" results = { "localhost:1090": { "name": "SHRoNK", "failure": None, "download_speed": 0.0, - "tested": False + "tested": False, + "speedtest": "https://{hetzner_region}-speed.hetzner.com/100M.bin" }, "localhost:1080": { "name": "NexBox", "failure": None, "download_speed": 0.0, - "tested": False + "tested": False, + "speedtest": "http://192.168.0.90:82/100M.bin" } } if proxy_name != "first-working": @@ -2412,7 +2409,7 @@ class OtherCog(commands.Cog): for region in SPEED_REGIONS: try: start = time() - used = SPEED_URL.format(region) + used = results[proxy_uri]["speedtest"].format(hetzner_region=region) latency_start = time() async with client.stream("GET", used) as response: latency_end = time()