#[derive(Debug)]
pub struct Proxy {
proxy_type: ProxyType,
host: String,
port: u16,
user: Option<String>,
password: Option<String>,
}
impl Proxy {
pub fn new(
proxy_type: ProxyType,
host: String,
port: u16,
user: Option<String>,
password: Option<String>,
) -> Self {
Proxy {
proxy_type,
host,
port,
user,
password,
}
}
pub fn get_proxy_type(&self) -> &ProxyType {
&self.proxy_type
}
pub fn get_host(&self) -> &str {
&self.host
}
pub fn get_port(&self) -> u16 {
self.port
}
pub fn get_user(&self) -> Option<&String> {
self.user.as_ref()
}
pub fn get_password(&self) -> Option<&String> {
self.password.as_ref()
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ProxyType {
Http,
Socks4,
Socks5,
}