mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
2 Commits
3ca72d3cbd
...
a7ad02acb6
Author | SHA1 | Date | |
---|---|---|---|
|
a7ad02acb6 | ||
|
b188d61be1 |
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -176,7 +176,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"block2",
|
"block2",
|
||||||
@ -642,7 +642,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"is_executable",
|
"is_executable",
|
||||||
]
|
]
|
||||||
@ -1590,7 +1590,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@ -1626,7 +1626,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@ -1645,7 +1645,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1667,7 +1667,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1685,7 +1685,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@ -2951,7 +2951,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"common",
|
"common",
|
||||||
|
@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.80"
|
rust-version = "1.80"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
|
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
|
||||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
@ -22,7 +22,7 @@ serde_json.workspace = true
|
|||||||
whoami.workspace = true
|
whoami.workspace = true
|
||||||
tempfile.workspace = true
|
tempfile.workspace = true
|
||||||
reqwest.workspace = true
|
reqwest.workspace = true
|
||||||
directories = "5.0"
|
directories.workspace = true
|
||||||
compile-time.workspace = true
|
compile-time.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -177,13 +177,14 @@ mod signals {
|
|||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = user_sig1.recv() => {
|
_ = user_sig1.recv() => {
|
||||||
info!("Received SIGUSR1 signal");
|
info!("Received SIGUSR1 signal");
|
||||||
vpn_ctx.disconnect().await;
|
if vpn_ctx.disconnect().await {
|
||||||
// Write the PID to a dedicated file to indicate that the VPN task is disconnected via SIGUSR1
|
// Write the PID to a dedicated file to indicate that the VPN task is disconnected via SIGUSR1
|
||||||
let pid = std::process::id();
|
let pid = std::process::id();
|
||||||
if let Err(err) = tokio::fs::write(DISCONNECTED_PID_FILE, pid.to_string()).await {
|
if let Err(err) = tokio::fs::write(DISCONNECTED_PID_FILE, pid.to_string()).await {
|
||||||
warn!("Failed to write PID to file: {}", err);
|
warn!("Failed to write PID to file: {}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ = user_sig2.recv() => {
|
_ = user_sig2.recv() => {
|
||||||
info!("Received SIGUSR2 signal");
|
info!("Received SIGUSR2 signal");
|
||||||
ws_ctx.send_event(WsEvent::ResumeConnection).await;
|
ws_ctx.send_event(WsEvent::ResumeConnection).await;
|
||||||
|
@ -90,7 +90,7 @@ impl VpnTaskContext {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn disconnect(&self) {
|
pub async fn disconnect(&self) -> bool {
|
||||||
if let Some(disconnect_rx) = self.disconnect_rx.write().await.take() {
|
if let Some(disconnect_rx) = self.disconnect_rx.write().await.take() {
|
||||||
info!("Disconnecting VPN...");
|
info!("Disconnecting VPN...");
|
||||||
if let Some(vpn) = self.vpn_handle.read().await.as_ref() {
|
if let Some(vpn) = self.vpn_handle.read().await.as_ref() {
|
||||||
@ -101,9 +101,13 @@ impl VpnTaskContext {
|
|||||||
// Wait for the VPN to be disconnected
|
// Wait for the VPN to be disconnected
|
||||||
disconnect_rx.await.ok();
|
disconnect_rx.await.ok();
|
||||||
info!("VPN disconnected");
|
info!("VPN disconnected");
|
||||||
|
|
||||||
|
true
|
||||||
} else {
|
} else {
|
||||||
info!("VPN is not connected, skip disconnect");
|
info!("VPN is not connected, skip disconnect");
|
||||||
self.vpn_state_tx.send(VpnState::Disconnected).ok();
|
self.vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||||
|
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.4.2 - 2025-01-20
|
||||||
|
|
||||||
|
- Disconnect the VPN when sleep (fix [#166](https://github.com/yuezk/GlobalProtect-openconnect/issues/166), [#267](https://github.com/yuezk/GlobalProtect-openconnect/issues/267))
|
||||||
|
|
||||||
## 2.4.1 - 2025-01-09
|
## 2.4.1 - 2025-01-09
|
||||||
|
|
||||||
- Fix the network issue with OpenSSL < 3.0.4
|
- Fix the network issue with OpenSSL < 3.0.4
|
||||||
|
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "1.80.1"
|
Loading…
x
Reference in New Issue
Block a user