Molybden API
Loading...
Searching...
No Matches
proxy_config.hpp
1// Copyright (c) 2000-2024 TeamDev. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_PROXY_CONFIG_HPP
6#define MOLYBDEN_PROXY_CONFIG_HPP
7
8#include <memory>
9
10namespace molybden {
11
12class Profile;
13
17enum ProxyConfigType { kAutoDetect, kDirect, kSystem, kPac, kCustom };
18
23 public:
24 virtual ~ProxyConfig() = default;
25
39 template <class S>
40 std::shared_ptr<S> as();
41
42 protected:
43 ProxyConfig() = default;
44
48 virtual ProxyConfigType type() const = 0;
49};
50
56 public:
60 static std::shared_ptr<AutoDetectProxyConfig> create();
61};
62
67 public:
71 static std::shared_ptr<DirectProxyConfig> create();
72};
73
79 public:
83 static std::shared_ptr<SystemProxyConfig> create();
84};
85
92 public:
99 static std::shared_ptr<PacProxyConfig> create(std::string pac_url);
100
104 virtual std::string pacUrl() = 0;
105};
106
111 public:
124 static std::shared_ptr<CustomProxyConfig> create(std::string rules);
125
157 static std::shared_ptr<CustomProxyConfig> create(std::string rules,
158 std::string exceptions);
159
163 virtual std::string rules() = 0;
164
168 virtual std::string exceptions() = 0;
169};
170
171} // namespace molybden
172
173#endif // MOLYBDEN_PROXY_CONFIG_HPP
With this proxy configuration the connection automatically detects proxy settings.
Definition proxy_config.hpp:55
static std::shared_ptr< AutoDetectProxyConfig > create()
Creates an auto-detect proxy configuration.
A custom proxy settings.
Definition proxy_config.hpp:110
static std::shared_ptr< CustomProxyConfig > create(std::string rules)
Creates a custom proxy configuration based on the given rules.
virtual std::string exceptions()=0
Returns the proxy exceptions or an empty string if there are no exceptions.
static std::shared_ptr< CustomProxyConfig > create(std::string rules, std::string exceptions)
Creates a custom proxy configuration based on the given rules and exceptions.
virtual std::string rules()=0
The proxy rules.
With this proxy configuration the connection does not use a proxy server.
Definition proxy_config.hpp:66
static std::shared_ptr< DirectProxyConfig > create()
Creates a direct proxy configuration.
With this proxy configuration the connection uses proxy settings received from proxy auto-config (PAC...
Definition proxy_config.hpp:91
virtual std::string pacUrl()=0
Returns the URL address of the PAC file.
static std::shared_ptr< PacProxyConfig > create(std::string pac_url)
Creates a proxy configuration based on the PAC file located at the given PAC URL.
An interface that all proxy config implementations must extend.
Definition proxy_config.hpp:22
virtual ProxyConfigType type() const =0
Returns the current proxy config type.
std::shared_ptr< S > as()
Casts this proxy configuration to the target type.
With this proxy configuration the connection uses the operating system proxy settings.
Definition proxy_config.hpp:78
static std::shared_ptr< SystemProxyConfig > create()
Creates a system proxy configuration.