Allow tagging UDPPackets with arbitrary metadata
The metadata should propagate to any Messages deserialized from the packet as well.
This commit is contained in:
@@ -30,6 +30,7 @@ class UDPPacket:
|
||||
self.dst_addr = dst_addr
|
||||
self.data = data
|
||||
self.direction = direction
|
||||
self.meta = {}
|
||||
|
||||
@property
|
||||
def outgoing(self):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user