pub struct OpenvpnClient { /* private fields */ }Expand description
OpenVPN client connection
Implementations§
Source§impl OpenvpnClient
impl OpenvpnClient
Sourcepub fn new(config: OpenvpnConfig, session_id: u64) -> Self
pub fn new(config: OpenvpnConfig, session_id: u64) -> Self
Create a new OpenVPN client with the given configuration
Sourcepub fn state(&self) -> OpenvpnState
pub fn state(&self) -> OpenvpnState
Get current connection state
Sourcepub fn session_id(&self) -> u64
pub fn session_id(&self) -> u64
Get the session ID
Sourcepub fn connect(&mut self, now: u64) -> Result<Vec<u8>, OpenvpnError>
pub fn connect(&mut self, now: u64) -> Result<Vec<u8>, OpenvpnError>
Initiate a connection (send hard reset)
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Clean disconnect
Sourcepub fn send_control(
&mut self,
payload: &[u8],
now: u64,
) -> Result<Vec<u8>, OpenvpnError>
pub fn send_control( &mut self, payload: &[u8], now: u64, ) -> Result<Vec<u8>, OpenvpnError>
Send a control channel message (reliable, with pending ACK)
Sourcepub fn send_data(&mut self, payload: &[u8]) -> Result<Vec<u8>, OpenvpnError>
pub fn send_data(&mut self, payload: &[u8]) -> Result<Vec<u8>, OpenvpnError>
Encrypt and send a data channel packet
Sourcepub fn receive_packet(&mut self, data: &[u8]) -> Result<Vec<u8>, OpenvpnError>
pub fn receive_packet(&mut self, data: &[u8]) -> Result<Vec<u8>, OpenvpnError>
Process an incoming packet
Sourcepub fn process_control(&mut self, data: &[u8]) -> Result<Vec<u8>, OpenvpnError>
pub fn process_control(&mut self, data: &[u8]) -> Result<Vec<u8>, OpenvpnError>
Handle control channel messages
Sourcepub fn renegotiate(&mut self, now: u64) -> Result<Vec<u8>, OpenvpnError>
pub fn renegotiate(&mut self, now: u64) -> Result<Vec<u8>, OpenvpnError>
Initiate TLS key renegotiation
Sourcepub fn needs_renegotiation(&self, now: u64) -> bool
pub fn needs_renegotiation(&self, now: u64) -> bool
Check if renegotiation is needed based on elapsed time
Sourcepub fn traffic_stats(&self) -> (u64, u64)
pub fn traffic_stats(&self) -> (u64, u64)
Get bytes sent/received counters