OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::TunBuilderCapture::ProxyHostPort Class Reference

Host and port configuration for proxy connections. More...

#include <capture.hpp>

Public Member Functions

std::string to_string () const
 Converts the host and port to a string representation.
 
bool defined () const
 Checks if the proxy configuration is defined.
 
void validate (const std::string &title) const
 Validates the host and port.
 
Json::Value to_json () const
 Converts the object to a JSON representation.
 
void from_json (const Json::Value &root, const std::string &title)
 Populates the object from a JSON representation.
 

Public Attributes

std::string host
 
int port = 0
 

Detailed Description

Host and port configuration for proxy connections.

This class stores and validates a host:port combination that represents a proxy server. It provides methods to check validity, convert to string representation, and serialize/deserialize from JSON (when available).

Definition at line 483 of file capture.hpp.

Member Function Documentation

◆ defined()

bool openvpn::TunBuilderCapture::ProxyHostPort::defined ( ) const
inline

Checks if the proxy configuration is defined.

A proxy is considered defined if the host is not empty.

Returns
true if the host is not empty, false otherwise.

Definition at line 506 of file capture.hpp.

Here is the caller graph for this function:

◆ from_json()

void openvpn::TunBuilderCapture::ProxyHostPort::from_json ( const Json::Value &  root,
const std::string &  title 
)
inline

Populates the object from a JSON representation.

Extracts "host" and "port" fields from a JSON object.

Warning
If input is not a valid JSON dictionary, the method will return without processing and without raising any errors. This silent behavior may cause unexpected results.
Parameters
rootThe JSON object to parse.
titleA context string used in error messages during parsing.

Definition at line 548 of file capture.hpp.

◆ to_json()

Json::Value openvpn::TunBuilderCapture::ProxyHostPort::to_json ( ) const
inline

Converts the object to a JSON representation.

Creates a JSON object with "host" and "port" fields.

Returns
A JSON object containing the host and port values.

Definition at line 533 of file capture.hpp.

Here is the caller graph for this function:

◆ to_string()

std::string openvpn::TunBuilderCapture::ProxyHostPort::to_string ( ) const
inline

Converts the host and port to a string representation.

Creates a string in the format "host port".

Returns
A string containing the host and port separated by a space.

Definition at line 494 of file capture.hpp.

Here is the caller graph for this function:

◆ validate()

void openvpn::TunBuilderCapture::ProxyHostPort::validate ( const std::string &  title) const
inline

Validates the host and port.

If the proxy is defined, validates both the host name and port number using the HostPort validation methods.

Warning
If host is not defined, the method will return without processing and without raising any errors. This silent behavior may cause unexpected results.
Parameters
titleA context string used in error messages for validation.

Definition at line 518 of file capture.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ host

std::string openvpn::TunBuilderCapture::ProxyHostPort::host

Definition at line 486 of file capture.hpp.

◆ port

int openvpn::TunBuilderCapture::ProxyHostPort::port = 0

Definition at line 487 of file capture.hpp.


The documentation for this class was generated from the following file: