Skip to main content

Crate iroh_proxy_utils

Crate iroh_proxy_utils 

Source
Expand description

HTTP proxy utilities for iroh connections.

This crate provides building blocks for HTTP proxies that bridge TCP traffic over iroh’s peer-to-peer QUIC connections. It supports both forward and reverse proxy modes, with pluggable request routing and authorization.

§Architecture

The proxy operates in two layers:

  • Downstream proxy (downstream::DownstreamProxy): Accepts TCP connections from clients and forwards them over iroh to an upstream proxy.
  • Upstream proxy (upstream::UpstreamProxy): Receives proxied streams from iroh and forwards them to origin TCP servers.

§Protocol

Communication between downstream and upstream uses HTTP/1.1 over QUIC bidirectional streams. The protocol supports:

  • CONNECT tunneling (RFC 9110 §9.3.6): For opaque TCP tunnels
  • Absolute-form requests (RFC 9110 §7.1): For HTTP forward proxying

§Example

See the examples/ directory for complete usage examples.

Modules§

downstream
Downstream proxying from TCP clients to iroh endpoints.
upstream
Upstream proxying from iroh streams to TCP origins.

Structs§

Authority
Host and port extracted from HTTP request targets (RFC 9110 §7.2).
HttpProxyRequest
HTTP request suitable for proxy routing decisions.
HttpRequest
Parsed HTTP request with method, URI, headers, and version.
HttpResponse
Parsed HTTP response with status line and headers.

Enums§

HttpProxyRequestKind
Proxy-specific request target classification (RFC 9110 §7.1).
HttpRequestKind
Classification of HTTP request target forms (RFC 9110 §7.1).

Constants§

ALPN
ALPN protocol identifier for iroh HTTP proxy connections.
IROH_DESTINATION_HEADER
HTTP header for routing requests to specific iroh endpoints.