Improve debug logging (#781)
This commit is contained in:
		
							
								
								
									
										34
									
								
								src/proxy.rs
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								src/proxy.rs
									
									
									
									
									
								
							| @@ -55,7 +55,7 @@ pub struct Proxy { | ||||
| /// A particular scheme used for proxying requests. | ||||
| /// | ||||
| /// For example, HTTP vs SOCKS5 | ||||
| #[derive(Clone, Debug)] | ||||
| #[derive(Clone)] | ||||
| pub enum ProxyScheme { | ||||
|     Http { | ||||
|         auth: Option<HeaderValue>, | ||||
| @@ -434,6 +434,38 @@ impl ProxyScheme { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl fmt::Debug for ProxyScheme { | ||||
|     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||||
|         match self { | ||||
|             ProxyScheme::Http { | ||||
|                 auth: _auth, | ||||
|                 host, | ||||
|             } => { | ||||
|                 write!(f, "http://{}", host) | ||||
|             }, | ||||
|             ProxyScheme::Https { | ||||
|                 auth: _auth, | ||||
|                 host, | ||||
|             } => { | ||||
|                 write!(f, "https://{}", host) | ||||
|             }, | ||||
|             #[cfg(feature = "socks")] | ||||
|             ProxyScheme::Socks5 { | ||||
|                 addr, | ||||
|                 auth: _auth, | ||||
|                 remote_dns, | ||||
|             } => { | ||||
|                 let h = if *remote_dns { | ||||
|                     "h" | ||||
|                 } else { | ||||
|                     "" | ||||
|                 }; | ||||
|                 write!(f, "socks5{}://{}", h, addr) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| type SystemProxyMap = HashMap<String, ProxyScheme>; | ||||
|  | ||||
| #[derive(Clone, Debug)] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user