How it works
tunl.surf is two programs. Both run on your machine. A request is not held at some other reception point.
Path of an HTTP request
-
The client goes to the public address
The address has the form
name.127.0.0.1.sslip.io.127.0.0.1.sslip.ioresolves to this machine. The port is the HTTP endpoint:8080by default. -
aditd accepts the request
The server reads the tunnel name from the Host header. If an edge rule is set, it is applied here. If the rule does not match, the request does not go to the agent.
-
The agent writes to the local port
tunlis connected to the control port (127.0.0.1:7000). The server hands the request to the agent over that connection. The agent sends it to the local endpoint you opened with--hostand the port. If the agent is on another machine, encrypt that connection with TLS.The endpoint tells the local application who the client is, as follows.
X-Forwarded-Forends with the address that connected. The visitor's ownX-Forwarded-For,Forwarded, andX-Real-IPheaders are not forwarded to the application: nobody has vouched for them, so the application sees only the address that connected. If a reverse proxy sits in front, name it withaditd --trusted-proxy; on a connection from that proxy the chain is kept and the connecting address is appended.X-Forwarded-Protoishttporhttps.X-Forwarded-Hostis the name that was requested. A header rule can remove these names.The path and the query go to the local endpoint as the client sent them. A semicolon in the query, and a broken percent escape, are not dropped.
-
The response returns the same way
The local application's response goes from the agent to the server, and from there to the client. The inspector records the pair.
Where the name comes from
If the command has no --name, the server picks a temporary name. Example: amber-gate-k4w7zq. The last six characters are chosen at random each time; a tunnel cannot be reached by guessing the address. This name is not written to adit-data.json. When the process exits, the name goes with it and that tunnel's inspector record is deleted.
--name demo fixes the address. A name is at least 3 and at most 40 characters. Only lowercase letters, digits, and hyphens are used. A hyphen cannot be first or last. These names cannot be used: www, api, panel, mail, ftp, app, assets, kilavuz, guide, tor, healthz, adit, and tunl.
While the agent is offline
A reserved name stays on disk. If the agent is not connected, the request returns 503: the name is reserved, the agent is not connected. There is no separate endpoint that holds the request.
How TCP differs
A raw port has no Host header. The server picks a port from 19000–19040 on 127.0.0.1. The client connects to that tcp:// address. The detail is on the raw port page.
Not in this version
- There is no reception point spread across the world.
- There is no cloud endpoint that holds a request while the agent is offline.
- There is no account, no team, and no card charge.