mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-12-14 18:34:25 -05:00
Internal interface config handling for I2PInterface
This commit is contained in:
parent
e2efc61208
commit
cd8fe95d91
@ -830,8 +830,17 @@ 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 = False, ifac_size = 16, ifac_netname = None, ifac_netkey = None):
|
def __init__(self, owner, configuration):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
c = configuration
|
||||||
|
name = c["name"]
|
||||||
|
rns_storagepath = c["storagepath"]
|
||||||
|
peers = c.as_list("peers") if "peers" in c else None
|
||||||
|
connectable = c.as_bool("connectable") if "connectable" in c else False
|
||||||
|
ifac_size = c["ifac_size"]
|
||||||
|
ifac_netname = c["ifac_netname"]
|
||||||
|
ifac_netkey = c["ifac_netkey"]
|
||||||
|
|
||||||
self.HW_MTU = 1064
|
self.HW_MTU = 1064
|
||||||
|
|
||||||
|
@ -602,37 +602,17 @@ class Reticulum:
|
|||||||
interface_post_init(interface)
|
interface_post_init(interface)
|
||||||
|
|
||||||
if c["type"] == "I2PInterface":
|
if c["type"] == "I2PInterface":
|
||||||
i2p_peers = c.as_list("peers") if "peers" in c else None
|
|
||||||
connectable = c.as_bool("connectable") if "connectable" in c else False
|
|
||||||
|
|
||||||
if ifac_size == None:
|
|
||||||
ifac_size = 16
|
|
||||||
|
|
||||||
interface = I2PInterface.I2PInterface(
|
|
||||||
RNS.Transport,
|
|
||||||
name,
|
|
||||||
Reticulum.storagepath,
|
|
||||||
i2p_peers,
|
|
||||||
connectable = connectable,
|
|
||||||
ifac_size = ifac_size,
|
|
||||||
ifac_netname = ifac_netname,
|
|
||||||
ifac_netkey = ifac_netkey,
|
|
||||||
)
|
|
||||||
|
|
||||||
if "outgoing" in c and c.as_bool("outgoing") == False:
|
|
||||||
interface.OUT = False
|
|
||||||
else:
|
|
||||||
interface.OUT = True
|
|
||||||
|
|
||||||
if interface_mode == Interface.Interface.MODE_ACCESS_POINT:
|
if interface_mode == Interface.Interface.MODE_ACCESS_POINT:
|
||||||
RNS.log(str(interface)+" does not support Access Point mode, reverting to default mode: Full", RNS.LOG_WARNING)
|
RNS.log(str(interface)+" does not support Access Point mode, reverting to default mode: Full", RNS.LOG_WARNING)
|
||||||
interface_mode = Interface.Interface.MODE_FULL
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
interface.mode = interface_mode
|
|
||||||
|
|
||||||
interface.announce_cap = announce_cap
|
interface_config["storagepath"] = Reticulum.storagepath
|
||||||
if configured_bitrate:
|
interface_config["ifac_netname"] = ifac_netname
|
||||||
interface.bitrate = configured_bitrate
|
interface_config["ifac_netkey"] = ifac_netkey
|
||||||
|
interface_config["ifac_size"] = ifac_size
|
||||||
|
|
||||||
|
interface = I2PInterface.I2PInterface(RNS.Transport, interface_config)
|
||||||
|
interface_post_init(interface)
|
||||||
|
|
||||||
if c["type"] == "SerialInterface":
|
if c["type"] == "SerialInterface":
|
||||||
port = c["port"] if "port" in c else None
|
port = c["port"] if "port" in c else None
|
||||||
|
Loading…
Reference in New Issue
Block a user