-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMullvadRelayChecker.h
More file actions
45 lines (38 loc) · 976 Bytes
/
MullvadRelayChecker.h
File metadata and controls
45 lines (38 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef MULLVAD_RELAY_CHECKER_H
#define MULLVAD_RELAY_CHECKER_H
#include <curl/curl.h>
#include <mutex>
#include <nlohmann/json.hpp>
#include <string>
#include <thread>
#include <vector>
using json = nlohmann::json;
struct ProxyInfo
{
std::string host;
int port;
};
struct TestResult
{
std::string host;
int port;
bool isWorking;
std::string details;
};
class MullvadRelayChecker
{
public:
MullvadRelayChecker();
~MullvadRelayChecker();
bool isMullvadActive();
std::vector<std::string> bulkTestProxies(unsigned int maxWorkers = 20);
void saveWorkingProxies(const std::vector<std::string> &proxies,
const std::string &filename = "proxies.txt");
private:
std::mutex resultsMutex;
std::vector<ProxyInfo> fetchProxies();
TestResult testSocks5Proxy(const ProxyInfo &proxy);
static size_t WriteCallback(void *contents, size_t size, size_t nmemb,
void *userp);
};
#endif // PROXY_CHECKER_H