Expand description
Connect to relays via a proxy.
This code is here for two reasons:
- To connect via external pluggable transports (for which we use SOCKS to build our connections).
- 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.
Structsยง
- External
Proxy Plugin - 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.
- Proxy
Error - 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
targetvia the proxy atproxy, using the protocol atprotocol. - 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
ITin 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.