Skip to content

Commit

Permalink
Update protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Mar 15, 2024
1 parent 72df2f2 commit f1dd56f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion discordgsm/protocols/beammp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import time
from typing import TYPE_CHECKING
Expand All @@ -17,7 +18,9 @@ class BeamMP(Protocol):
async def query(self):
host, port = str(self.kv["host"]), int(str(self.kv["port"]))
ip = await Socket.gethostbyname(host)
url = f"https://master-server.opengsq.com/beammp/search?host={ip}&port={port}"

base_url = os.getenv('OPENGSQ_MASTER_SERVER_URL', 'https://master-server.opengsq.com/').rstrip('/')
url = f"{base_url}/scum/search?host={ip}&port={port}"
start = time.time()

async with aiohttp.ClientSession() as session:
Expand Down
4 changes: 3 additions & 1 deletion discordgsm/protocols/factorio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import time
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -65,7 +66,8 @@ async def query(self):
data = dict(Factorio.master_servers[host_address])
ping = 0
else:
url = f"https://master-server.opengsq.com/factorio/search?host={ip}&port={port}"
base_url = os.getenv('OPENGSQ_MASTER_SERVER_URL', 'https://master-server.opengsq.com/').rstrip('/')
url = f"{base_url}/scum/search?host={ip}&port={port}"
start = time.time()

async with aiohttp.ClientSession() as session:
Expand Down
5 changes: 4 additions & 1 deletion discordgsm/protocols/palworld.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import time
from typing import TYPE_CHECKING

Expand All @@ -16,7 +17,9 @@ class Palworld(Protocol):
async def query(self):
host, port = str(self.kv["host"]), int(str(self.kv["port"]))
ip = await Socket.gethostbyname(host)
url = f"https://master-server.opengsq.com/palworld/search?host={ip}&port={port}"

base_url = os.getenv('OPENGSQ_MASTER_SERVER_URL', 'https://master-server.opengsq.com/').rstrip('/')
url = f"{base_url}/scum/search?host={ip}&port={port}"
start = time.time()

async with aiohttp.ClientSession() as session:
Expand Down
5 changes: 4 additions & 1 deletion discordgsm/protocols/scum.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import time
from typing import TYPE_CHECKING

Expand All @@ -17,7 +18,9 @@ class Scum(Protocol):
async def query(self):
host, port = str(self.kv["host"]), int(str(self.kv["port"]))
ip = await Socket.gethostbyname(host)
url = f"https://master-server.opengsq.com/scum/search?host={ip}&port={port}"

base_url = os.getenv('OPENGSQ_MASTER_SERVER_URL', 'https://master-server.opengsq.com/').rstrip('/')
url = f"{base_url}/scum/search?host={ip}&port={port}"
start = time.time()

async with aiohttp.ClientSession() as session:
Expand Down

0 comments on commit f1dd56f

Please sign in to comment.