-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Starting diode_node version 1.8.0 there is a new type of port supported to support native UDP and TCP relaying. To open such a port these are the API steps:
ClientA to Server => ["portopen2", device_id, portname, flags]
Server to ClientB => ["portopen2", portname, physical_port, source_device_address, flags]
ClientB to Server => ["response", pysical_port, "ok"]
Server to ClientA => ["ok", pysical_port]
Then the server will have opened on <server_ip>:<physical_port> a TCP port or a UDP port when flags contains a u character such as in "rwu" (read-write-udp)
Both clients should connect from their side to the address which will then act as tunnel.
To account for bandwidth usage the server will from time to time request new tickets on the original api socket via:
Server to Client => ["ticket_request", device_usage]
When this request is received by the client, the client has 20 seconds to submit a ticket covering at least the stated device_usage total bytes or disconnect. If no ticket is submitted within the timeout the server disconnect the client.