Improved I2P interface display in rnstatus

This commit is contained in:
Mark Qvist 2022-05-25 15:50:54 +02:00
parent 7848b7e396
commit d3ab0878e0
7 changed files with 98 additions and 82 deletions

View File

@ -530,7 +530,7 @@ class I2PInterfacePeer(Interface):
class I2PInterface(Interface): class I2PInterface(Interface):
BITRATE_GUESS = 256*1000 BITRATE_GUESS = 256*1000
def __init__(self, owner, name, rns_storagepath, peers, connectable = True): def __init__(self, owner, name, rns_storagepath, peers, connectable = False):
self.rxb = 0 self.rxb = 0
self.txb = 0 self.txb = 0
self.online = False self.online = False
@ -580,7 +580,7 @@ class I2PInterface(Interface):
if peers != None: if peers != None:
for peer_addr in peers: for peer_addr in peers:
interface_name = peer_addr interface_name = self.name+" to "+peer_addr
peer_interface = I2PInterfacePeer(self, self.owner, interface_name, peer_addr) peer_interface = I2PInterfacePeer(self, self.owner, interface_name, peer_addr)
peer_interface.OUT = True peer_interface.OUT = True
peer_interface.IN = True peer_interface.IN = True

View File

@ -936,6 +936,12 @@ class Reticulum:
else: else:
ifstats["clients"] = None ifstats["clients"] = None
if hasattr(interface, "i2p") and hasattr(interface, "connectable"):
if interface.connectable:
ifstats["i2p_connectable"] = True
else:
ifstats["i2p_connectable"] = False
if hasattr(interface, "b32"): if hasattr(interface, "b32"):
if interface.b32 != None: if interface.b32 != None:
ifstats["i2p_b32"] = interface.b32+".b32.i2p" ifstats["i2p_b32"] = interface.b32+".b32.i2p"

View File

@ -59,7 +59,14 @@ def program_setup(configdir, dispall=False, verbosity = 0):
for ifstat in stats["interfaces"]: for ifstat in stats["interfaces"]:
name = ifstat["name"] name = ifstat["name"]
if dispall or not (name.startswith("LocalInterface[") or name.startswith("TCPInterface[Client") or name.startswith("I2PInterfacePeer[Connected peer")): if dispall or not (
name.startswith("LocalInterface[") or
name.startswith("TCPInterface[Client") or
name.startswith("I2PInterfacePeer[Connected peer") or
(name.startswith("I2PInterface[") and ("i2p_connectable" in ifstat and ifstat["i2p_connectable"] == False))
):
if not (name.startswith("I2PInterface[") and ("i2p_connectable" in ifstat and ifstat["i2p_connectable"] == False)):
print("") print("")
if ifstat["status"]: if ifstat["status"]:
@ -92,6 +99,7 @@ def program_setup(configdir, dispall=False, verbosity = 0):
clients_string = "Serving : "+str(cnum)+spec_str clients_string = "Serving : "+str(cnum)+spec_str
elif name.startswith("I2PInterface["): elif name.startswith("I2PInterface["):
if "i2p_connectable" in ifstat and ifstat["i2p_connectable"] == True:
cnum = max(clients-1,0) cnum = max(clients-1,0)
if cnum == 1: if cnum == 1:
spec_str = " connected I2P endpoint" spec_str = " connected I2P endpoint"
@ -99,6 +107,8 @@ def program_setup(configdir, dispall=False, verbosity = 0):
spec_str = " connected I2P endpoints" spec_str = " connected I2P endpoints"
clients_string = "Peers : "+str(cnum)+spec_str clients_string = "Peers : "+str(cnum)+spec_str
else:
clients_string = ""
else: else:
clients_string = "Clients : "+str(clients) clients_string = "Clients : "+str(clients)
@ -112,7 +122,7 @@ def program_setup(configdir, dispall=False, verbosity = 0):
print(" Status : {ss}".format(ss=ss)) print(" Status : {ss}".format(ss=ss))
if clients != None: if clients != None and clients_string != "":
print(" "+clients_string) print(" "+clients_string)
if not (name.startswith("Shared Instance[") or name.startswith("TCPInterface[Client") or name.startswith("LocalInterface[")): if not (name.startswith("Shared Instance[") or name.startswith("TCPInterface[Client") or name.startswith("LocalInterface[")):

View File

@ -100,7 +100,7 @@ at.
To use the I2P interface, you must have an I2P router running To use the I2P interface, you must have an I2P router running
on your system. The easiest way to acheive this is to download and on your system. The easiest way to acheive this is to download and
install the `latest release <https://github.com/PurpleI2P/i2pd/releases/latest>`_ install the `latest release <https://github.com/PurpleI2P/i2pd/releases/latest>`_
of the ``ì2pd`` package. For more details about I2P, see the of the ``i2pd`` package. For more details about I2P, see the
`geti2p.net website <https://geti2p.net/en/about/intro>`_.` `geti2p.net website <https://geti2p.net/en/about/intro>`_.`
When an I2P router is running on your system, you can simply add When an I2P router is running on your system, you can simply add

View File

@ -121,7 +121,7 @@ at.</p>
<p>To use the I2P interface, you must have an I2P router running <p>To use the I2P interface, you must have an I2P router running
on your system. The easiest way to acheive this is to download and on your system. The easiest way to acheive this is to download and
install the <a class="reference external" href="https://github.com/PurpleI2P/i2pd/releases/latest">latest release</a> install the <a class="reference external" href="https://github.com/PurpleI2P/i2pd/releases/latest">latest release</a>
of the <code class="docutils literal notranslate"><span class="pre">ì2pd</span></code> package. For more details about I2P, see the of the <code class="docutils literal notranslate"><span class="pre">i2pd</span></code> package. For more details about I2P, see the
<a class="reference external" href="https://geti2p.net/en/about/intro">geti2p.net website</a>.`</p> <a class="reference external" href="https://geti2p.net/en/about/intro">geti2p.net website</a>.`</p>
<p>When an I2P router is running on your system, you can simply add <p>When an I2P router is running on your system, you can simply add
an I2P interface to reticulum:</p> an I2P interface to reticulum:</p>

File diff suppressed because one or more lines are too long

View File

@ -100,8 +100,8 @@ at.
To use the I2P interface, you must have an I2P router running To use the I2P interface, you must have an I2P router running
on your system. The easiest way to acheive this is to download and on your system. The easiest way to acheive this is to download and
install the `latest release <https://github.com/PurpleI2P/i2pd/releases/latest>`_ install the `latest release <https://github.com/PurpleI2P/i2pd/releases/latest>`_
of the ``ì2pd`` package. For more details about I2P, see the of the ``i2pd`` package. For more details about I2P, see the
`geti2p.net website <https://geti2p.net/en/about/intro>`_.` `geti2p.net website <https://geti2p.net/en/about/intro>`_.
When an I2P router is running on your system, you can simply add When an I2P router is running on your system, you can simply add
an I2P interface to reticulum: an I2P interface to reticulum: