part of #288
current VpnCredentials has wireguard-specific fields baked in. introduce a trait-based abstraction so openvpn (and future protocols) don't bloat the same struct.
changes
add VpnConfig trait in api/models/vpn.rs:
pub trait VpnConfig: Send + Sync + std::fmt::Debug {
fn vpn_type(&self) -> VpnType;
fn name(&self) -> &str;
fn gateway(&self) -> &str;
fn dns(&self) -> Option<&[String]>;
fn mtu(&self) -> Option<u32>;
fn uuid(&self) -> Option<uuid::Uuid>;
}
add WireGuardConfig struct as the new preferred wireguard config type, implementing VpnConfig.
impl VpnConfig for VpnCredentials for backward compat — deprecate VpnCredentials with a note pointing to WireGuardConfig.
change connect_vpn(&self, config: impl VpnConfig) in network_manager.rs. non-breaking since VpnCredentials implements the trait and callers use type inference.
files
api/models/vpn.rs — trait, WireGuardConfig, deprecation
api/network_manager.rs — signature change
lib.rs — re-exports
part of #288
current
VpnCredentialshas wireguard-specific fields baked in. introduce a trait-based abstraction so openvpn (and future protocols) don't bloat the same struct.changes
add
VpnConfigtrait inapi/models/vpn.rs:add
WireGuardConfigstruct as the new preferred wireguard config type, implementingVpnConfig.impl VpnConfig for VpnCredentialsfor backward compat — deprecateVpnCredentialswith a note pointing toWireGuardConfig.change
connect_vpn(&self, config: impl VpnConfig)innetwork_manager.rs. non-breaking sinceVpnCredentialsimplements the trait and callers use type inference.files
api/models/vpn.rs— trait,WireGuardConfig, deprecationapi/network_manager.rs— signature changelib.rs— re-exports