Refactor vpn.rs to support multiple vpn types#311
Conversation
c1441b6 to
b158730
Compare
There was a problem hiding this comment.
@stoutes Could you please drop these other commits from the branch? I'd prefer you just keep the changes you made. It looks like you branched off of master when it should have been off of dev-openvpn.
Additionally, please clean up your commit messages. This is not ideal
b158730 to
1cd575f
Compare
|
@stoutes You're gonna want to run |
8ecf984 to
0f7eff1
Compare
Yeah not sure how that happened....weird |
cachebag
left a comment
There was a problem hiding this comment.
Nice job, really appreciate your help on this!
|
Just to note @stoutes for the conflcits, accept all incoming changes. We don't want |
… openvpn connections
…connect_vpn, FIXME in get_vpn_info, update wireguard peers comment, reverted back to body.deserialize()? in forget_vpn,
…nConfig for WireGuardConfig, and VpnConfig for VpnCredentials. Also removed OpenVpn from the VpnType enum.
a0fabe3 to
26f0985
Compare
Summary
Part of #288, closes #293.
Refactors
core/vpn.rsto replace hardcoded WireGuard type checks with ashared
detect_vpn_type()helper that understands both WireGuard and OpenVPNconnection types, making each function ready to handle multiple VPN backends.
Changes
api/models/vpn.rsOpenVpnvariant toVpnTypeenumcore/vpn.rsdetect_vpn_type()helper — detects WireGuard (connection.type == "wireguard")and OpenVPN (
connection.type == "vpn"+vpn.service-type == "org.freedesktop.NetworkManager.openvpn")from a settings map, replacing all scattered inline string checks
connect_vpn: dispatches oncreds.vpn_typetobuild_wireguard_connectionor returnsVpnFailedfor unsupported types — fullimpl VpnConfigsignature blocked onVpnConfigtrait from openvpn support #288
disconnect_vpn: replaced hardcodedconnection.type == "wireguard"check withdetect_vpn_typelist_vpn_connections: expanded active and saved connection filters to detect both types viadetect_vpn_type;vpn_typeon returnedVpnConnectionnow reflects actual detected typeinstead of always being
VpnType::WireGuardget_vpn_info: replaced hardcoded type check withdetect_vpn_type; gateway extractionbranches on
vpn_type— WireGuard reads fromwireguard.peers, OpenVPN reads fromvpn.data["remote"]; IP config extraction unchangedforget_vpn: replaced hardcoded type check withdetect_vpn_type, flattenedif let Some(conn_sec)nestingapi/network_manager.rsconnect_vpnto delegate fully tocore::vpn::connect_vpn, removed redundantbuild_wireguard_connectioncall and unusedoptsparameterBlocked on #288
build_openvpn_connection— OpenVPN connections will hit theVpnFailedstub until this landsVpnConfigtrait —connect_vpnsignature cannot be updated toimpl VpnConfiguntil thetrait exists