(conf: &Socks5Server, ms_timeout: Option<u64>)
| 324 | } |
| 325 | |
| 326 | pub fn from_conf(conf: &Socks5Server, ms_timeout: Option<u64>) -> Result<Self, ProxyError> { |
| 327 | let mut proxy; |
| 328 | match ms_timeout { |
| 329 | None => { |
| 330 | proxy = Self::new(&conf.proxy, DEFINE_TIME_OUT)?; |
| 331 | } |
| 332 | Some(time_out) => { |
| 333 | proxy = Self::new(&conf.proxy, time_out)?; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | if !conf.password.is_empty() && !conf.username.is_empty() { |
| 338 | proxy = proxy.basic_auth(&conf.username, &conf.password); |
| 339 | } |
| 340 | Ok(proxy) |
| 341 | } |
| 342 | |
| 343 | pub async fn proxy_addrs(&self) -> Result<SocketAddr, ProxyError> { |
| 344 | self.intercept.socket_addrs().await |
nothing calls this directly
no test coverage detected