mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 21:50:18 +00:00
Added Access Point interface mode
This commit is contained in:
parent
8ec356a28e
commit
0e1279d012
@ -86,19 +86,19 @@ Reticulum implements a range of generalised interface types that covers most of
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Feature Roadmap
|
## Planned Features
|
||||||
- Stream mode for links
|
|
||||||
- Globally routable multicast
|
|
||||||
- More interface types for even broader compatibility
|
- More interface types for even broader compatibility
|
||||||
- ESP32 devices (ESP-Now, Bluetooth, etc.)
|
- ESP32 devices (ESP-Now, Bluetooth, etc.)
|
||||||
- More LoRa transceivers
|
- More LoRa transceivers
|
||||||
- AT-compatible modems
|
- AT-compatible modems
|
||||||
- AWDL / OWL
|
- AWDL / OWL
|
||||||
|
- HF Modems
|
||||||
- CAN-bus
|
- CAN-bus
|
||||||
- ZeroMQ
|
- ZeroMQ
|
||||||
- MQTT
|
- MQTT
|
||||||
- SPI
|
- SPI
|
||||||
- i²c
|
- i²c
|
||||||
|
- Globally routable multicast
|
||||||
|
|
||||||
## Dependencies:
|
## Dependencies:
|
||||||
- Python 3.6
|
- Python 3.6
|
||||||
|
@ -7,6 +7,10 @@ class Interface:
|
|||||||
RPT = False
|
RPT = False
|
||||||
name = None
|
name = None
|
||||||
|
|
||||||
|
MODE_FULL = 0x01
|
||||||
|
MODE_POINT_TO_POINT = 0x02
|
||||||
|
MODE_ACCESS_POINT = 0x03
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.rxb = 0
|
self.rxb = 0
|
||||||
self.txb = 0
|
self.txb = 0
|
||||||
|
@ -37,6 +37,7 @@ class LocalClientInterface(Interface):
|
|||||||
self.never_connected = True
|
self.never_connected = True
|
||||||
self.detached = False
|
self.detached = False
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
if connected_socket != None:
|
if connected_socket != None:
|
||||||
self.receives = True
|
self.receives = True
|
||||||
@ -237,6 +238,7 @@ class LocalServerInterface(Interface):
|
|||||||
self.IN = True
|
self.IN = True
|
||||||
self.OUT = False
|
self.OUT = False
|
||||||
self.name = "Reticulum"
|
self.name = "Reticulum"
|
||||||
|
self.mode = RNS.Interfaces.Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
if (bindport != None):
|
if (bindport != None):
|
||||||
self.receives = True
|
self.receives = True
|
||||||
|
@ -280,6 +280,16 @@ class Reticulum:
|
|||||||
if not name in interface_names:
|
if not name in interface_names:
|
||||||
c = self.config["interfaces"][name]
|
c = self.config["interfaces"][name]
|
||||||
|
|
||||||
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
|
|
||||||
|
if "mode" in c:
|
||||||
|
if c["mode"] == "full":
|
||||||
|
interface_mode = Interface.Interface.MODE_FULL
|
||||||
|
elif c["mode"] == "accesspoint" or c["mode"] == "ap":
|
||||||
|
interface_mode = Interface.Interface.MODE_ACCESS_POINT
|
||||||
|
elif c["mode"] == "pointtopoint" or c["mode"] == "ptp":
|
||||||
|
interface_mode = Interface.Interface.MODE_POINT_TO_POINT
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if ("interface_enabled" in c) and c.as_bool("interface_enabled") == True:
|
if ("interface_enabled" in c) and c.as_bool("interface_enabled") == True:
|
||||||
if c["type"] == "AutoInterface":
|
if c["type"] == "AutoInterface":
|
||||||
@ -307,6 +317,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
else:
|
else:
|
||||||
RNS.log("AutoInterface is not currently supported on Windows, disabling interface.", RNS.LOG_ERROR);
|
RNS.log("AutoInterface is not currently supported on Windows, disabling interface.", RNS.LOG_ERROR);
|
||||||
@ -343,6 +355,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
|
||||||
@ -370,6 +384,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
|
||||||
@ -394,6 +410,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
|
||||||
@ -414,6 +432,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
|
||||||
@ -442,6 +462,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
if c["type"] == "KISSInterface":
|
if c["type"] == "KISSInterface":
|
||||||
@ -483,6 +505,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
if c["type"] == "AX25KISSInterface":
|
if c["type"] == "AX25KISSInterface":
|
||||||
@ -525,6 +549,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
if c["type"] == "RNodeInterface":
|
if c["type"] == "RNodeInterface":
|
||||||
@ -561,6 +587,8 @@ class Reticulum:
|
|||||||
else:
|
else:
|
||||||
interface.OUT = True
|
interface.OUT = True
|
||||||
|
|
||||||
|
interface.mode = interface_mode
|
||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
else:
|
else:
|
||||||
RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)
|
RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)
|
||||||
|
@ -35,6 +35,7 @@ class Transport:
|
|||||||
PATHFINDER_T = 10 # Retry grace period
|
PATHFINDER_T = 10 # Retry grace period
|
||||||
PATHFINDER_RW = 10 # Random window for announce rebroadcast
|
PATHFINDER_RW = 10 # Random window for announce rebroadcast
|
||||||
PATHFINDER_E = 60*60*24*7 # Path expiration in seconds
|
PATHFINDER_E = 60*60*24*7 # Path expiration in seconds
|
||||||
|
AP_PATH_TIME = 60*60*24 # Expiration for Access Point paths
|
||||||
|
|
||||||
# TODO: Calculate an optimal number for this in
|
# TODO: Calculate an optimal number for this in
|
||||||
# various situations
|
# various situations
|
||||||
@ -511,13 +512,19 @@ class Transport:
|
|||||||
for interface in Transport.interfaces:
|
for interface in Transport.interfaces:
|
||||||
if interface.OUT:
|
if interface.OUT:
|
||||||
should_transmit = True
|
should_transmit = True
|
||||||
|
|
||||||
if packet.destination.type == RNS.Destination.LINK:
|
if packet.destination.type == RNS.Destination.LINK:
|
||||||
if packet.destination.status == RNS.Link.CLOSED:
|
if packet.destination.status == RNS.Link.CLOSED:
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
if interface != packet.destination.attached_interface:
|
if interface != packet.destination.attached_interface:
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
|
|
||||||
if packet.attached_interface != None and interface != packet.attached_interface:
|
if packet.attached_interface != None and interface != packet.attached_interface:
|
||||||
should_transmit = False
|
should_transmit = False
|
||||||
|
|
||||||
|
if packet.packet_type == RNS.Packet.ANNOUNCE:
|
||||||
|
if packet.attached_interface == None and interface.mode == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT:
|
||||||
|
should_transmit = False
|
||||||
|
|
||||||
if should_transmit:
|
if should_transmit:
|
||||||
if not stored_hash:
|
if not stored_hash:
|
||||||
@ -862,12 +869,16 @@ class Transport:
|
|||||||
if should_add:
|
if should_add:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
retries = 0
|
retries = 0
|
||||||
expires = now + Transport.PATHFINDER_E
|
|
||||||
announce_hops = packet.hops
|
announce_hops = packet.hops
|
||||||
local_rebroadcasts = 0
|
local_rebroadcasts = 0
|
||||||
block_rebroadcasts = False
|
block_rebroadcasts = False
|
||||||
attached_interface = None
|
attached_interface = None
|
||||||
retransmit_timeout = now + math.pow(Transport.PATHFINDER_C, packet.hops) + (RNS.rand() * Transport.PATHFINDER_RW)
|
retransmit_timeout = now + math.pow(Transport.PATHFINDER_C, packet.hops) + (RNS.rand() * Transport.PATHFINDER_RW)
|
||||||
|
|
||||||
|
if packet.receiving_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT:
|
||||||
|
expires = now + Transport.AP_PATH_TIME
|
||||||
|
else:
|
||||||
|
expires = now + Transport.PATHFINDER_E
|
||||||
|
|
||||||
random_blobs.append(random_blob)
|
random_blobs.append(random_blob)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user