feat: add VpnEnv struct and update WsEvent to include VPN environment details

This commit is contained in:
Kevin Yue committed 2025-11-12 23:35:43 +08:00
1 parent 7048248268
commit 49fe7447ff
4 files changed
+37 -5

No files matched your search

+2 -1
View File
@@ -1,10 +1,11 @@
use serde::{Deserialize, Serialize};
use super::vpn_state::VpnState;
use crate::service::{vpn_env::VpnEnv, vpn_state::VpnState};
/// Events that can be emitted by the service
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum WsEvent {
VpnEnv(VpnEnv),
VpnState(VpnState),
ActiveGui,
ResumeConnection,
+1
View File
@@ -1,3 +1,4 @@
pub mod event;
pub mod request;
pub mod vpn_env;
pub mod vpn_state;
+22
View File
@@ -0,0 +1,22 @@
use serde::{Deserialize, Serialize};
use crate::service::vpn_state::VpnState;
/// Represents the VPN environment configuration.
/// When a client connects, the gpservice sends the current VPN environment
/// to the client so that it can configure itself accordingly.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct VpnEnv {
/// The VPN connection state
pub vpn_state: VpnState,
/// The default VPN script path
pub vpnc_script: Option<String>,
/// The default CSD wrapper script path
pub csd_wrapper: Option<String>,
/// The gpauth executable path
/// Used by the client to launch gpauth for authentication
pub auth_executable: String,
}