Skip to main content

Module proxied

Module proxied 

Source
Expand description

Connect to relays via a proxy.

This code is here for two reasons:

  1. To connect via external pluggable transports (for which we use SOCKS to build our connections).
  2. To support users who are behind a firewall that requires them to use a SOCKS proxy to connect.

Supports SOCKS4/4a/5 and HTTP CONNECT proxies.

Re-exportsยง

use std::net::IpAddr; ๐Ÿ”’
use std::net::SocketAddr; ๐Ÿ”’
use std::sync::Arc; ๐Ÿ”’
use base64ct::Base64; ๐Ÿ”’
use base64ct::Encoding; ๐Ÿ”’
use futures::io::AsyncBufReadExt; ๐Ÿ”’
use futures::io::BufReader; ๐Ÿ”’
use futures::AsyncReadExt; ๐Ÿ”’
use futures::AsyncWriteExt; ๐Ÿ”’
use httparse; ๐Ÿ”’
use safelog::Sensitive; ๐Ÿ”’
use tor_linkspec::PtTargetAddr; ๐Ÿ”’
use tor_rtcompat::NetStreamProvider; ๐Ÿ”’
use tor_socksproto::Handshake as _; ๐Ÿ”’
use tor_socksproto::SocksAddr; ๐Ÿ”’
use tor_socksproto::SocksAuth; ๐Ÿ”’
use tor_socksproto::SocksClientHandshake; ๐Ÿ”’
use tor_socksproto::SocksCmd; ๐Ÿ”’
use tor_socksproto::SocksRequest; ๐Ÿ”’
use tor_socksproto::SocksStatus; ๐Ÿ”’
use tor_socksproto::SocksVersion; ๐Ÿ”’
use tracing::trace; ๐Ÿ”’
use super::TransportImplHelper; ๐Ÿ”’
use async_trait::async_trait; ๐Ÿ”’
use safelog::sensitive as sv; ๐Ÿ”’
use tor_error::bad_api_usage; ๐Ÿ”’
use tor_linkspec::ChannelMethod; ๐Ÿ”’
use tor_linkspec::HasChanMethod; ๐Ÿ”’
use tor_linkspec::OwnedChanTarget; ๐Ÿ”’
use tor_proto::peer::PeerAddr; ๐Ÿ”’

Structsยง

ExternalProxyPlugin
An object that connects to a Tor bridge via an external pluggable transport that provides a proxy.

Enumsยง

Protocol
Information about what proxy protocol to use, and how to use it.
ProxyError
An error that occurs while negotiating a connection with a proxy.

Constantsยง

MAX_HTTP_HEADER_BYTES ๐Ÿ”’
Maximum number of bytes allowed in HTTP response headers from proxy.
NO_ADDR ๐Ÿ”’
An address to use when told to connect to โ€œno address.โ€

Functionsยง

build_http_connect_request ๐Ÿ”’
Build HTTP CONNECT request string with optional Basic auth.
connect_via_proxy ๐Ÿ”’
Open a connection to target via the proxy at proxy, using the protocol at protocol.
do_http_connect_handshake ๐Ÿ”’
Perform HTTP CONNECT proxy handshake (RFC 7231, RFC 7617 for Basic auth).
do_socks_handshake ๐Ÿ”’
Perform SOCKS proxy handshake.
encode_settings ๐Ÿ”’
Encode the PT settings from IT in a format that a pluggable transport can use.
format_connect_target ๐Ÿ”’
Format target address for HTTP CONNECT request line and Host header.
parse_http_connect_response ๐Ÿ”’
Parse HTTP CONNECT response and extract status code.
send_http_connect_request ๐Ÿ”’
Send HTTP CONNECT request to proxy.
settings_to_protocol
Transform a string into a representation that can be sent as SOCKS authentication.