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

DNS settings for a name server. More...

#include <dns_options.hpp>

Public Types

enum class  Security { Unset , No , Yes , Optional }
 
enum class  Transport { Unset , Plain , HTTPS , TLS }
 

Public Member Functions

std::string dnssec_string () const
 Return string representation of the dnssec value in this DnsServer object.
 
void parse_dnssec_value (const std::string &dnssec_value)
 
std::string transport_string () const
 Return string representation of a given DnsServer::Transport value.
 
void parse_transport_value (const std::string &transport_value)
 
 DnsServer ()=default
 
virtual ~DnsServer () noexcept=default
 
 DnsServer (const Json::Value &root, const std::string &title="")
 
std::string to_string (const char *prefix="") const
 
Json::Value to_json () const
 
void from_json (const Json::Value &root, const std::string &title)
 
bool operator== (const DnsServer &at) const =default
 

Static Public Member Functions

static std::string dnssec_string (const Security dnssec)
 Return string representation of a given DnsServer::Security value.
 
static std::string transport_string (const Transport transport)
 Return string representation of a given DnsServer::Transport value.
 

Public Attributes

std::vector< DnsAddressaddresses
 Parsed from –dns server n address ADDRESS[:PORT] [...] or –dhcp-option DNS/DNS6.
 
std::vector< DnsDomaindomains
 Parsed from –dns server n resolve-domains DOMAIN [...] or –dhcp-option DOMAIN/DOMAIN-SEARCH if use_search_as_split_domains is true.
 
Security dnssec = Security::Unset
 Parsed from –dns server n dnssec {yes,optional,no}.
 
Transport transport = Transport::Unset
 Parsed from –dns server n transport {plain,DoT,DoH}.
 
std::string sni
 Parsed from –dns server n sni.
 

Detailed Description

DNS settings for a name server.

Definition at line 215 of file dns_options.hpp.

Member Enumeration Documentation

◆ Security

enum class openvpn::DnsServer::Security
strong
Enumerator
Unset 

Undefined setting; default value when not set.

No 

Do not use DNSSEC.

Yes 

Enforce using DNSSEC.

Optional 

Try to use DNSSEC opportunistically. If it fails, the DNS resolver may ignore DNSSEC.

Definition at line 217 of file dns_options.hpp.

◆ Transport

enum class openvpn::DnsServer::Transport
strong
Enumerator
Unset 

Undefined setting; default value when not set.

Plain 

Use the classic unencrypted DNS protocol.

HTTPS 

Use DNS-over-HTTPS (DoH)

TLS 

Use DNS-over-TLS (DoT)

Definition at line 288 of file dns_options.hpp.

Constructor & Destructor Documentation

◆ DnsServer() [1/2]

openvpn::DnsServer::DnsServer ( )
default

◆ ~DnsServer()

virtual openvpn::DnsServer::~DnsServer ( )
virtualdefaultnoexcept

◆ DnsServer() [2/2]

openvpn::DnsServer::DnsServer ( const Json::Value &  root,
const std::string &  title = "" 
)
inlineexplicit

Instantiate a new DnsServer object with information from a JSON blob, typically exported using the DnsServer::to_json() method

Parameters
rootThe root Json::Value object to import
titlestd::string with details used for error logging

Definition at line 368 of file dns_options.hpp.

Member Function Documentation

◆ dnssec_string() [1/2]

std::string openvpn::DnsServer::dnssec_string ( ) const
inline

Return string representation of the dnssec value in this DnsServer object.

Returns
std::string the string representation generated

Definition at line 254 of file dns_options.hpp.

Here is the caller graph for this function:

◆ dnssec_string() [2/2]

static std::string openvpn::DnsServer::dnssec_string ( const Security  dnssec)
inlinestatic

Return string representation of a given DnsServer::Security value.

Parameters
dnssecDnsServer::Security value
Returns
std::string the string representation generated

Definition at line 232 of file dns_options.hpp.

◆ from_json()

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

Import a Json::Value, typically generated by DnsServer::to_json() which will reconfigure this object to carry the information from the JSON data.

Parameters
rootThe root Json::Value object to import
titlestd::string with details used for error logging

Definition at line 454 of file dns_options.hpp.

◆ operator==()

bool openvpn::DnsServer::operator== ( const DnsServer at) const
default

◆ parse_dnssec_value()

void openvpn::DnsServer::parse_dnssec_value ( const std::string &  dnssec_value)
inline

Parse the –dns server n dnssec VALUE into the internal DnsServer::Security representation. This method is typically called from the option parser.

Parameters
dnssec_valuestd::string containing the DNSSEC setting to use
Exceptions
openvpn::Exceptionon invalid values

Definition at line 268 of file dns_options.hpp.

◆ parse_transport_value()

void openvpn::DnsServer::parse_transport_value ( const std::string &  transport_value)
inline

Parse the –dns server n transport VALUE into the internal DnsServer::Transport representation. This method is typically called from the option parser.

Parameters
transport_valuestd::string containing the DNS transport setting to use
Exceptions
openvpn::Exceptionon invalid values

Definition at line 337 of file dns_options.hpp.

◆ to_json()

Json::Value openvpn::DnsServer::to_json ( ) const
inline

Generate a JSON representation of the configured DnsServer variables.

The output of this function can be imported into another DnsServer object by passing the Json::Value to the DnsServer constructor or using the DnsServer::from_json() method.

Returns
Json::Value of information this object carries

Definition at line 423 of file dns_options.hpp.

◆ to_string()

std::string openvpn::DnsServer::to_string ( const char *  prefix = "") const
inline

Generate a human readable representation of the configured DnsServer variables

Returns
std::string the string representation generated

Definition at line 380 of file dns_options.hpp.

◆ transport_string() [1/2]

std::string openvpn::DnsServer::transport_string ( ) const
inline

Return string representation of a given DnsServer::Transport value.

Returns
std::string the string representation generated

Definition at line 324 of file dns_options.hpp.

Here is the caller graph for this function:

◆ transport_string() [2/2]

static std::string openvpn::DnsServer::transport_string ( const Transport  transport)
inlinestatic

Return string representation of a given DnsServer::Transport value.

Parameters
transportDnsServer::Transport value
Returns
std::string the string representation generated

Definition at line 303 of file dns_options.hpp.

Member Data Documentation

◆ addresses

std::vector<DnsAddress> openvpn::DnsServer::addresses

Parsed from –dns server n address ADDRESS[:PORT] [...] or –dhcp-option DNS/DNS6.

Definition at line 511 of file dns_options.hpp.

◆ dnssec

Security openvpn::DnsServer::dnssec = Security::Unset

Parsed from –dns server n dnssec {yes,optional,no}.

Definition at line 517 of file dns_options.hpp.

◆ domains

std::vector<DnsDomain> openvpn::DnsServer::domains

Parsed from –dns server n resolve-domains DOMAIN [...] or –dhcp-option DOMAIN/DOMAIN-SEARCH if use_search_as_split_domains is true.

Definition at line 514 of file dns_options.hpp.

◆ sni

std::string openvpn::DnsServer::sni

Parsed from –dns server n sni.

Definition at line 523 of file dns_options.hpp.

◆ transport

Transport openvpn::DnsServer::transport = Transport::Unset

Parsed from –dns server n transport {plain,DoT,DoH}.

Definition at line 520 of file dns_options.hpp.


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