aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Loading...
Searching...
No Matches
Socks5.h
Go to the documentation of this file.
1#pragma once
2
9
10#include <chrono>
11
12struct aws_socks5_proxy_negotiation_strategy;
13
14namespace Aws
15{
16 namespace Crt
17 {
18 namespace Io
19 {
20 class Socks5ProxyOptions;
21
28 {
29 public:
37 {
38 m_username = std::move(username);
39 return *this;
40 }
41
49 {
50 m_password = std::move(password);
51 return *this;
52 }
53
59 const ManagedByteBuffer &getUsername() const noexcept { return m_username; }
60
66 const ManagedByteBuffer &getPassword() const noexcept { return m_password; }
67
68 private:
69 ManagedByteBuffer m_username;
70 ManagedByteBuffer m_password;
71 };
72
78 {
79 public:
80 Socks5ProxyNegotiationStrategy() noexcept = delete;
83 Socks5ProxyNegotiationStrategy &operator=(const Socks5ProxyNegotiationStrategy &rhs) noexcept = delete;
85
87
95 static std::shared_ptr<Socks5ProxyNegotiationStrategy> newStrategyNoAuth(
96 Allocator *allocator = ApiAllocator());
97
106 static std::shared_ptr<Socks5ProxyNegotiationStrategy> newStrategyBasicAuth(
107 const Socks5BasicAuthOptions &options,
108 Allocator *allocator = ApiAllocator());
109
117 struct aws_socks5_proxy_negotiation_strategy *get() const { return m_strategy; }
118
119 private:
120 Socks5ProxyNegotiationStrategy(struct aws_socks5_proxy_negotiation_strategy *strategy) noexcept;
121
122 struct aws_socks5_proxy_negotiation_strategy *m_strategy;
123 };
124
129 {
130 public:
139 const Aws::Crt::String &proxyHost,
140 uint16_t proxyPort,
141 std::shared_ptr<Socks5ProxyNegotiationStrategy> strategy) noexcept;
142 Socks5ProxyOptions(const Socks5ProxyOptions &rhs) noexcept;
144 Socks5ProxyOptions &operator=(const Socks5ProxyOptions &rhs);
145 Socks5ProxyOptions &operator=(Socks5ProxyOptions &&rhs) noexcept;
146
153 Socks5ProxyOptions &withTimeout(std::chrono::milliseconds timeout) noexcept;
154
160 const Aws::Crt::String &proxyHost() const noexcept { return m_proxyHost; }
161
167 uint16_t proxyPort() const noexcept { return m_proxyPort; }
168
174 std::shared_ptr<Socks5ProxyNegotiationStrategy> strategy() const noexcept { return m_strategy; }
175
181 std::chrono::milliseconds timeout() const noexcept { return m_timeout; }
182
183 private:
184 Aws::Crt::String m_proxyHost;
185 uint16_t m_proxyPort;
186
187 std::shared_ptr<Socks5ProxyNegotiationStrategy> m_strategy;
188
189 std::chrono::milliseconds m_timeout;
190 };
191
192 } // namespace Io
193 } // namespace Crt
194} // namespace Aws
#define AWS_CRT_CPP_API
Definition Exports.h:36
const ManagedByteBuffer & getPassword() const noexcept
Definition Socks5.h:66
Socks5BasicAuthOptions & withPassword(ManagedByteBuffer password) noexcept
Definition Socks5.h:48
const ManagedByteBuffer & getUsername() const noexcept
Definition Socks5.h:59
Socks5BasicAuthOptions & withUsername(ManagedByteBuffer username) noexcept
Definition Socks5.h:36
Definition Socks5.h:129
uint16_t proxyPort() const noexcept
Definition Socks5.h:167
const Aws::Crt::String & proxyHost() const noexcept
Definition Socks5.h:160
std::chrono::milliseconds timeout() const noexcept
Definition Socks5.h:181
std::shared_ptr< Socks5ProxyNegotiationStrategy > strategy() const noexcept
Definition Socks5.h:174
Definition ByteBufUtils.h:24
aws_allocator Allocator
Definition Allocator.h:14
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition Types.h:45
Definition Allocator.h:11
Definition StringView.h:862