Skip to content

Commit

Permalink
fixup: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Nov 30, 2023
1 parent ac2ec9b commit 3452b3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion talpid-wireguard/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ impl Config {
/// misguided in principle but happens to work given that normally only one peer will be
/// present.
pub fn is_multihop(&self) -> bool {
self.peers.len() > 1
self.peers.len() == 2
}

/// Return the entry peer. This happens to be the first peer.
pub fn entry_peer_mut(&mut self) -> Option<&mut wireguard::PeerConfig> {
self.peers.get_mut(0)
}
}

Expand Down
3 changes: 1 addition & 2 deletions talpid-wireguard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,7 @@ impl WireguardMonitor {
// Set up tunnel to lead to entry
let mut entry_tun_config = config.clone();
entry_tun_config
.peers
.get_mut(0)
.entry_peer_mut()
.expect("entry peer not found")
.allowed_ips
.push(IpNetwork::new(IpAddr::V4(config.ipv4_gateway), 32).unwrap());
Expand Down

0 comments on commit 3452b3e

Please sign in to comment.