diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-10-21 13:14:26 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-10-23 14:59:46 +0200 |
| commit | a9d5994b0fb425c5a3eabc0591e341be308bdfb7 (patch) | |
| tree | 52811e4748c04469769b7b5c0634f9fef798f40e /mullvad-api/src | |
| parent | 9e99d2aa2d9df2d39002c15e75ccf44ccb7ead20 (diff) | |
| download | mullvadvpn-a9d5994b0fb425c5a3eabc0591e341be308bdfb7.tar.xz mullvadvpn-a9d5994b0fb425c5a3eabc0591e341be308bdfb7.zip | |
Do not implement `std::fmt::Display` for `ProxyConfig`
Use the Debug implementation in the one case where the Display
implementation was used.
Diffstat (limited to 'mullvad-api/src')
| -rw-r--r-- | mullvad-api/src/proxy.rs | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/mullvad-api/src/proxy.rs b/mullvad-api/src/proxy.rs index 3cf38acab0..279a289289 100644 --- a/mullvad-api/src/proxy.rs +++ b/mullvad-api/src/proxy.rs @@ -1,7 +1,7 @@ use hyper_util::client::legacy::connect::{Connected, Connection}; use serde::{Deserialize, Serialize}; use std::{ - fmt, io, + io, net::SocketAddr, path::Path, pin::Pin, @@ -61,15 +61,6 @@ pub enum ApiConnectionMode { Proxied(ProxyConfig), } -impl fmt::Display for ApiConnectionMode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - match self { - ApiConnectionMode::Direct => write!(f, "unproxied"), - ApiConnectionMode::Proxied(settings) => settings.fmt(f), - } - } -} - #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub enum ProxyConfig { Shadowsocks(proxy::Shadowsocks), @@ -97,22 +88,6 @@ impl ProxyConfig { } } -impl fmt::Display for ProxyConfig { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - let endpoint = self.get_endpoint(); - match self { - ProxyConfig::Shadowsocks(_) => write!(f, "Shadowsocks {}", endpoint), - ProxyConfig::Socks5Remote(_) => write!(f, "Socks5 {}", endpoint), - ProxyConfig::Socks5Local(local) => { - write!(f, "Socks5 {} via localhost:{}", endpoint, local.local_port) - } - ProxyConfig::EncryptedDnsProxy(proxy) => { - write!(f, "ApiSusan {}", proxy.addr) - } - } - } -} - impl From<proxy::CustomProxy> for ProxyConfig { fn from(value: proxy::CustomProxy) -> Self { match value { |
