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 52 mod connector; 53 mod dns; 54 mod dns_manager; 55 mod error; 56 mod manager; 57 mod pattern_vec; 58 mod rewriter; 59 mod util; 60 61 pub use connector::*; 62 pub use dns_manager::*; 63 pub use error::Error; 64 pub use manager::*; 65