mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
Enabled running Reticulum Transport instance on Android
This commit is contained in:
parent
62c607ce33
commit
cb2be5077e
@ -1045,6 +1045,7 @@ class SidebandApp(MDApp):
|
|||||||
self.widget_hide(self.root.ids.connectivity_serial_fields, collapse)
|
self.widget_hide(self.root.ids.connectivity_serial_fields, collapse)
|
||||||
|
|
||||||
def save_connectivity(sender=None, event=None):
|
def save_connectivity(sender=None, event=None):
|
||||||
|
self.sideband.config["connect_transport"] = self.root.ids.connectivity_enable_transport.active
|
||||||
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
|
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
|
||||||
self.sideband.config["connect_local_groupid"] = self.root.ids.connectivity_local_groupid.text
|
self.sideband.config["connect_local_groupid"] = self.root.ids.connectivity_local_groupid.text
|
||||||
self.sideband.config["connect_local_ifac_netname"] = self.root.ids.connectivity_local_ifac_netname.text
|
self.sideband.config["connect_local_ifac_netname"] = self.root.ids.connectivity_local_ifac_netname.text
|
||||||
@ -1111,6 +1112,7 @@ class SidebandApp(MDApp):
|
|||||||
info += "For changes to connectivity to take effect, you must shut down and restart Sideband.\n"
|
info += "For changes to connectivity to take effect, you must shut down and restart Sideband.\n"
|
||||||
self.root.ids.connectivity_info.text = info
|
self.root.ids.connectivity_info.text = info
|
||||||
|
|
||||||
|
self.root.ids.connectivity_enable_transport.active = self.sideband.config["connect_transport"]
|
||||||
self.root.ids.connectivity_use_local.active = self.sideband.config["connect_local"]
|
self.root.ids.connectivity_use_local.active = self.sideband.config["connect_local"]
|
||||||
con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active)
|
con_collapse_local(collapse=not self.root.ids.connectivity_use_local.active)
|
||||||
self.root.ids.connectivity_local_groupid.text = self.sideband.config["connect_local_groupid"]
|
self.root.ids.connectivity_local_groupid.text = self.sideband.config["connect_local_groupid"]
|
||||||
@ -1149,6 +1151,7 @@ class SidebandApp(MDApp):
|
|||||||
self.root.ids.connectivity_serial_ifac_netname.text = self.sideband.config["connect_serial_ifac_netname"]
|
self.root.ids.connectivity_serial_ifac_netname.text = self.sideband.config["connect_serial_ifac_netname"]
|
||||||
self.root.ids.connectivity_serial_ifac_passphrase.text = self.sideband.config["connect_serial_ifac_passphrase"]
|
self.root.ids.connectivity_serial_ifac_passphrase.text = self.sideband.config["connect_serial_ifac_passphrase"]
|
||||||
|
|
||||||
|
self.root.ids.connectivity_enable_transport.bind(active=save_connectivity)
|
||||||
self.root.ids.connectivity_use_local.bind(active=save_connectivity)
|
self.root.ids.connectivity_use_local.bind(active=save_connectivity)
|
||||||
self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_local_ifac_netname.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_local_ifac_netname.bind(on_text_validate=save_connectivity)
|
||||||
|
@ -245,7 +245,42 @@ class SidebandService():
|
|||||||
else:
|
else:
|
||||||
i2s = "Connecting to I2P"
|
i2s = "Connecting to I2P"
|
||||||
|
|
||||||
stat += "[b]I2P[/b]\n{i2s}".format(i2s=i2s)
|
stat += "[b]I2P[/b]\n{i2s}\n\n".format(i2s=i2s)
|
||||||
|
|
||||||
|
total_rxb = 0
|
||||||
|
total_txb = 0
|
||||||
|
|
||||||
|
if self.sideband.interface_local != None:
|
||||||
|
total_rxb += self.sideband.interface_local.rxb
|
||||||
|
total_txb += self.sideband.interface_local.txb
|
||||||
|
|
||||||
|
if self.sideband.interface_rnode != None:
|
||||||
|
total_rxb += self.sideband.interface_rnode.rxb
|
||||||
|
total_txb += self.sideband.interface_rnode.txb
|
||||||
|
|
||||||
|
if self.sideband.interface_modem != None:
|
||||||
|
total_rxb += self.sideband.interface_modem.rxb
|
||||||
|
total_txb += self.sideband.interface_modem.txb
|
||||||
|
|
||||||
|
if self.sideband.interface_serial != None:
|
||||||
|
total_rxb += self.sideband.interface_serial.rxb
|
||||||
|
total_txb += self.sideband.interface_serial.txb
|
||||||
|
|
||||||
|
if self.sideband.interface_tcp != None:
|
||||||
|
total_rxb += self.sideband.interface_tcp.rxb
|
||||||
|
total_txb += self.sideband.interface_tcp.txb
|
||||||
|
|
||||||
|
if self.sideband.interface_i2p != None:
|
||||||
|
total_rxb += self.sideband.interface_i2p.rxb
|
||||||
|
total_txb += self.sideband.interface_i2p.txb
|
||||||
|
|
||||||
|
if RNS.Reticulum.transport_enabled():
|
||||||
|
stat += "[b]Transport Instance[/b]\nRouting Traffic\n\n"
|
||||||
|
|
||||||
|
stat += "[b]Traffic[/b]\nIn: {inb}\nOut: {outb}\n\n".format(inb=RNS.prettysize(total_rxb), outb=RNS.prettysize(total_txb))
|
||||||
|
|
||||||
|
if stat.endswith("\n\n"):
|
||||||
|
stat = stat[:-2]
|
||||||
|
|
||||||
return stat
|
return stat
|
||||||
|
|
||||||
|
@ -135,8 +135,16 @@ class SidebandCore():
|
|||||||
os.makedirs(self.rns_configdir)
|
os.makedirs(self.rns_configdir)
|
||||||
|
|
||||||
RNS.log("Configuring Reticulum instance...")
|
RNS.log("Configuring Reticulum instance...")
|
||||||
|
if self.config["connect_transport"]:
|
||||||
|
RNS.log("Enabling Reticulum Transport")
|
||||||
|
generated_config = rns_config.replace("TRANSPORT_IS_ENABLED", "Yes")
|
||||||
|
else:
|
||||||
|
RNS.log("Not enabling Reticulum Transport")
|
||||||
|
generated_config = rns_config.replace("TRANSPORT_IS_ENABLED", "No")
|
||||||
|
|
||||||
|
|
||||||
config_file = open(self.rns_configdir+"/config", "wb")
|
config_file = open(self.rns_configdir+"/config", "wb")
|
||||||
config_file.write(rns_config)
|
config_file.write(generated_config.encode("utf-8"))
|
||||||
config_file.close()
|
config_file.close()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -176,6 +184,7 @@ class SidebandCore():
|
|||||||
self.config["last_lxmf_propagation_node"] = None
|
self.config["last_lxmf_propagation_node"] = None
|
||||||
self.config["nn_home_node"] = None
|
self.config["nn_home_node"] = None
|
||||||
# Connectivity
|
# Connectivity
|
||||||
|
self.config["connect_transport"] = False
|
||||||
self.config["connect_local"] = True
|
self.config["connect_local"] = True
|
||||||
self.config["connect_local_groupid"] = ""
|
self.config["connect_local_groupid"] = ""
|
||||||
self.config["connect_local_ifac_netname"] = ""
|
self.config["connect_local_ifac_netname"] = ""
|
||||||
@ -254,6 +263,8 @@ class SidebandCore():
|
|||||||
self.config["lxmf_sync_interval"] = 43200
|
self.config["lxmf_sync_interval"] = 43200
|
||||||
if not "notifications_on" in self.config:
|
if not "notifications_on" in self.config:
|
||||||
self.config["notifications_on"] = True
|
self.config["notifications_on"] = True
|
||||||
|
if not "connect_transport" in self.config:
|
||||||
|
self.config["connect_transport"] = False
|
||||||
if not "connect_rnode" in self.config:
|
if not "connect_rnode" in self.config:
|
||||||
self.config["connect_rnode"] = False
|
self.config["connect_rnode"] = False
|
||||||
if not "connect_rnode_ifac_netname" in self.config:
|
if not "connect_rnode_ifac_netname" in self.config:
|
||||||
@ -1577,7 +1588,7 @@ class SidebandCore():
|
|||||||
|
|
||||||
rns_config = """
|
rns_config = """
|
||||||
[reticulum]
|
[reticulum]
|
||||||
enable_transport = False
|
enable_transport = TRANSPORT_IS_ENABLED
|
||||||
share_instance = Yes
|
share_instance = Yes
|
||||||
shared_instance_port = 37428
|
shared_instance_port = 37428
|
||||||
instance_control_port = 37429
|
instance_control_port = 37429
|
||||||
@ -1586,4 +1597,4 @@ panic_on_interface_error = No
|
|||||||
[logging]
|
[logging]
|
||||||
loglevel = 3
|
loglevel = 3
|
||||||
|
|
||||||
""".encode("utf-8")
|
"""
|
@ -531,13 +531,13 @@ MDNavigationLayout:
|
|||||||
id: connectivity_transport_label
|
id: connectivity_transport_label
|
||||||
text: "Enable Reticulum Transport"
|
text: "Enable Reticulum Transport"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
disabled: True
|
# disabled: True
|
||||||
|
|
||||||
MDSwitch:
|
MDSwitch:
|
||||||
id: connectivity_enable_transport
|
id: connectivity_enable_transport
|
||||||
active: False
|
active: False
|
||||||
pos_hint: {"center_y": 0.3}
|
pos_hint: {"center_y": 0.3}
|
||||||
disabled: True
|
# disabled: True
|
||||||
|
|
||||||
|
|
||||||
MDScreen:
|
MDScreen:
|
||||||
|
Loading…
Reference in New Issue
Block a user