Skip to main content

Module relay_client

Module relay_client 

Source
Expand description

HTTP client for wire-relay-server.

Sync wrapper around reqwest::blocking so CLI commands stay synchronous — the only async surface in the crate is relay_server::serve. Async clients land in v0.2 if a long-running daemon needs them.

Structs§

AllocateResponse
PostEventResponse
RelayClient
WireOrgTxtRecord

Enums§

WireOrgTxtDid
RFC-003 §2 DNS-TXT binding anchor. _wire-org.<domain> records use the same field grammar for org-tier (did:wire:org:*) and personal-tier (did:wire:op:*) deployments; receivers dispatch on the DID prefix.
WireOrgTxtParseError

Constants§

INSECURE_SKIP_TLS_ENV
Env var: when set to a truthy value (1, true, yes), every TLS verification check on every wire HTTPS client is disabled. Intended as an emergency-only operator override for environments behind a TLS-intercepting middlebox (corporate proxy, AV product like Avast re-signing certs with its own root, captive portal). Prints a loud stderr banner on every send when active. Do not set this in production. Documented in THREAT_MODEL.md + README.

Functions§

build_blocking_client
Centralized builder for blocking HTTPS clients across wire. Uses rustls + Mozilla webpki-roots bundled CA set (rustls-tls-webpki-roots reqwest feature). Honors the INSECURE_SKIP_TLS_ENV escape hatch for the corporate-proxy emergency case.
format_transport_error
Flatten an anyhow::Error source chain into a single human-readable transport-error line for the reason field in wire push --json and for stderr surfaces. Classifies the topmost cause (TLS error, DNS error, connect timeout, read timeout, HTTP error) so a silent failure no longer leaks past the user as a bare URL.
parse_wire_org_txt_record
Parse the field grammar used by RFC-003 §2:
post_event_to_endpoint
v0.7.0-alpha.19: scheme-aware POST helper that dispatches to either reqwest (for http(s)://...) OR the hand-rolled uds_request (for unix:///path/to/sock). Lets the daemon + cmd_send walk a peer’s pinned endpoints uniformly without each call site having to detect scheme + branch.
try_post_event_with_failover
Try posting event to each endpoint in priority order; return the first success. Generic over the poster so tests can inject a deterministic mock without spinning up an HTTP server. In production callers pass post_event_to_endpoint.
uds_request
v0.7.0-alpha.17: minimal blocking HTTP/1.1 client over Unix Domain Socket. Used by callers that detect a unix:// scheme on a relay endpoint URL and route around reqwest (which has no UDS support).