Expand description
Implement an HTTP1 CONNECT proxy using hyper.
Note that Tor defines several extensions to HTTP CONNECT; See the spec for more information.
Re-exportsΒ§
use super::ListenerIsolation;πuse super::ProxyContext;πuse anyhow::Context as _;πuse anyhow::anyhow;πuse arti_client::StreamPrefs;πuse arti_client::TorAddr;πuse extend::ext;πuse futures::AsyncRead;πuse futures::AsyncWrite;πuse futures::io::BufReader;πuse http::Method;πuse http::StatusCode;πuse http::response::Builder as ResponseBuilder;πuse hyper::Response;πuse hyper::server::conn::http1::Builder as ServerBuilder;πuse hyper::service::service_fn;πuse safelog::Sensitive as Sv;πuse safelog::sensitive as sv;πuse std::sync::Arc;πuse tor_error::ErrorKind;πuse tor_error::ErrorReport as _;πuse tor_error::HasKind;πuse tor_error::into_internal;πuse tor_error::warn_report;πuse tor_rtcompat::Runtime;πuse tor_rtcompat::SpawnExt as _;πuse tracing::instrument;πuse tracing::instrument;πuse tracing::warn;πuse hyper_futures_io::FuturesIoCompat;πuse crate::rpc::conntarget::ConnTarget;πuse tor_rpcbase as rpc;π
ModulesΒ§
- hdr π
- Constants and code for the HTTP headers we use.
- hyper_
futures_ πio - Helper module: Make
futurestypes usable byhyper.
StructsΒ§
- Isolation π
- A value used to isolate streams received via HTTP CONNECT.
EnumsΒ§
- Http
Connect πError - An error that occurs during an HTTP CONNECT attempt, which can (usually) be reported to the client.
- Proxy
Authorization π - An isolation value based on the Proxy-Authorization header.
TraitsΒ§
- Response
Builder πExt - Extension trait on ResponseBuilder
FunctionsΒ§
- add_
common_ πheaders - Add all common headers to the builder
bld, and return a new builder. - capabilities π
- Return a string representing our capabilities.
- deconstruct_
upgrade π - Recover the original stream from a
hyper::upgrade::Upgraded. - end_
reason_ πto_ http_ status - Return the appropriate HTTP status code for a remote END reason.
- find_
conn_ πtarget - Look up the connection target given the value of an Tor-RPC-Target header.
- handle_
connect_ πrequest - Return an appropriate reply to the given CONNECT request.
- handle_
connect_ πrequest_ impl - Helper for handle_connect_request: return an error type that can be converted into an HTTP message.
- handle_
http_ πconn - Given a just-received TCP connection
Son a HTTP proxy port, handle the HTTP handshake and relay the connection over the Tor network. - handle_
http_ πrequest - Handle a single HTTP request.
- handle_
options_ πrequest - Return an appropriate reply to the given OPTIONS request.
- host_
is_ πlocalhost - Return true if
hostis a possible value for a Host header addressing localhost. - set_
family_ πpreference - Set the IP family preference in
prefs. - set_
isolation π - Configure the stream isolation from the provided headers.
- transfer π
- Recover the application stream from
request, and launch tasks to transfer data between the application and thetor_stream.
Type AliasesΒ§
- Body π
- We use βStringβ as our body type, since we only return a body on error, in which case it already starts life as a formatted string.
- Client
Error π - Error type returned from a failed connect_with_prefs.
- Request π
- Request type that we receive from Hyper.