Expand description
The one way out for the server’s Chromium: a SOCKS5 proxy on the loopback address that connects only where
address_policy allows. Chromium is told to use it for every connection (page loads, scripts, WebSocket, and
the browser’s own requests), to ask it for name resolution too, and to refuse a local lookup, so a page cannot
reach the cloud metadata address, a private range, or this server’s own ports, by an address or by a name.
The proxy resolves the name itself, judges every address the name resolved to (one refused address refuses the name), and connects to an address it judged: it never resolves a second time, so a name that answers with a public address first and a private one later gets nothing from the second answer.
Structs§
Enums§
- Target
- What a client asked to connect to.
Constants§
- BAD_
ADDRESS_ 🔒TYPE - BAD_
COMMAND 🔒 - CONNECT 🔒
- HANDSHAKE 🔒
- How long a client has to say what it wants, and how long a connection may take to open.
- HOST_
UNREACHABLE 🔒 - MAX_
OPEN 🔒 - The most connections open at once: a page that opens thousands is held to this.
- NOT_
ALLOWED 🔒 - OK 🔒
- SOCKS5 reply codes (RFC 1928 section 6).
- PORT_
ENV - The setting that fixes the proxy’s loopback port (a container whose browser policy names the port); unset, the system chooses.
- REFUSED 🔒
Statics§
Traits§
- Resolve
- Turns a name into addresses. The system’s resolver in use; a scripted one in the tests.
Functions§
- accept_
loop 🔒 - Accept clients on
listeneruntil the process ends. - connect_
first 🔒 - Connect to the first of
addrsthat answers, each within the connect limit. The reply for the last failure. - own_
ports_ 🔒with_ proxy - This server’s own ports, this proxy’s, and the development-server router’s.
- plan
- The addresses a connection to
targetonportmay go to, in the order to try them, or the SOCKS5 reply that refuses it. Every address the name resolved to has to pass the policy, and only those are tried (a name that answers::1and127.0.0.1reaches a development server on either). - read_
request 🔒 - The client’s request: the address it wants and the port.
- reply 🔒
- serve_
one 🔒 - One client: greeting, request, a checked connection, then bytes both ways.
- start
- Start the proxy on a loopback port (the one in
PORT_ENV, else the system’s choosing), once; the port is the same for every later call.