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

Class for handling Proxy Auto-Configuration (PAC) URLs. More...

#include <capture.hpp>

Public Member Functions

std::string to_string () const
 Returns the URL as a string.
 
bool defined () const
 Checks if the URL is defined.
 
void validate (const std::string &title) const
 Validates the URL format.
 
Json::Value to_json () const
 Converts the URL to a JSON object.
 
void from_json (const Json::Value &root, const std::string &title)
 Populates the URL from a JSON object.
 

Public Attributes

std::string url
 

Detailed Description

Class for handling Proxy Auto-Configuration (PAC) URLs.

This class provides functionality to store, validate, and convert a Proxy Auto-Configuration URL. PAC files are JavaScript files that determine which proxy server (if any) to use for a given URL.

Definition at line 402 of file capture.hpp.

Member Function Documentation

◆ defined()

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

Checks if the URL is defined.

A URL is considered defined if it is not empty.

Returns
true if the URL is defined, false otherwise.

Definition at line 421 of file capture.hpp.

Here is the caller graph for this function:

◆ from_json()

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

Populates the URL from a JSON object.

Extracts the "url" field from the provided JSON object. Does nothing if the JSON is not an 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 extract the URL from.
titleA descriptive string to include in error messages.

Definition at line 468 of file capture.hpp.

◆ to_json()

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

Converts the URL to a JSON object.

Creates a JSON object with a single "url" field containing the URL string.

Returns
A JSON object representation of the URL.

Definition at line 453 of file capture.hpp.

Here is the caller graph for this function:

◆ to_string()

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

Returns the URL as a string.

Returns
The URL string.

Definition at line 411 of file capture.hpp.

Here is the caller graph for this function:

◆ validate()

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

Validates the URL format.

Attempts to parse the URL using the URL::Parse function to verify it has a valid format. Throws an exception if parsing fails.

Warning
If url is not defined, the method will return without processing and without raising any errors. This silent behavior may cause unexpected results.
Parameters
titleA descriptive string to include in the exception message if validation fails.
Exceptions
ExceptionThrows an exception if the URL is invalid.

Definition at line 434 of file capture.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ url

std::string openvpn::TunBuilderCapture::ProxyAutoConfigURL::url

Definition at line 405 of file capture.hpp.


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