Documentation
¶
Overview ¶
Package hostwire holds the pieces of the orchestrator-to-host-agent wire that both the firecracker and qemu providers speak. Today that is the raw HTTP/1.1 upgrade used to open an attach stream to a guest; the JSON request path still lives in each provider.
Index ¶
Constants ¶
const AttachProto = "fuse-attach/1"
AttachProto is the value of the Upgrade header that opens an attach stream. It is spoken on both hops — client to orchestrator, and orchestrator to host agent — so the orchestrator can relay bytes without reframing them.
Variables ¶
This section is empty.
Functions ¶
func AttachQuery ¶
func AttachQuery(spec orchestrator.AttachSpec) url.Values
AttachQuery encodes an AttachSpec as the query string of an attach request. The spec rides in the URL rather than a body because the upgrade is a GET: there is no body to put it in, and inventing a pre-upgrade handshake frame would buy nothing.
func Dial ¶
Dial opens a raw duplex connection to a host-agent endpoint by performing an HTTP/1.1 Upgrade by hand, and returns the socket once the host agent has answered 101.
It deliberately bypasses http.Client. Two reasons, both structural:
- net/http gives a client no way to reclaim the underlying connection after a response; only servers get Hijack. An upgrade is exactly the case where the caller needs the socket back.
- An http.Client speaking TLS may negotiate HTTP/2, and HTTP/2 has no connection upgrade at all. Writing the request onto a raw conn pins us to HTTP/1.1, where the upgrade is well defined.
The returned conn is positioned immediately after the 101 response, so the first byte read from it is the first byte of the stream proper.
func ParseAttachQuery ¶
func ParseAttachQuery(q url.Values) orchestrator.AttachSpec
ParseAttachQuery is the inverse of AttachQuery, used by the orchestrator to read a client's attach request before relaying it onward.
Types ¶
This section is empty.