Skip to content

add OpenVpnBuilder with validation #291

@cachebag

Description

@cachebag

part of #288. depends on OpenVpnConfig being merged.

changes

new file: api/builders/openvpn_builder.rs

fluent builder that constructs OpenVpnConfig. validates at build time:

  • remote must be set and non-empty
  • auth_type must be set
  • if Password or PasswordTls: username required
  • if Tls or PasswordTls: ca_cert, client_cert, client_key required
  • port 1-65535 if set

methods: new(name), remote(), auth_type(), username(), password(), ca_cert(), client_cert(), client_key(), key_password(), port(), tcp(), cipher(), auth(), dns(), mtu(), uuid(), autoconnect(), options(), build() -> Result<OpenVpnConfig>

re-export from builders/mod.rs.

tests

unit tests mirroring wireguard_builder.rs structure — required field checks, validation errors, happy paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestnmrsChanges to nmrsvpnChanges to VPN surface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions