mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-11 02:45:42 -04:00
Known destinations
This commit is contained in:
parent
82744fb9ed
commit
4c7d20e15b
7 changed files with 79 additions and 38 deletions
|
@ -8,10 +8,29 @@ class Transport:
|
|||
TUNNEL = 0x03;
|
||||
types = [BROADCAST, TRANSPORT, RELAY, TUNNEL]
|
||||
|
||||
packet_hashlist = []
|
||||
|
||||
@staticmethod
|
||||
def outbound(raw):
|
||||
FPE.FlexPE.outbound(raw)
|
||||
|
||||
@staticmethod
|
||||
def inbound(raw):
|
||||
packet_hash = FPE.Identity.fullHash(raw)
|
||||
|
||||
if not packet_hash in Transport.packet_hashlist:
|
||||
Transport.packet_hashlist.append(packet_hash)
|
||||
packet = FPE.Packet(None, raw)
|
||||
packet.unpack()
|
||||
|
||||
if packet.packet_type == FPE.Packet.ANNOUNCE:
|
||||
FPE.Identity.validateAnnounce(packet)
|
||||
|
||||
if packet.packet_type == FPE.Packet.RESOURCE:
|
||||
for destination in FlexPE.destinations:
|
||||
if destination.hash == packet.destination_hash and destination.type == packet.destination_type:
|
||||
destination.receive(packet.data)
|
||||
|
||||
@staticmethod
|
||||
def registerDestination(destination):
|
||||
FPE.FlexPE.addDestination(destination)
|
Loading…
Add table
Add a link
Reference in a new issue