An async HTTP proxy for the ESP32 using the ESP-IDF.
The proxy works by making use of the std
library exposed through
the ESP-IDF
.
It connects to WiFi and listens for TCP clients for whom to proxy HTTP requests. The proxying happens through a makeshift bi-directional data copy
similar to tokio::io::copy_bidirectional after a CONNECT
request is received and a connection to the destination is established.
Please have a look through The Rust on ESP Book for setting up the dev environment.
Depending on the espflash
version, you might have to tweak .cargo/config.toml
.
There are a couple of environment variables to configure the proxy server:
PROXY_SSID
: WiFi SSID, mandatoryPROXY_PASS
: WiFi password, mandatoryPROXY_PORT
: TCP server listening port, mandatoryPROXY_TUNNEL_TIMEOUT
: Timeout for read operations in milliseconds, optional, defaults to1000
.PROXY_TUNNEL_BUF_SIZE
: Buffer size in bytes for data copying, optional, defaults to6144
PROXY_NUM_SOCKETS
: Maximum number of TCP sockets that can be open at the same time, optional, defaults to16
.