proxychains_masq/proxy/
mod.rs1pub mod http;
2pub mod https;
3pub mod raw;
4pub mod socks4;
5pub mod socks5;
6
7use std::{fmt, net::IpAddr};
8
9use tokio::io::{AsyncRead, AsyncWrite};
10
11pub trait AsyncStream: AsyncRead + AsyncWrite + Send + Unpin {}
17impl<T: AsyncRead + AsyncWrite + Send + Unpin> AsyncStream for T {}
18
19pub type BoxStream = Box<dyn AsyncStream>;
21
22#[derive(Debug, Clone)]
24pub enum Target {
25 Ip(IpAddr, u16),
26 Host(String, u16),
27}
28
29impl Target {
30 pub fn port(&self) -> u16 {
32 match self {
33 Target::Ip(_, p) | Target::Host(_, p) => *p,
34 }
35 }
36}
37
38impl fmt::Display for Target {
39 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
40 match self {
41 Target::Ip(ip, port) => write!(f, "{ip}:{port}"),
42 Target::Host(host, port) => write!(f, "{host}:{port}"),
43 }
44 }
45}