Allow tagging UDPPackets with arbitrary metadata

The metadata should propagate to any Messages deserialized
from the packet as well.
This commit is contained in:
Salad Dais
2021-06-18 20:31:15 +00:00
parent 76df9a0424
commit 9bf4240411
2 changed files with 2 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ class UDPPacket:
self.dst_addr = dst_addr
self.data = data
self.direction = direction
self.meta = {}
@property
def outgoing(self):

View File

@@ -58,6 +58,7 @@ class InterceptingLLUDPProxyProtocol(UDPProxyProtocol):
message = self.deserializer.deserialize(packet.data)
message.direction = packet.direction
message.sender = packet.src_addr
message.meta.update(packet.meta)
assert message is not None
# Check for UDP bans on inbound messages