Skip to content

refactor core/vpn.rs to support multiple vpn types #293

@cachebag

Description

@cachebag

part of #288. depends on VpnConfig trait + build_openvpn_connection().

changes

core/vpn.rs currently hardcodes wireguard type checks everywhere. refactor each function:

connect_vpn: accept impl VpnConfig, match on vpn_type() to dispatch to build_wireguard_connection vs build_openvpn_connection.

disconnect_vpn: currently checks connection.type == "wireguard". also accept connection.type == "vpn" with vpn.service-type == "...openvpn".

list_vpn_connections: expand filter to detect openvpn connections (connection.type == "vpn" + check vpn.service-type). set vpn_type on returned VpnConnection accordingly.

get_vpn_info: same type-detection. for openvpn gateway, read from vpn.data["remote"] instead of parsing wireguard peers. ip config extraction stays the same.

forget_vpn: same filter expansion as disconnect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nmrsChanges to nmrsrefactorChange or improve codevpnChanges to VPN surface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions