Expand description
§errand
Async small-web (“smolweb”) transport in one scheme-routed call. errand
fetches a URL over a small-web protocol and hands back the raw bytes, a
normalized Status, and a MIME hint. It speaks gemini (TLS, TOFU),
gopher, finger, spartan, nex, guppy, and titan,
routed by scheme.
Alongside the read schemes sit two write companions: titan_upload
(gemini’s upload sibling) and misfin_send (gemini-style mail delivery,
with a caller-supplied client certificate). These are not fetchable schemes,
so they are direct calls, not part of fetch.
It does not speak HTTP, on purpose. HTTP is already well served (reqwest), and
a browser-extension host gets HTTP from the browser. errand fills the gap
those leave: the protocols of the small web, with no large dependency cone.
let page = errand::fetch("gemini://geminiprotocol.net/").await?;
if page.status == errand::Status::Success {
println!("{} bytes of {}", page.body.len(), page.mime().unwrap_or("?"));
}Modules§
- parse
- Smolweb document parsers: model-free, host-agnostic per-format parsers that turn
a protocol’s bytes into a small AST. Separate from the transport above; a consumer
composes them (fetch, then parse) or parses a local file with no fetch at all. The
dep-free parsers (gemtext, gopher, nex, …) are always available; only the feed
(RSS/Atom) parser, which needs an XML reader, sits behind the
parse-feedfeature. Seeparsefor the per-format submodules. Smolweb document parsers — the format structure of the protocols errand’s transport speaks, as a model-free, host-agnostic layer.
Structs§
- Client
Identity - A client identity for a misfin send: the certificate chain + private key, in DER, supplied by the caller. The leaf comes first; further chain certificates (the spec’s mailbox-signed-by-host setup) follow. The key must be PKCS#8 (the format Mere’s vault-derived identities produce).
- InMemory
Tofu - A process-lifetime, in-memory
TofuStore. Pins last as long as the store; the right choice for a session, a test, or any host that does not need pins to survive a restart. - Permissive
Tofu - The accept-any store: never reports a pin, never records one. With it
installed (the default when none is set), every TLS handshake is treated
as a first contact and accepted — the permissive TOFU
errandused before pinning existed. - Response
- One smolweb response: a normalized
Status, the protocolmetaline (a MIME type, prompt, redirect target, or reason depending on the status), and the raw body bytes. - Url
- A parsed URL record.
Enums§
- Error
- A transport error.
- Scheme
- A small-web scheme
errandcan route. - Status
- A normalized cross-protocol response status. The protocol’s own numeric code,
where it has one (gemini, spartan, guppy, titan), is preserved in
Response::raw_status.
Constants§
- MISFIN_
PORT - Misfin’s well-known port.
Traits§
- Tofu
Store - A store of pinned leaf-certificate fingerprints, keyed by host.
Functions§
- fetch
- Fetch
urlover its smolweb scheme. Convenience wrapper overfetch_urlthat parses the string first. - fetch_
timeout - Fetch
urlwith a per-request timeout. ReturnsError::Timeoutif the fetch does not complete withintimeout. - fetch_
url - Fetch an already-parsed
url, routing by scheme. The body is read in full (smolweb servers close the connection when the response ends). - fetch_
url_ timeout - Fetch an already-parsed
urlwith a per-request timeout. ReturnsError::Timeoutif the fetch does not complete withintimeout. - misfin_
send - Send
messageto a misfinrecipient(misfin://mailbox@host[:port]), presentingidentityas the client certificate. Returns the recipient host’s gemini-formatResponse(2x delivered, 3x redirect, 4x/5x failure, 6x certificate). errand does not follow misfin redirects; the caller decides. - set_
trust_ store - Install the process-wide
TofuStoreerrand’s TLS schemes pin against. - titan_
upload - Upload
bodytourlwith the givenmimetype and optionaltoken. Returns the server’s Gemini-format response.