Molybden API
Loading...
Searching...
No Matches
molybden::CustomProxyConfig Class Referenceabstract

A custom proxy settings. More...

#include <proxy_config.hpp>

Inheritance diagram for molybden::CustomProxyConfig:
molybden::ProxyConfig

Public Member Functions

virtual std::string rules ()=0
 The proxy rules.
 
virtual std::string exceptions ()=0
 Returns the proxy exceptions or an empty string if there are no exceptions.
 
- Public Member Functions inherited from molybden::ProxyConfig
template<class S >
std::shared_ptr< S > as ()
 Casts this proxy configuration to the target type.
 

Static Public Member Functions

static std::shared_ptr< CustomProxyConfigcreate (std::string rules)
 Creates a custom proxy configuration based on the given rules.
 
static std::shared_ptr< CustomProxyConfigcreate (std::string rules, std::string exceptions)
 Creates a custom proxy configuration based on the given rules and exceptions.
 

Additional Inherited Members

- Protected Member Functions inherited from molybden::ProxyConfig
virtual ProxyConfigType type () const =0
 Returns the current proxy config type.
 

Detailed Description

A custom proxy settings.

Member Function Documentation

◆ create() [1/2]

static std::shared_ptr< CustomProxyConfig > molybden::CustomProxyConfig::create ( std::string  rules)
static

Creates a custom proxy configuration based on the given rules.

The examples of the proxy rules:

  • The "http=foopy:80;ftp=foopy2" rule means use HTTP proxy "foopy:80" for http:// URLs, and HTTP proxy "foopy2:80" for ftp:// URLs.
  • The "foopy:80" rule means use HTTP proxy "foopy:80" for all URLs.
  • The "socks4://foopy" rule means use SOCKS v4 proxy "foopy:1080" for all URLs.
Parameters
rulesthe proxy rules in the required format.

◆ create() [2/2]

static std::shared_ptr< CustomProxyConfig > molybden::CustomProxyConfig::create ( std::string  rules,
std::string  exceptions 
)
static

Creates a custom proxy configuration based on the given rules and exceptions.

The examples of the proxy rules:

  • The "http=foopy:80;ftp=foopy2" rule means use HTTP proxy "foopy:80" for http:// URLs, and HTTP proxy "foopy2:80" for ftp:// URLs.
  • The "foopy:80" rule means use HTTP proxy "foopy:80" for all URLs.
  • The "socks4://foopy" rule means use SOCKS v4 proxy "foopy:1080" for all URLs.

The format of the exceptions can be any of the following:

  • [ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ], e.g. "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99".
  • "." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ], e.g. ".google.com", ".com", "http://.google.com".
  • [ SCHEME "://" ] IP_LITERAL [ ":" PORT ], e.g. "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99".
  • IP_LITERAL "/" PREFIX_LENGHT_IN_BITS, e.g. "192.168.1.1/16", "fefe:13::abc/33".
  • "<local>". Match local addresses. The meaning of "<local>" is whether the host matches one of: "127.0.0.1", "::1", "localhost".

If you need to provide several exception rules you can separate them using comma: "*foobar.com,.google.com,<local>".

Parameters
rulesthe proxy rules in the required format.
exceptionsthe proxy exceptions in the required format.

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