diff --git a/meshchat.py b/meshchat.py index 55b2fe4..b182ed5 100644 --- a/meshchat.py +++ b/meshchat.py @@ -380,6 +380,43 @@ async def index(request): interface_details["listen_ip"] = data.get('listen_ip') interface_details["listen_port"] = data.get('listen_port') + # handle udp interface + if interface_type == "UDPInterface": + + interface_listen_ip = data.get('listen_ip') + interface_listen_port = data.get('listen_port') + interface_forward_ip = data.get('forward_ip') + interface_forward_port = data.get('forward_port') + + # ensure listen ip provided + if interface_listen_ip is None or interface_listen_ip == "": + return web.json_response({ + "message": "Listen IP is required", + }, status=422) + + # ensure listen port provided + if interface_listen_port is None or interface_listen_port == "": + return web.json_response({ + "message": "Listen Port is required", + }, status=422) + + # ensure forward ip provided + if interface_forward_ip is None or interface_forward_ip == "": + return web.json_response({ + "message": "Forward IP is required", + }, status=422) + + # ensure forward port provided + if interface_forward_port is None or interface_forward_port == "": + return web.json_response({ + "message": "Forward Port is required", + }, status=422) + + interface_details["listen_ip"] = data.get('listen_ip') + interface_details["listen_port"] = data.get('listen_port') + interface_details["forward_ip"] = data.get('forward_ip') + interface_details["forward_port"] = data.get('forward_port') + # handle rnode interface if interface_type == "RNodeInterface": diff --git a/public/index.html b/public/index.html index 23727aa..1c5b2e2 100644 --- a/public/index.html +++ b/public/index.html @@ -967,6 +967,11 @@ {{ iface.type }} • {{ iface.listen_ip }}:{{ iface.listen_port }} + + + {{ iface.type }} • {{ iface.listen_ip }}:{{ iface.listen_port }} • {{ iface.forward_ip }}:{{ iface.forward_port }} + + {{ iface.type }} • {{ iface.port }} • freq={{ iface.frequency }} • bw={{ iface.bandwidth }} • power={{ iface.txpower }}dBm • sf={{ iface.spreadingfactor }} • cr={{ iface.codingrate }} @@ -1071,6 +1076,7 @@ +
Need help? Reticulum Docs: Configuring Interfaces @@ -1090,17 +1096,29 @@
-
+
-
+
+ +
+ + +
+ + +
+ + +
+
@@ -1282,6 +1300,9 @@ newInterfaceListenIp: null, newInterfaceListenPort: null, + newInterfaceForwardIp: null, + newInterfaceForwardPort: null, + newInterfacePort: null, newInterfaceFrequency: null, newInterfaceBandwidth: null, @@ -2055,6 +2076,10 @@ // example: "TCPServerInterface[TCP Server Interface/0.0.0.0:4242]"; return `TCPServerInterface[${interfaceName}/${iface.listen_ip}:${iface.listen_port}]`; } + case "UDPInterface": { + // example: "UDPInterface[UDP Interface/0.0.0.0:1234]"; + return `UDPInterface[${interfaceName}/${iface.listen_ip}:${iface.listen_port}]`; + } default: { // example: "RNodeInterface[RNode LoRa Interface Fast]", return `${iface.type}[${interfaceName}]`; @@ -2729,10 +2754,14 @@ this.newInterfaceTargetHost = null; this.newInterfaceTargetPort = null; - // tcp server interface + // tcp server interface & udp interface this.newInterfaceListenIp = null; this.newInterfaceListenPort = null; + // udp interface + this.newInterfaceForwardIp = null; + this.newInterfaceForwardPort = null; + // rnode interface this.newInterfacePort = null; this.newInterfaceFrequency = null; @@ -2761,10 +2790,14 @@ this.newInterfaceTargetHost = iface.target_host; this.newInterfaceTargetPort = iface.target_port; - // tcp server interface + // tcp server interface & udp interface this.newInterfaceListenIp = iface.listen_ip; this.newInterfaceListenPort = iface.listen_port; + // udp interface + this.newInterfaceForwardIp = iface.forward_ip; + this.newInterfaceForwardPort = iface.forward_port; + // rnode interface this.newInterfacePort = iface.port; this.newInterfaceFrequency = iface.frequency; @@ -2808,9 +2841,12 @@ // tcp client interface target_host: this.newInterfaceTargetHost, target_port: this.newInterfaceTargetPort, - // tcp server interface + // tcp server interface & udp interface listen_ip: this.newInterfaceListenIp, listen_port: this.newInterfaceListenPort, + // udp interface + forward_ip: this.newInterfaceForwardIp, + forward_port: this.newInterfaceForwardPort, // rnode interface port: this.newInterfacePort, frequency: this.newInterfaceFrequency,