diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-05-24 15:09:39 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-06-14 12:38:30 +0200 |
| commit | 6c8d0353aa02f0c410f1040b31f1d7cafe40a6da (patch) | |
| tree | c6c210b827331d4b1f3b72082ff47ce6e688617d | |
| parent | b3434319a30646d6ee971bf4db050507d4f6ebdd (diff) | |
| download | mullvadvpn-6c8d0353aa02f0c410f1040b31f1d7cafe40a6da.tar.xz mullvadvpn-6c8d0353aa02f0c410f1040b31f1d7cafe40a6da.zip | |
Display allowed in-tunnel traffic for connecting state
| -rw-r--r-- | talpid-core/src/firewall/mod.rs | 4 | ||||
| -rw-r--r-- | talpid-types/src/net/mod.rs | 21 |
2 files changed, 24 insertions, 1 deletions
diff --git a/talpid-core/src/firewall/mod.rs b/talpid-core/src/firewall/mod.rs index 134851fae7..a72ad65b1b 100644 --- a/talpid-core/src/firewall/mod.rs +++ b/talpid-core/src/firewall/mod.rs @@ -153,12 +153,13 @@ impl fmt::Display for FirewallPolicy { tunnel, allow_lan, allowed_endpoint, + allowed_tunnel_traffic, .. } => { if let Some(tunnel) = tunnel { write!( f, - "Connecting to {} over \"{}\" (ip: {}, v4 gw: {}, v6 gw: {:?}), {} LAN. Allowing endpoint {}", + "Connecting to {} over \"{}\" (ip: {}, v4 gw: {}, v6 gw: {:?}, allowed in-tunnel traffic: {}), {} LAN. Allowing endpoint {}", peer_endpoint, tunnel.interface, tunnel @@ -169,6 +170,7 @@ impl fmt::Display for FirewallPolicy { .join(","), tunnel.ipv4_gateway, tunnel.ipv6_gateway, + allowed_tunnel_traffic, if *allow_lan { "Allowing" } else { "Blocking" }, allowed_endpoint, ) diff --git a/talpid-types/src/net/mod.rs b/talpid-types/src/net/mod.rs index b6bc286491..8100ca6e53 100644 --- a/talpid-types/src/net/mod.rs +++ b/talpid-types/src/net/mod.rs @@ -282,6 +282,16 @@ pub enum AllowedTunnelTraffic { Only(SocketAddr, Protocol), } +impl fmt::Display for AllowedTunnelTraffic { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + match *self { + AllowedTunnelTraffic::None => "None".fmt(f), + AllowedTunnelTraffic::All => "All".fmt(f), + AllowedTunnelTraffic::Only(addr, proto) => write!(f, "{}/{}", addr, proto), + } + } +} + /// A protocol: UDP, TCP, or ICMP. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum Protocol { @@ -291,6 +301,17 @@ pub enum Protocol { IcmpV6, } +impl fmt::Display for Protocol { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + match self { + Protocol::Udp => "UDP".fmt(f), + Protocol::Tcp => "TCP".fmt(f), + Protocol::IcmpV4 => "ICMPv4".fmt(f), + Protocol::IcmpV6 => "ICMPv6".fmt(f), + } + } +} + impl From<TransportProtocol> for Protocol { fn from(proto: TransportProtocol) -> Self { match proto { |
