Data Connections
Dedicated data tunnels for forwarding traffic.
Overview
Data connections carry the actual traffic between public users and local services. Each incoming public connection gets its own dedicated data tunnel through port 9001 on the relay server.
Per-connection model
Exposr uses a per-connection data tunnel model. This means:
- Each public connection gets a unique UUID
- A fresh TCP connection to port 9001 is created for each public connection
- The data connection is identified by the UUID
- When the public client disconnects, the corresponding data connection is closed
This model is simple and reliable but introduces overhead because a new TCP handshake is required for every public connection. Connection pooling is a planned improvement.
Connection flow
- Server receives a public connection and generates a UUID
- Server sends
CONNECT <uuid>to the agent over the control channel - Agent connects to the local service on the target port
- Agent opens a new TCP connection to port 9001
- Agent sends
DATA <uuid>to identify the connection - Server matches the UUID and bridges the public socket with the data connection
- Traffic flows bidirectionally using asyncio streams
text
# Agent -> Server (on port 9001):
DATA 8bab2f9a-b0e2-4db2-8fed-9a8dda8e3aed