Fixed missing config section check
This commit is contained in:
parent
b53185779a
commit
5158613501
@ -349,6 +349,7 @@ class Reticulum:
|
|||||||
if self.is_shared_instance or self.is_standalone_instance:
|
if self.is_shared_instance or self.is_standalone_instance:
|
||||||
RNS.log("Bringing up system interfaces...", RNS.LOG_VERBOSE)
|
RNS.log("Bringing up system interfaces...", RNS.LOG_VERBOSE)
|
||||||
interface_names = []
|
interface_names = []
|
||||||
|
if "interfaces" in self.config:
|
||||||
for name in self.config["interfaces"]:
|
for name in self.config["interfaces"]:
|
||||||
if not name in interface_names:
|
if not name in interface_names:
|
||||||
# TODO: We really need to generalise this way of instantiating
|
# TODO: We really need to generalise this way of instantiating
|
||||||
@ -880,6 +881,53 @@ class Reticulum:
|
|||||||
|
|
||||||
RNS.log("System interfaces are ready", RNS.LOG_VERBOSE)
|
RNS.log("System interfaces are ready", RNS.LOG_VERBOSE)
|
||||||
|
|
||||||
|
def _add_interface(self,interface, mode = None, configured_bitrate=None, ifac_size=None, ifac_netname=None, ifac_netkey=None, announce_cap=None, announce_rate_target=None, announce_rate_grace=None, announce_rate_penalty=None):
|
||||||
|
if not self.is_connected_to_shared_instance:
|
||||||
|
if interface != None and issubclass(type(interface), RNS.Interfaces.Interface.Interface):
|
||||||
|
|
||||||
|
if mode == None:
|
||||||
|
mode = Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
|
interface.mode = mode
|
||||||
|
|
||||||
|
if configured_bitrate:
|
||||||
|
interface.bitrate = configured_bitrate
|
||||||
|
|
||||||
|
if ifac_size != None:
|
||||||
|
interface.ifac_size = ifac_size
|
||||||
|
else:
|
||||||
|
interface.ifac_size = 8
|
||||||
|
|
||||||
|
interface.announce_cap = announce_cap
|
||||||
|
interface.announce_rate_target = announce_rate_target
|
||||||
|
interface.announce_rate_grace = announce_rate_grace
|
||||||
|
interface.announce_rate_penalty = announce_rate_penalty
|
||||||
|
|
||||||
|
interface.ifac_netname = ifac_netname
|
||||||
|
interface.ifac_netkey = ifac_netkey
|
||||||
|
|
||||||
|
if interface.ifac_netname != None or interface.ifac_netkey != None:
|
||||||
|
ifac_origin = b""
|
||||||
|
|
||||||
|
if interface.ifac_netname != None:
|
||||||
|
ifac_origin += RNS.Identity.full_hash(interface.ifac_netname.encode("utf-8"))
|
||||||
|
|
||||||
|
if interface.ifac_netkey != None:
|
||||||
|
ifac_origin += RNS.Identity.full_hash(interface.ifac_netkey.encode("utf-8"))
|
||||||
|
|
||||||
|
ifac_origin_hash = RNS.Identity.full_hash(ifac_origin)
|
||||||
|
interface.ifac_key = RNS.Cryptography.hkdf(
|
||||||
|
length=64,
|
||||||
|
derive_from=ifac_origin_hash,
|
||||||
|
salt=self.ifac_salt,
|
||||||
|
context=None
|
||||||
|
)
|
||||||
|
|
||||||
|
interface.ifac_identity = RNS.Identity.from_bytes(interface.ifac_key)
|
||||||
|
interface.ifac_signature = interface.ifac_identity.sign(RNS.Identity.full_hash(interface.ifac_key))
|
||||||
|
|
||||||
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __clean_caches(self):
|
def __clean_caches(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user