forked from StarryPy/StarryPy3k
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopensb_detector.py
More file actions
28 lines (20 loc) · 831 Bytes
/
opensb_detector.py
File metadata and controls
28 lines (20 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
StarryPy OpenSB Detector Plugin
Detects zstd compression for the stream and sets server configuration accordingly
"""
import asyncio
from base_plugin import SimpleCommandPlugin
from utilities import send_message, Command
class OpenSBDetector(SimpleCommandPlugin):
name = "opensb_detector"
def __init__(self):
super().__init__()
async def activate(self):
await super().activate()
async def on_protocol_response(self, data, connection):
# self.logger.debug("Received protocol response: {} from connection {}".format(data, connection))
info = data["parsed"].get("info")
if info != None and info["compression"] == "Zstd":
self.logger.info("Detected Zstd compression. Setting server configuration.")
connection.start_zstd()
return True