summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-03-28 16:44:37 +0200
committerLinus Färnstrand <faern@faern.net>2022-03-28 17:12:20 +0200
commit019a804be56926d5ad4b032069a78371da862d17 (patch)
treeae94dfa268a15b49f2877088bd89f135b298a009
parent0ff72eec37d0435749b981650685b556a8bcbc29 (diff)
downloadmullvadvpn-019a804be56926d5ad4b032069a78371da862d17.tar.xz
mullvadvpn-019a804be56926d5ad4b032069a78371da862d17.zip
Format a protocol as "/TCP" instead of "over TCP"
This has the following benefits: * It's a somewhat standard way of representing such a thing * It's shorter * It ties the protocol closer to the SocketAddr data it's associated to
-rw-r--r--mullvad-cli/src/format.rs8
-rw-r--r--mullvad-types/src/relay_constraints.rs2
-rw-r--r--talpid-types/src/net/mod.rs8
3 files changed, 7 insertions, 11 deletions
diff --git a/mullvad-cli/src/format.rs b/mullvad-cli/src/format.rs
index 76ffcf7fb1..13e084707a 100644
--- a/mullvad-cli/src/format.rs
+++ b/mullvad-cli/src/format.rs
@@ -41,7 +41,7 @@ pub fn print_state(state: &TunnelState) {
fn format_endpoint(endpoint: &TunnelEndpoint) -> String {
let tunnel_type = TunnelType::from_i32(endpoint.tunnel_type).expect("invalid tunnel protocol");
let mut out = format!(
- "{} {} over {}",
+ "{} {}/{}",
match tunnel_type {
TunnelType::Wireguard => "WireGuard",
TunnelType::Openvpn => "OpenVPN",
@@ -57,7 +57,7 @@ fn format_endpoint(endpoint: &TunnelEndpoint) -> String {
if let Some(ref proxy) = endpoint.proxy {
write!(
&mut out,
- " via {} {} over {}",
+ " via {} {}/{}",
match ProxyType::from_i32(proxy.proxy_type).expect("invalid proxy type") {
ProxyType::Shadowsocks => "Shadowsocks",
ProxyType::Custom => "custom bridge",
@@ -75,7 +75,7 @@ fn format_endpoint(endpoint: &TunnelEndpoint) -> String {
if let Some(ref entry_endpoint) = endpoint.entry_endpoint {
write!(
&mut out,
- " via {} over {}",
+ " via {}/{}",
entry_endpoint.address,
format_protocol(
TransportProtocol::from_i32(entry_endpoint.protocol)
@@ -87,7 +87,7 @@ fn format_endpoint(endpoint: &TunnelEndpoint) -> String {
if let Some(ref obfuscation) = endpoint.obfuscation {
write!(
&mut out,
- " via {} {}:{} over {}",
+ " via {} {}:{}/{}",
match ObfuscationType::from_i32(obfuscation.obfuscation_type)
.expect("invalid obfuscation type")
{
diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs
index 0ee7452c60..96d1014592 100644
--- a/mullvad-types/src/relay_constraints.rs
+++ b/mullvad-types/src/relay_constraints.rs
@@ -401,7 +401,7 @@ impl fmt::Display for OpenVpnConstraints {
Constraint::Any => write!(f, "any port")?,
Constraint::Only(port) => write!(f, "port {}", port)?,
}
- write!(f, " over {}", port.protocol)
+ write!(f, "/{}", port.protocol)
}
}
}
diff --git a/talpid-types/src/net/mod.rs b/talpid-types/src/net/mod.rs
index fdfeeb8b33..270c0c769d 100644
--- a/talpid-types/src/net/mod.rs
+++ b/talpid-types/src/net/mod.rs
@@ -150,11 +150,7 @@ impl fmt::Display for TunnelEndpoint {
match self.tunnel_type {
TunnelType::OpenVpn => {
if let Some(ref proxy) = self.proxy {
- write!(
- f,
- " via {} {} over {}",
- proxy.proxy_type, proxy.endpoint.address, proxy.endpoint.protocol
- )?;
+ write!(f, " via {} {}", proxy.proxy_type, proxy.endpoint)?;
}
}
TunnelType::Wireguard => {
@@ -246,7 +242,7 @@ impl Endpoint {
impl fmt::Display for Endpoint {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
- write!(f, "{} over {}", self.address, self.protocol)
+ write!(f, "{}/{}", self.address, self.protocol)
}
}