Added remote transport ID info to rnstatus

This commit is contained in:
Mark Qvist 2026-11-13 23:26:46 +01:00
parent 3281e28315
commit 464e75986e
No known key found for this signature in database
7 changed files with 20 additions and 3 deletions

View file

@ -155,6 +155,7 @@ class BackboneInterface(Interface):
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
self.spawned_interfaces = []
self.supports_discovery = True
self.tunnels_allowed = True
self.client_limit = client_limit or self.CLIENT_LIMIT
self.block_fast_flapping = flap_block
self.fast_flap_threshold = flap_threshold
@ -883,6 +884,7 @@ class BackboneClientInterface(Interface):
self.OUT = False
self.socket = None
self.parent_interface = None
self.tunnels_allowed = True
self.name = name
self.initiator = False
self.reconnecting = False
@ -936,8 +938,7 @@ class BackboneClientInterface(Interface):
thread = threading.Thread(target=self.reconnect)
thread.daemon = True
thread.start()
else:
self.wants_tunnel = True
else: self.wants_tunnel = True
def set_timeouts_linux(self):
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_USER_TIMEOUT, int(BackboneClientInterface.TCP_USER_TIMEOUT * 1000))

View file

@ -353,6 +353,7 @@ class I2PInterfacePeer(Interface):
self.online = False
self.detached = False
self.kiss_framing = False
self.tunnels_allowed = True
self.i2p_tunneled = True
self.i2p_dest = None
self.i2p_tunnel_ready = False
@ -738,6 +739,7 @@ class I2PInterface(Interface):
self.owner = owner
self.connectable = connectable
self.i2p_tunneled = True
self.tunnels_allowed = True
self.peers = peers
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL

View file

@ -130,6 +130,8 @@ class Interface:
self.spawned_interfaces = None
self.tunnel_id = None
self.local_tunnel_id = None
self.tunnels_allowed = False
self.remote_transport = None
self.ingress_control = True
self.phy_keepalive = False
self.shared_medium = False

View file

@ -126,6 +126,7 @@ class TCPClientInterface(Interface):
self.writing = False
self.online = False
self.detached = False
self.tunnels_allowed = True
self.kiss_framing = kiss_framing
self.i2p_tunneled = i2p_tunneled
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
@ -529,6 +530,7 @@ class TCPServerInterface(Interface):
self.OUT = False
self.name = name
self.detached = False
self.tunnels_allowed = True
self.i2p_tunneled = i2p_tunneled
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL

View file

@ -1794,7 +1794,6 @@ class Reticulum:
ifstats["name"] = str(interface)
ifstats["short_name"] = str(interface.name)
ifstats["tunnel_id"] = interface.tunnel_id or interface.local_tunnel_id
ifstats["hash"] = interface.get_hash()
ifstats["type"] = str(type(interface).__name__)
ifstats["mtu"] = interface.HW_MTU
@ -1836,6 +1835,8 @@ class Reticulum:
ifstats["protocol_violations"] = interface.protocol_violations
ifstats["ifac_violations"] = interface.ifac_violations
ifstats["packet_filter_hits"] = interface.packet_filter_hits
ifstats["tunnel_id"] = interface.tunnel_id or interface.local_tunnel_id
ifstats["remote_transport_id"] = interface.remote_transport.hash if interface.remote_transport else None
interfaces.append(ifstats)

View file

@ -3125,6 +3125,11 @@ class Transport:
@staticmethod
def tunnel_synthesize_handler(data, packet):
try:
if not packet.receiving_interface.tunnels_allowed: return
if packet.receiving_interface.remote_transport:
RNS.log(f"Tunnel already synthesized on {packet.receiving_interface}, ignoring synthesis packet", RNS.LOG_DEBUG) if RNS.sl(RNS.LOG_DEBUG) else None
return
expected_length = RNS.Identity.KEYSIZE//8+RNS.Identity.HASHLENGTH//8+RNS.Reticulum.TRUNCATED_HASHLENGTH//8+RNS.Identity.SIGLENGTH//8
if len(data) == expected_length:
public_key = data[:RNS.Identity.KEYSIZE//8]
@ -3140,6 +3145,7 @@ class Transport:
remote_transport_identity.load_public_key(public_key)
if remote_transport_identity.validate(signature, signed_data):
packet.receiving_interface.remote_transport = remote_transport_identity
Transport.handle_tunnel(tunnel_id, packet.receiving_interface)
else:

View file

@ -559,6 +559,9 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
if tstats and "tunnel_id" in ifstat:
print(f" Tunnel ID : {RNS.prettyhexrep(ifstat['tunnel_id']) if ifstat['tunnel_id'] else 'None'}")
if tstats and "remote_transport_id" in ifstat:
print(f" Rem.Tr.ID : {RNS.prettyhexrep(ifstat['remote_transport_id']) if ifstat['remote_transport_id'] else 'Unknown'}")
if "noise_floor" in ifstat:
if not "interference" in ifstat: nstr = ""
else: