Skip to content

Commit 58dfdf7

Browse files
committed
Minor probe fix
1 parent ac15297 commit 58dfdf7

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

snxcore/src/model/params.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,14 @@ impl TunnelParams {
503503
Ok(())
504504
}
505505

506+
pub fn default_config_dir() -> PathBuf {
507+
ProjectDirs::from("", "", "snx-rs")
508+
.expect("No home directory!")
509+
.config_dir()
510+
.to_owned()
511+
}
512+
506513
pub fn default_config_path() -> PathBuf {
507-
let dir = ProjectDirs::from("", "", "snx-rs").expect("No home directory!");
508-
dir.config_dir().join("snx-rs.conf")
514+
Self::default_config_dir().join("snx-rs.conf")
509515
}
510516
}

snxcore/src/tunnel/ipsec/natt.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl NattProber {
5555
if self.send_probe().await.is_err() {
5656
// attempt to unblock port 4500 by sending some magic packets to port 500
5757
self.send_nmap_knock().await?;
58+
self.send_nmap_knock().await?;
5859

5960
for _ in 0..MAX_NATT_PROBES {
6061
if self.send_probe().await.is_ok() {
@@ -100,12 +101,10 @@ impl NattProber {
100101
let udp = UdpSocket::bind("0.0.0.0:0").await?;
101102
udp.connect(format!("{}:500", self.address)).await?;
102103

103-
for _ in 0..2 {
104-
for probe in NMAP_KNOCK {
105-
let _ = udp.send(probe).await;
106-
}
107-
tokio::time::sleep(Duration::from_millis(100)).await;
104+
for probe in NMAP_KNOCK {
105+
let _ = udp.send(probe).await;
108106
}
107+
tokio::time::sleep(Duration::from_millis(100)).await;
109108

110109
Ok(())
111110
}

0 commit comments

Comments
 (0)