mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
4 Commits
3ca72d3cbd
...
v2.4.3
Author | SHA1 | Date | |
---|---|---|---|
|
4ff1c1dc1f | ||
|
c1427040f6 | ||
|
a7ad02acb6 | ||
|
b188d61be1 |
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -176,7 +176,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "auth"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"block2",
|
||||
@@ -642,7 +642,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "common"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"is_executable",
|
||||
]
|
||||
@@ -1590,7 +1590,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpapi"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
@@ -1626,7 +1626,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpauth"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"auth",
|
||||
@@ -1645,7 +1645,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpclient"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@@ -1667,7 +1667,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpgui-helper"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@@ -1685,7 +1685,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpservice"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
@@ -2951,7 +2951,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openconnect"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"common",
|
||||
|
@@ -11,7 +11,7 @@ members = [
|
||||
|
||||
[workspace.package]
|
||||
rust-version = "1.80"
|
||||
version = "2.4.1"
|
||||
version = "2.4.3"
|
||||
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
|
||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||
edition = "2021"
|
||||
|
@@ -22,7 +22,7 @@ serde_json.workspace = true
|
||||
whoami.workspace = true
|
||||
tempfile.workspace = true
|
||||
reqwest.workspace = true
|
||||
directories = "5.0"
|
||||
directories.workspace = true
|
||||
compile-time.workspace = true
|
||||
|
||||
[features]
|
||||
|
@@ -87,8 +87,8 @@ pub(crate) struct ConnectArgs {
|
||||
#[arg(long, value_enum, default_value_t = ConnectArgs::default_os())]
|
||||
os: Os,
|
||||
|
||||
#[arg(long, default_value_t = ConnectArgs::default_os_version())]
|
||||
os_version: String,
|
||||
#[arg(long, help = "If not specified, it will be computed based on the --os option")]
|
||||
os_version: Option<String>,
|
||||
|
||||
#[arg(long, help = "Disable DTLS and ESP")]
|
||||
no_dtls: bool,
|
||||
@@ -121,8 +121,12 @@ impl ConnectArgs {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_os_version() -> String {
|
||||
match ConnectArgs::default_os() {
|
||||
fn os_version(&self) -> String {
|
||||
if let Some(os_version) = self.os_version.as_deref() {
|
||||
return os_version.to_string();
|
||||
}
|
||||
|
||||
match self.os {
|
||||
Os::Linux => format!("Linux {}", whoami::distro()),
|
||||
Os::Windows => String::from("Microsoft Windows 11 Pro , 64-bit"),
|
||||
Os::Mac => String::from("Apple Mac OS X 13.4.0"),
|
||||
@@ -149,7 +153,7 @@ impl<'a> ConnectHandler<'a> {
|
||||
GpParams::builder()
|
||||
.user_agent(&self.args.user_agent)
|
||||
.client_os(ClientOs::from(&self.args.os))
|
||||
.os_version(self.args.os_version.clone())
|
||||
.os_version(self.args.os_version())
|
||||
.ignore_tls_errors(self.shared_args.ignore_tls_errors)
|
||||
.certificate(self.args.certificate.clone())
|
||||
.sslkey(self.args.sslkey.clone())
|
||||
@@ -359,7 +363,7 @@ impl<'a> ConnectHandler<'a> {
|
||||
None
|
||||
};
|
||||
|
||||
let os_version = self.args.os_version.clone();
|
||||
let os_version = self.args.os_version();
|
||||
let verbose = self.shared_args.verbose.to_verbose_arg();
|
||||
let auth_launcher = SamlAuthLauncher::new(&self.args.server)
|
||||
.gateway(is_gateway)
|
||||
|
@@ -177,11 +177,12 @@ mod signals {
|
||||
tokio::select! {
|
||||
_ = user_sig1.recv() => {
|
||||
info!("Received SIGUSR1 signal");
|
||||
vpn_ctx.disconnect().await;
|
||||
// Write the PID to a dedicated file to indicate that the VPN task is disconnected via SIGUSR1
|
||||
let pid = std::process::id();
|
||||
if let Err(err) = tokio::fs::write(DISCONNECTED_PID_FILE, pid.to_string()).await {
|
||||
warn!("Failed to write PID to file: {}", err);
|
||||
if vpn_ctx.disconnect().await {
|
||||
// Write the PID to a dedicated file to indicate that the VPN task is disconnected via SIGUSR1
|
||||
let pid = std::process::id();
|
||||
if let Err(err) = tokio::fs::write(DISCONNECTED_PID_FILE, pid.to_string()).await {
|
||||
warn!("Failed to write PID to file: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = user_sig2.recv() => {
|
||||
|
@@ -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() {
|
||||
info!("Disconnecting VPN...");
|
||||
if let Some(vpn) = self.vpn_handle.read().await.as_ref() {
|
||||
@@ -101,9 +101,13 @@ impl VpnTaskContext {
|
||||
// Wait for the VPN to be disconnected
|
||||
disconnect_rx.await.ok();
|
||||
info!("VPN disconnected");
|
||||
|
||||
true
|
||||
} else {
|
||||
info!("VPN is not connected, skip disconnect");
|
||||
self.vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## 2.4.3 - 2025-01-21
|
||||
|
||||
- Do not use static default value for `--os-version` option.
|
||||
|
||||
## 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
|
||||
|
||||
- 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"
|
Reference in New Issue
Block a user