Transmit proofs only on relevant interface
This commit is contained in:
parent
d754ed989c
commit
3bbda5a4b4
@ -21,7 +21,7 @@ Reticulum can also be tunneled over existing IP networks.
|
|||||||
Some countries still ban the use of encryption when operating under an amateur radio license. Reticulum offers several encryptionless modes, while still using cryptographic principles for station verification, link establishment, data integrity verification, acknowledgements and routing. It is therefore perfectly possible to include Reticulum in amateur radio use, even if your country bans encryption.
|
Some countries still ban the use of encryption when operating under an amateur radio license. Reticulum offers several encryptionless modes, while still using cryptographic principles for station verification, link establishment, data integrity verification, acknowledgements and routing. It is therefore perfectly possible to include Reticulum in amateur radio use, even if your country bans encryption.
|
||||||
|
|
||||||
## How do I get started?
|
## How do I get started?
|
||||||
Full documentation and video tutorials are coming with the stable alpha release. Until then, you are on your own. If you really want to experiment already, you could take a look in the "Examples" folder, for some well-documented example programs. Be sure to also read the [Reticulum Overview Document](http://unsigned.io/wp-content/uploads/2018/04/Reticulum_Overview_v0.4.pdf)
|
Full documentation and video tutorials are coming with the stable alpha release. Until then, you are mostly on your own. If you really want to experiment already, you could take a look in the "Examples" folder, for some well-documented example programs. Be sure to also read the [Reticulum Overview Document](http://unsigned.io/wp-content/uploads/2018/04/Reticulum_Overview_v0.4.pdf)
|
||||||
|
|
||||||
## Dependencies:
|
## Dependencies:
|
||||||
- cryptography.io
|
- cryptography.io
|
||||||
|
@ -317,7 +317,7 @@ class Identity:
|
|||||||
if destination == None:
|
if destination == None:
|
||||||
destination = packet.generateProofDestination()
|
destination = packet.generateProofDestination()
|
||||||
|
|
||||||
proof = RNS.Packet(destination, proof_data, RNS.Packet.PROOF)
|
proof = RNS.Packet(destination, proof_data, RNS.Packet.PROOF, attached_interface = packet.receiving_interface)
|
||||||
proof.send()
|
proof.send()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -48,7 +48,7 @@ class Packet:
|
|||||||
# Default packet timeout
|
# Default packet timeout
|
||||||
TIMEOUT = 60
|
TIMEOUT = 60
|
||||||
|
|
||||||
def __init__(self, destination, data, packet_type = DATA, context = NONE, transport_type = RNS.Transport.BROADCAST, header_type = HEADER_1, transport_id = None):
|
def __init__(self, destination, data, packet_type = DATA, context = NONE, transport_type = RNS.Transport.BROADCAST, header_type = HEADER_1, transport_id = None, attached_interface = None):
|
||||||
if destination != None:
|
if destination != None:
|
||||||
if transport_type == None:
|
if transport_type == None:
|
||||||
transport_type = RNS.Transport.BROADCAST
|
transport_type = RNS.Transport.BROADCAST
|
||||||
@ -78,6 +78,8 @@ class Packet:
|
|||||||
self.sent_at = None
|
self.sent_at = None
|
||||||
self.packet_hash = None
|
self.packet_hash = None
|
||||||
|
|
||||||
|
self.attached_interface = attached_interface
|
||||||
|
|
||||||
def getPackedFlags(self):
|
def getPackedFlags(self):
|
||||||
if self.context == Packet.LRPROOF:
|
if self.context == Packet.LRPROOF:
|
||||||
packed_flags = (self.header_type << 6) | (self.transport_type << 4) | RNS.Destination.LINK | self.packet_type
|
packed_flags = (self.header_type << 6) | (self.transport_type << 4) | RNS.Destination.LINK | self.packet_type
|
||||||
|
@ -189,8 +189,6 @@ class Transport:
|
|||||||
new_raw += packet.raw[1:2]
|
new_raw += packet.raw[1:2]
|
||||||
new_raw += Transport.destination_table[packet.destination_hash][1]
|
new_raw += Transport.destination_table[packet.destination_hash][1]
|
||||||
new_raw += packet.raw[2:]
|
new_raw += packet.raw[2:]
|
||||||
# RNS.log("Transporting "+str(len(packet.raw))+" bytes via "+RNS.prettyhexrep(Transport.destination_table[packet.destination_hash][1])+" on: "+str(outbound_interface), RNS.LOG_EXTREME)
|
|
||||||
# RNS.log("Hash is "+RNS.prettyhexrep(packet.packet_hash), RNS.LOG_EXTREME)
|
|
||||||
RNS.log("Packet was inserted into transport via "+RNS.prettyhexrep(Transport.destination_table[packet.destination_hash][1])+" on: "+str(outbound_interface), RNS.LOG_DEBUG)
|
RNS.log("Packet was inserted into transport via "+RNS.prettyhexrep(Transport.destination_table[packet.destination_hash][1])+" on: "+str(outbound_interface), RNS.LOG_DEBUG)
|
||||||
outbound_interface.processOutgoing(new_raw)
|
outbound_interface.processOutgoing(new_raw)
|
||||||
sent = True
|
sent = True
|
||||||
@ -205,7 +203,7 @@ class Transport:
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# Broadcast packet on all outgoing interfaces, or relevant
|
# Broadcast packet on all outgoing interfaces, or relevant
|
||||||
# interface, if packet is for a link
|
# interface, if packet is for a link or has an attachede interface
|
||||||
for interface in Transport.interfaces:
|
for interface in Transport.interfaces:
|
||||||
if interface.OUT:
|
if interface.OUT:
|
||||||
should_transmit = True
|
should_transmit = True
|
||||||
@ -214,8 +212,8 @@ class Transport:
|
|||||||
should_transmit = False
|
should_transmit = False
|
||||||
if interface != packet.destination.attached_interface:
|
if interface != packet.destination.attached_interface:
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
else:
|
if packet.attached_interface != None and interface != packet.attached_interface:
|
||||||
pass
|
should_transmit = False
|
||||||
|
|
||||||
if should_transmit:
|
if should_transmit:
|
||||||
RNS.log("Transmitting "+str(len(packet.raw))+" bytes on: "+str(interface), RNS.LOG_EXTREME)
|
RNS.log("Transmitting "+str(len(packet.raw))+" bytes on: "+str(interface), RNS.LOG_EXTREME)
|
||||||
|
Loading…
Reference in New Issue
Block a user