• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! # HTTP Proxy
16 //!
17 //! This crate provides a TCP proxy client that can be used to
18 //! establish connections to a target address through an HTTP proxy
19 //! server.
20 //!
21 //! The main component of this crate is the `Connector` struct, which
22 //! handles the CONNECT request handshake with the proxy, including
23 //! optional Basic authentication.
24 //!
25 //! The crate also includes a `Manager` struct that implements the
26 //! `ProxyManager` trait from `libslirp_rs`, allowing it to be used
27 //! with the `libslirp` library for managing TCP connections through
28 //! the proxy.
29 //!
30 //! ## Example
31 //!
32 //! ```
33 //! use std::net::SocketAddr;
34 //!
35 //! #[tokio::main]
36 //! async fn main() {
37 //!     let proxy_addr: SocketAddr = "127.0.0.1:8080".parse().unwrap();
38 //!
39 //!     let connector = http_proxy::Connector::new(proxy_addr, None, None);
40 //! }
41 //! ```
42 //!
43 //! ## Features
44 //!
45 //! * **libslirp:** Enables integration with the `libslirp` library.
46 //!
47 //! ## Limitations
48 //!
49 //! * Currently only supports HTTP proxies.
50 //! * Usernames and passwords cannot contain `@` or `:`.
51 #![allow(dead_code)] //TODO: Remove once implementation is complete
52 
53 mod connector;
54 mod dns;
55 mod dns_manager;
56 mod error;
57 mod manager;
58 mod pattern_vec;
59 mod rewriter;
60 mod util;
61 
62 pub use connector::*;
63 pub use dns_manager::*;
64 pub use error::Error;
65 pub use manager::*;
66