pub struct ClientConfig {Show 13 fields
pub name: String,
pub remote_host: String,
pub remote_port: u16,
pub protocol: String,
pub ca_cert: String,
pub client_cert: String,
pub client_key: String,
pub tls_auth_key: Option<String>,
pub tls_crypt_key: Option<String>,
pub cipher: String,
pub auth: String,
pub key_direction: Option<u8>,
pub extra_options: Vec<String>,
}Expand description
Client configuration for .ovpn file generation
Fields§
§name: StringClient name/identifier
remote_host: StringServer hostname/IP
remote_port: u16Server port
protocol: StringProtocol (udp or tcp)
ca_cert: StringCA certificate (PEM)
client_cert: StringClient certificate (PEM)
client_key: StringClient private key (PEM)
tls_auth_key: Option<String>TLS auth key (if enabled)
tls_crypt_key: Option<String>TLS crypt key (if enabled)
cipher: StringCipher
auth: StringAuth digest
key_direction: Option<u8>Key direction for tls-auth
extra_options: Vec<String>Additional options
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate all certificates and keys before generating .ovpn
Sourcepub fn to_ovpn(&self) -> String
pub fn to_ovpn(&self) -> String
Generate .ovpn file contents
§Panics
Panics if the configuration is invalid. Use validate() before calling this method
to check for errors without panicking.
Sourcepub fn to_ovpn_mobile(&self) -> String
pub fn to_ovpn_mobile(&self) -> String
Generate a minimal .ovpn for mobile devices
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl<'de> Deserialize<'de> for ClientConfig
impl<'de> Deserialize<'de> for ClientConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnwindSafe for ClientConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more