crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Network Namespace Reference

Namespace for networking classes. More...

Namespaces

 FTPUpload
 

Classes

class  Config
 Abstract class containing the network-specific configuration for threads. More...
 
class  Curl
 Provides an interface to the libcurl library for sending and receiving data over the network. More...
 
class  Downloader
 Downloader using the libcurl library to download a URL in an extra thread. More...
 
class  TorControl
 Controls a TOR service via a TOR control server/port, if available. More...
 

Constants

constexpr std::uint16_t httpVersionAny {0}
 Use any available HTTP version. More...
 
constexpr std::uint16_t httpVersion1 {1}
 Use HTTP/1 only. More...
 
constexpr std::uint16_t httpVersion11 {2}
 Use HTTP/1.1 only. More...
 
constexpr std::uint16_t httpVersion2 {3}
 Attempt to use HTTP/2, fall back to HTTP/1.1. More...
 
constexpr std::uint16_t httpVersion2Only {4}
 Use non-TLS HTTP/2, even if HTTPS is not available. More...
 
constexpr std::uint16_t httpVersion2Tls {5}
 Attempt to use HTTP/2 over TLS, fall back to HTTP/1.1. More...
 
constexpr std::uint16_t httpVersion3Only {6}
 Use HTTP/3 only. More...
 
constexpr std::uint16_t defaultConnectionsMax {5}
 Default maximum number of connections. More...
 
constexpr std::int64_t defaultDnsCacheTimeOut {60}
 Default lifetime of DNS cache entries. More...
 
constexpr std::uint64_t defaultRedirectMax {20}
 Default maximum number of automatic redirects by default. More...
 
constexpr std::uint64_t defaultResetTorOnlyAfter {60}
 Default number of seconds that need to have been passed before requesting a new TOR identity. More...
 
constexpr std::uint64_t defaultTcpKeepAliveIdle {60}
 Default delay that will be waited before sending keep-alive probes, in seconds. More...
 
constexpr std::uint64_t defaultTcpKeepAliveInterval {60}
 Default interval for TCP Keep-alive probing, in seconds. More...
 
constexpr std::uint64_t defaultTimeOut {300}
 Default connecting time-out, in seconds. More...
 
constexpr std::uint64_t defaultTimeOutRequest {300}
 Default request time-out, in seconds. More...
 
constexpr auto defaultProtocol {"https://"sv}
 Default protocol. More...
 
constexpr auto encodedSpace {"%20"}
 URL encoding of a space. More...
 
constexpr auto encodedSpaceLength {3}
 Length of a URL encoded space. More...
 
constexpr auto checkEveryMilliseconds {100}
 The number of milliseconds to sleep before re-checking the status of the application. More...
 
constexpr auto reservedCharacters {";/?:@=&#"}
 Reserved characters to be ignored when escaping a URL. More...
 
constexpr auto versionDoH {0x073E00}
 libcurl version needed for DNS-over-HTTPS support, i.e. 7.62.0. More...
 
constexpr auto versionDnsShuffle {0x073C00}
 libcurl version needed for DNS shuffling, i.e. 7.60.0. More...
 
constexpr auto versionBrotli {0x073900}
 libcurl version needed for Brotli encoding, i.e. 7.57.0. More...
 
constexpr auto versionZstd {0x074800}
 libcurl version needed for zstd encoding, i.e. 7.72.0. More...
 
constexpr auto versionHttp2 {0x072100}
 libcurl version needed for HTTP/2 support, i.e. 7.33.0. More...
 
constexpr auto versionHttp2Only {0x073100}
 libcurl version needed for HTTP/2 ONLY support, i.e. 7.49.0. More...
 
constexpr auto versionHttp2Tls {0x072F00}
 libcurl version needed for HTTP/2 OVER TLS ONLY support, i.e. 7.47.0. More...
 
constexpr auto versionHttp3Only {0x074200}
 libcurl version needed for HTTP/3 ONLY support, i.e. 7.66.0. More...
 
constexpr auto versionPreProxy {0x073400}
 libcurl version needed for pre-proxy support, i.e. 7.52.0. More...
 
constexpr auto versionProxyTlsAuth {0x073400}
 libcurl version needed for proxy TLS authentification, i.e. 7.52.0. More...
 
constexpr auto authTypeTlsSrp {"SRP"}
 libcurl authentification type for the proxy TLS-SRP authentification. More...
 
constexpr auto versionProxySslVerify {0x073400}
 libcurl version needed for SSL verification of proxy host and peer, i.e. 7.52.0. More...
 
constexpr auto versionTcpFastOpen {0x073100}
 libcurl version needed for TCP Fast Open support, i.e. 7.49.0. More...
 
constexpr auto versionHappyEyeballs {0x073B00}
 libcurl version needed for the Happy Eyeballs algorithm, i.e. 7.59.0. More...
 
constexpr auto getPublicIpFrom {"https://myexternalip.com/raw"}
 URL to retrieve the IP of the server from. More...
 
constexpr std::array getPublicIpErrors {403, 429, 502, 503, 504, 521, 522, 524}
 Errors when retrieving the IP of the server. More...
 
constexpr auto xTsHeaderName {"X-ts: "}
 Name of the X-ts header. More...
 
constexpr auto xTsHeaderNameLen {6}
 Length of the X-ts header name, in bytes. More...
 
constexpr std::array gzipMagicNumber {0x1f, 0x8b}
 GZIP magic number. More...
 
constexpr auto responseCodeLength {3}
 The length of a HTTP response code. More...
 
constexpr auto millisecondsPerSecond {1000}
 The number of milliseconds per second. More...
 

Detailed Description

Namespace for networking classes.

Variable Documentation

◆ authTypeTlsSrp

constexpr auto crawlservpp::Network::authTypeTlsSrp {"SRP"}
inline

libcurl authentification type for the proxy TLS-SRP authentification.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ checkEveryMilliseconds

constexpr auto crawlservpp::Network::checkEveryMilliseconds {100}
inline

The number of milliseconds to sleep before re-checking the status of the application.

Referenced by crawlservpp::Network::Curl::resetConnection().

◆ defaultConnectionsMax

constexpr std::uint16_t crawlservpp::Network::defaultConnectionsMax {5}
inline

Default maximum number of connections.

◆ defaultDnsCacheTimeOut

constexpr std::int64_t crawlservpp::Network::defaultDnsCacheTimeOut {60}
inline

Default lifetime of DNS cache entries.

◆ defaultProtocol

constexpr auto crawlservpp::Network::defaultProtocol {"https://"sv}
inline

Default protocol.

◆ defaultRedirectMax

constexpr std::uint64_t crawlservpp::Network::defaultRedirectMax {20}
inline

Default maximum number of automatic redirects by default.

◆ defaultResetTorOnlyAfter

constexpr std::uint64_t crawlservpp::Network::defaultResetTorOnlyAfter {60}
inline

Default number of seconds that need to have been passed before requesting a new TOR identity.

◆ defaultTcpKeepAliveIdle

constexpr std::uint64_t crawlservpp::Network::defaultTcpKeepAliveIdle {60}
inline

Default delay that will be waited before sending keep-alive probes, in seconds.

◆ defaultTcpKeepAliveInterval

constexpr std::uint64_t crawlservpp::Network::defaultTcpKeepAliveInterval {60}
inline

Default interval for TCP Keep-alive probing, in seconds.

◆ defaultTimeOut

constexpr std::uint64_t crawlservpp::Network::defaultTimeOut {300}
inline

Default connecting time-out, in seconds.

◆ defaultTimeOutRequest

constexpr std::uint64_t crawlservpp::Network::defaultTimeOutRequest {300}
inline

Default request time-out, in seconds.

◆ encodedSpace

constexpr auto crawlservpp::Network::encodedSpace {"%20"}
inline

URL encoding of a space.

Referenced by crawlservpp::Network::Curl::escape().

◆ encodedSpaceLength

constexpr auto crawlservpp::Network::encodedSpaceLength {3}
inline

Length of a URL encoded space.

Referenced by crawlservpp::Network::Curl::escape().

◆ getPublicIpErrors

constexpr std::array crawlservpp::Network::getPublicIpErrors {403, 429, 502, 503, 504, 521, 522, 524}
inline

Errors when retrieving the IP of the server.

Referenced by crawlservpp::Network::Curl::getPublicIp().

◆ getPublicIpFrom

constexpr auto crawlservpp::Network::getPublicIpFrom {"https://myexternalip.com/raw"}
inline

URL to retrieve the IP of the server from.

Referenced by crawlservpp::Network::Curl::getPublicIp().

◆ gzipMagicNumber

constexpr std::array crawlservpp::Network::gzipMagicNumber {0x1f, 0x8b}
inline

GZIP magic number.

Referenced by crawlservpp::Network::Curl::writerInClass().

◆ httpVersion1

constexpr std::uint16_t crawlservpp::Network::httpVersion1 {1}
inline

Use HTTP/1 only.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersion11

constexpr std::uint16_t crawlservpp::Network::httpVersion11 {2}
inline

Use HTTP/1.1 only.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersion2

constexpr std::uint16_t crawlservpp::Network::httpVersion2 {3}
inline

Attempt to use HTTP/2, fall back to HTTP/1.1.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersion2Only

constexpr std::uint16_t crawlservpp::Network::httpVersion2Only {4}
inline

Use non-TLS HTTP/2, even if HTTPS is not available.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersion2Tls

constexpr std::uint16_t crawlservpp::Network::httpVersion2Tls {5}
inline

Attempt to use HTTP/2 over TLS, fall back to HTTP/1.1.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersion3Only

constexpr std::uint16_t crawlservpp::Network::httpVersion3Only {6}
inline

Use HTTP/3 only.

Warning
Fails, if a server does not support HTTP/3.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ httpVersionAny

constexpr std::uint16_t crawlservpp::Network::httpVersionAny {0}
inline

Use any available HTTP version.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ millisecondsPerSecond

constexpr auto crawlservpp::Network::millisecondsPerSecond {1000}
inline

The number of milliseconds per second.

Referenced by crawlservpp::Network::TorControl::tick().

◆ reservedCharacters

constexpr auto crawlservpp::Network::reservedCharacters {";/?:@=&#"}
inline

Reserved characters to be ignored when escaping a URL.

Referenced by crawlservpp::Network::Curl::escapeUrl().

◆ responseCodeLength

constexpr auto crawlservpp::Network::responseCodeLength {3}
inline

The length of a HTTP response code.

Referenced by crawlservpp::Network::TorControl::newIdentity().

◆ versionBrotli

constexpr auto crawlservpp::Network::versionBrotli {0x073900}
inline

libcurl version needed for Brotli encoding, i.e. 7.57.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionDnsShuffle

constexpr auto crawlservpp::Network::versionDnsShuffle {0x073C00}
inline

libcurl version needed for DNS shuffling, i.e. 7.60.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionDoH

constexpr auto crawlservpp::Network::versionDoH {0x073E00}
inline

libcurl version needed for DNS-over-HTTPS support, i.e. 7.62.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionHappyEyeballs

constexpr auto crawlservpp::Network::versionHappyEyeballs {0x073B00}
inline

libcurl version needed for the Happy Eyeballs algorithm, i.e. 7.59.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionHttp2

constexpr auto crawlservpp::Network::versionHttp2 {0x072100}
inline

libcurl version needed for HTTP/2 support, i.e. 7.33.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionHttp2Only

constexpr auto crawlservpp::Network::versionHttp2Only {0x073100}
inline

libcurl version needed for HTTP/2 ONLY support, i.e. 7.49.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionHttp2Tls

constexpr auto crawlservpp::Network::versionHttp2Tls {0x072F00}
inline

libcurl version needed for HTTP/2 OVER TLS ONLY support, i.e. 7.47.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionHttp3Only

constexpr auto crawlservpp::Network::versionHttp3Only {0x074200}
inline

libcurl version needed for HTTP/3 ONLY support, i.e. 7.66.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionPreProxy

constexpr auto crawlservpp::Network::versionPreProxy {0x073400}
inline

libcurl version needed for pre-proxy support, i.e. 7.52.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionProxySslVerify

constexpr auto crawlservpp::Network::versionProxySslVerify {0x073400}
inline

libcurl version needed for SSL verification of proxy host and peer, i.e. 7.52.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionProxyTlsAuth

constexpr auto crawlservpp::Network::versionProxyTlsAuth {0x073400}
inline

libcurl version needed for proxy TLS authentification, i.e. 7.52.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionTcpFastOpen

constexpr auto crawlservpp::Network::versionTcpFastOpen {0x073100}
inline

libcurl version needed for TCP Fast Open support, i.e. 7.49.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ versionZstd

constexpr auto crawlservpp::Network::versionZstd {0x074800}
inline

libcurl version needed for zstd encoding, i.e. 7.72.0.

Referenced by crawlservpp::Network::Curl::setConfigGlobal().

◆ xTsHeaderName

constexpr auto crawlservpp::Network::xTsHeaderName {"X-ts: "}
inline

Name of the X-ts header.

Referenced by crawlservpp::Network::Curl::headerInClass().

◆ xTsHeaderNameLen

constexpr auto crawlservpp::Network::xTsHeaderNameLen {6}
inline

Length of the X-ts header name, in bytes.

Referenced by crawlservpp::Network::Curl::headerInClass().