Skip to content

vox-cli-share API Reference (generated)

Crate: vox-cli-share · Version: 0.6.0 · Target: Library (lib.rs)

Public-URL tunneling for vox share (LAN / Cloudflare / localhost.run / Tailscale), extracted from vox-cli.

vox share — public-URL tunneling for Vox apps.

Three backends:

  • [backends::lan] — bind to 0.0.0.0, no internet exposure (LAN-only)
  • [backends::cloudflare] — Cloudflare Quick Tunnel via *.trycloudflare.com (default for vox share; added in S2)
  • [backends::localhost_run] — SSH-based public URL via *.lhr.life (fallback; added in S3)
  • [backends::tailscale] — Tailscale Funnel via *.ts.net (explicit; added in S4)
DependencyKind
vox-http-clientNormal
ModuleDescription
auth—
backend—
backends—
binary_cache—
consent—
coordinator—
error—
lifecycle—
proxy—
sse_detect—
state—
Dependency Topology, diagram 13 nodes, 2 edges: vox-cli-share → vox-http-client; vox-cli → vox-cli-sharevox-cli-sharevox-http-clientvox-cli
Diagram source
graph {
direction: right
node vox_cli_share: "vox-cli-share"
node vox_http_client: "vox-http-client"
vox_cli_share -> vox_http_client
node vox_cli: "vox-cli"
vox_cli -> vox_cli_share
}
Consumer CrateRole
vox-cliDirect workspace dependent
KindSymbolSignatureSourceDescription
enumauth::AuthModepub enum AuthModecrates/vox-cli-share/src/auth.rs#L19-L26Auth mode for a share session.
fnauth::random_tokenpub fn random_token() -> Selfcrates/vox-cli-share/src/auth.rs#L30-L33Generate a random 16-hex-char URL token.
fnauth::decorate_urlpub fn decorate_url(&self, base_url: &str) -> Stringcrates/vox-cli-share/src/auth.rs#L36-L47Append auth to a base URL for user display.
fnauth::auth_middlewarepub async fn auth_middleware(crates/vox-cli-share/src/auth.rs#L75Axum middleware function that enforces the auth mode.
enumbackend::BackendKindpub enum BackendKindcrates/vox-cli-share/src/backend.rs#L10-L20Which backend to use for the share session.
structbackend::TunnelHandlepub struct TunnelHandlecrates/vox-cli-share/src/backend.rs#L48-L57A handle to an active tunnel session. Drop = shutdown.
enumbackend::UrlStabilitypub enum UrlStabilitycrates/vox-cli-share/src/backend.rs#L60-L65—
fnbackend::newpub fn new(crates/vox-cli-share/src/backend.rs#L68—
fnbackend::shutdownpub fn shutdown(self)crates/vox-cli-share/src/backend.rs#L83-L85Trigger graceful shutdown. Idempotent.
traitbackend::TunnelBackendpub trait TunnelBackend: Send + Synccrates/vox-cli-share/src/backend.rs#L90-L100A backend creates and manages a tunnel from 127.0.0.1:<port> to a public URL.
fnbinary_cache::cloudflared_url_and_checksumpub fn cloudflared_url_and_checksum() -> Option<(String, &'static str)>crates/vox-cli-share/src/binary_cache.rs#L19-L50Returns (download_url, expected_sha256_lowercase_hex) for the current platform, or None if the platform is unsupported.
fnbinary_cache::ensure_cloudflaredpub async fn ensure_cloudflared() -> ShareResult<PathBuf>crates/vox-cli-share/src/binary_cache.rs#L55-L95Returns the path to the cached cloudflared binary, downloading and verifying if needed. Respects VOX_CLOUDFLARED_PATH env var override (for testing and power users).
fnbinary_cache::cloudflared_cache_dirpub fn cloudflared_cache_dir() -> ShareResult<PathBuf>crates/vox-cli-share/src/binary_cache.rs#L98-L104Directory where the cached binary lives.
fnbinary_cache::cached_binary_namepub fn cached_binary_name() -> Stringcrates/vox-cli-share/src/binary_cache.rs#L107-L112Filename used for the cached binary (includes version + platform).
fnbinary_cache::verify_sha256pub fn verify_sha256(path: &Path, expected: &str) -> ShareResult<bool>crates/vox-cli-share/src/binary_cache.rs#L115-L120Verify the SHA256 of path matches expected (hex, case-insensitive).
fnconsent::ensure_consentpub fn ensure_consent(accept_tos: bool, force_prompt: bool) -> ShareResult<()>crates/vox-cli-share/src/consent.rs#L29-L72Ensure the user has accepted the consent. No-op if already accepted in a prior run. accept_tos: if true, accept without prompting (—accept-tos CLI flag). force_prompt: if true, re-prompt even if already accepted (for testing).
structcoordinator::ShareConfigpub struct ShareConfigcrates/vox-cli-share/src/coordinator.rs#L18-L36Configuration for a share session.
structcoordinator::ShareSessionpub struct ShareSessioncrates/vox-cli-share/src/coordinator.rs#L39-L48An active share session. Drop or call shutdown to clean up.
fncoordinator::startpub async fn start(cfg: ShareConfig) -> ShareResult<Self>crates/vox-cli-share/src/coordinator.rs#L51-L161—
fncoordinator::shutdownpub async fn shutdown(self)crates/vox-cli-share/src/coordinator.rs#L163-L172—
fncoordinator::waitpub async fn wait(self)crates/vox-cli-share/src/coordinator.rs#L176-L215Wait for the session to end: either Ctrl+C or duration elapsed. Handles shutdown cleanup automatically.
typeerror::ShareResultpub type ShareResult<T> = Result<T, ShareError>crates/vox-cli-share/src/error.rs#L5—
enumerror::ShareErrorpub enum ShareErrorcrates/vox-cli-share/src/error.rs#L8-L26—
fnlifecycle::run_countdownpub async fn run_countdown(duration: Duration, done_tx: mpsc::Sender<()>)crates/vox-cli-share/src/lifecycle.rs#L11-L18Runs the countdown lifecycle task. Sends a unit on done_tx when duration elapses. Prints countdown to stdout.
fnlifecycle::run_countdown_printerpub async fn run_countdown_printer(duration: Duration)crates/vox-cli-share/src/lifecycle.rs#L22-L46Runs the countdown printing loop independently of the shutdown signal. Prints time remaining to stdout on the schedule described in the module docs.
fnlifecycle::format_durationpub fn format_duration(d: Duration) -> Stringcrates/vox-cli-share/src/lifecycle.rs#L49-L63Format a duration for user display: “2h 30m”, “45m”, ”30s”.
structproxy::ProxyConfigpub struct ProxyConfigcrates/vox-cli-share/src/proxy.rs#L20-L27Configuration for the reverse-proxy server.
fnproxy::build_apppub fn build_app(cfg: ProxyConfig) -> Routercrates/vox-cli-share/src/proxy.rs#L40-L53Build the Axum [Router] for the reverse-proxy. All requests are forwarded to cfg.upstream_addr with the same method, headers, and body. The upstream response is returned verbatim. Auth middleware (if configured) is applied before forwarding.
fnsse_detect::has_sse_routespub async fn has_sse_routes(upstream_port: u16) -> boolcrates/vox-cli-share/src/sse_detect.rs#L11-L31Returns true if the app at localhost:<port> has any SSE routes. Fetches /openapi.json with a short timeout. Returns false on any error (app might not be running yet, or might not have an OpenAPI endpoint).
fnsse_detect::detect_sse_in_openapipub fn detect_sse_in_openapi(spec: &serde_json::Value) -> boolcrates/vox-cli-share/src/sse_detect.rs#L34-L49Returns true if any route in the OpenAPI spec has a text/event-stream response.
structstate::ShareStatepub struct ShareStatecrates/vox-cli-share/src/state.rs#L13-L19—
fnstate::loadpub fn load() -> ShareResult<Self>crates/vox-cli-share/src/state.rs#L22-L30—
fnstate::savepub fn save(&self) -> ShareResult<()>crates/vox-cli-share/src/state.rs#L32-L41—