Expand description
The in-VM client: one MicroVM’s control API, with the proxy auth handled for you.
Talks to agentd through the endpoint proxy — the minted proxy token read from the
auth-token header map and both proxy headers on every request (TRAP-7), minting
inside the retry path below the sixty-minute ceiling (TRAP-9), and the byte-offset
cursor that makes an interrupted output stream resumable.
§A session holds no state worth keeping
Every exec record, every file, and the bootstrap token live in the VM. So a
Session rebuilt from an endpoint and an agent token reattaches to everything a
previous process was doing, and ExecHandle rebuilt from an exec id addresses the
same server-side exec. That is a property of the protocol rather than of this type,
and it is why the exec id is caller-minted.
§The wire types are the daemon’s
Every request body and response shape comes from the protocol crate, which the
daemon also compiles against (ARCH-2). There is deliberately no mirror here: a field
renamed on the daemon side breaks this build, which is the earliest and cheapest
place a protocol change can fail.
§Layout
proxy is the two-header auth and the mint schedule. http is the transport
seam. sse is the frame parser and the typed events. exec is the handle and
the cursor-driven stream. files is file and tar transfer. forward is the
port-forwarder’s listener and its 403-vs-502 diagnostic. tunnel is the WebSocket
client that carries raw TCP to the daemon’s relay.
Re-exports§
pub use exec::EndReason;pub use exec::ExecHandle;pub use exec::ExecResult;pub use exec::StreamEnd;pub use exec::StreamOptions;pub use exec::mint_exec_id;pub use forward::DEFAULT_EXCHANGE_TIMEOUT;pub use forward::ForwardClient;pub use forward::ForwardEvent;pub use forward::ForwardSpec;pub use forward::forwards_request_header;pub use forward::refusal_explanation;pub use forward::upstream_url;pub use http::ChunkSource;pub use http::HttpBackend;pub use http::HttpRequest;pub use http::HttpResponse;pub use http::OpenStream;pub use http::ReqwestBackend;pub use proxy::Clock;pub use proxy::DEFAULT_AGENT_PORT;pub use proxy::DEFAULT_REFRESH_AFTER;pub use proxy::MAX_TOKEN_LIFETIME;pub use proxy::PROXY_AUTH_HEADER;pub use proxy::PROXY_PORT_HEADER;pub use proxy::ProxyAuth;pub use proxy::ProxyToken;pub use proxy::TokenMinter;pub use proxy::TokioClock;pub use proxy::WS_AUTH_SUBPROTOCOL_PREFIX;pub use proxy::WS_PORT_SUBPROTOCOL_PREFIX;pub use proxy::WS_SUBPROTOCOL;pub use sse::ExecEvent;pub use sse::Frame;pub use sse::SseParser;pub use tunnel::TUNNEL_CHUNK_BYTES;pub use tunnel::TunnelEnd;pub use tunnel::explain_close;pub use tunnel::relay_connection;pub use tunnel::tunnel_url;
Modules§
- exec
- The handle a caller holds for one running exec.
- files
- File and tar transfer. Four routes, opaque bodies, one query type.
- forward
- A local TCP listener that forwards HTTP and WebSocket traffic to one guest port.
- http
- The HTTP seam: one request/response shape, two backends.
- proxy
- The endpoint proxy’s authentication: two headers, and a token minted inside the request path.
- shell
- The client half of
microvm shell: a real PTY carried over the endpoint’s shell WebSocket. Issue #69, Option B — a thin client over the platform’s session, not a line-mode wrapper over exec. - sse
- Incremental Server-Sent Events parsing, and the typed events the daemon emits.
- tunnel
- The client half of the TCP relay: a local TCP connection carried over a WebSocket.
Structs§
- Session
- The control API of one running MicroVM.
- Session
Builder - Builds a
Session. SeeSession::builder. - Transport
- The transport: a backend, the agent token, and the proxy auth every request needs.
Constants§
- DEFAULT_
READY_ TIMEOUT - How long to wait for a daemon to report bootstrapped.
- DEFAULT_
REQUEST_ TIMEOUT - How long one non-streaming request may take.