2023-04-23 10:38:28 +02:00
|
|
|
from twisted.internet.protocol import DatagramProtocol
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from core.config import CoreConfig
|
|
|
|
from .config import IDZConfig
|
|
|
|
|
2023-04-24 03:04:52 +02:00
|
|
|
|
2023-04-23 10:38:28 +02:00
|
|
|
class IDZEcho(DatagramProtocol):
|
|
|
|
def __init__(self, cfg: CoreConfig, game_cfg: IDZConfig) -> None:
|
|
|
|
super().__init__()
|
|
|
|
self.core_config = cfg
|
|
|
|
self.game_config = game_cfg
|
|
|
|
self.logger = logging.getLogger("idz")
|
|
|
|
|
|
|
|
def datagramReceived(self, data, addr):
|
2023-04-24 03:04:52 +02:00
|
|
|
self.logger.debug(
|
|
|
|
f"Echo from from {addr[0]}:{addr[1]} -> {self.transport.getHost().port} - {data.hex()}"
|
|
|
|
)
|
|
|
|
self.transport.write(data, addr)
|