DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
relay_listener.h File Reference

Server-side TCP relay / DNAT listener (DETWS_ENABLE_RELAY) - publish an internal host:port on a server port. More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Server-side TCP relay / DNAT listener (DETWS_ENABLE_RELAY) - publish an internal host:port on a server port.

Wires the pure relay engine (relay.h) into the server: an inbound connection accepted on a published port is bridged to an origin (an outbound det_client connection to the internal service). A ConnProto::PROTO_RELAY connection handler opens the origin on accept, pumps bytes both ways each poll (via det_relay_step), and tears both down on close - the DNAT return path is automatic.

Usage (opt-in twice: compiled out by default, and inert until you publish a port):

int32_t li = server.listen(8080, ConnProto::PROTO_RELAY); // front port 8080
det_relay_publish((uint8_t)li, "192.168.1.60", 80); // -> internal 192.168.1.60:80
@ PROTO_RELAY
TCP relay / DNAT (DETWS_ENABLE_RELAY): bridge to an origin det_client connection.

Security: this is an open forward to whatever origin you publish - only publish trusted internal targets, and do not expose the front port to an untrusted network without an upstream ACL.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file relay_listener.h.