Skip to content

Commit 5804ea0

Browse files
author
Maciej Wójcik
committed
disable auto restart for tunnel service
1 parent 7515e82 commit 5804ea0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wgapi_windows.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
204204
});
205205
}
206206

207+
debug!(
208+
"Disabling automatic restart for interface {} tunnel service",
209+
self.ifname
210+
);
211+
let service_update_output = Command::new("sc")
212+
.arg("config")
213+
.arg(format!("WireGuardTunnel${}", self.ifname))
214+
.arg("start=demand")
215+
.output()
216+
.map_err(|err| {
217+
error!("Failed to configure tunnel service. Error: {err}");
218+
let message = err.to_string();
219+
WireguardInterfaceError::ServiceInstallationFailed { err, message }
220+
})?;
221+
207222
// TODO: set maximum transfer unit (MTU)
208223

209224
info!(

0 commit comments

Comments
 (0)