-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsource.cpp
More file actions
40 lines (36 loc) · 853 Bytes
/
Copy pathsource.cpp
File metadata and controls
40 lines (36 loc) · 853 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
#define ASIO_STANDALONE
#include <dark_networking/http_discovery_server.h>
#include <dark_networking/proxy.h>
int main(int argc, char* argv[])
{
uint16_t discoveryServerPort = 30000;
std::string proxyIp = "127.0.0.1";
uint16_t proxyPort = 25555;
if (argc > 1)
{
for (int i = 0; i < argc; i++)
{
std::string arg(argv[i]);
if (arg.find("discoveryPort=") != std::string::npos)
{
discoveryServerPort = std::stoi(arg.substr(14));
}
if (arg.find("ip=") != std::string::npos)
{
proxyIp = arg.substr(3);
}
else if (arg.find("port=") != std::string::npos)
{
proxyPort = std::stoi(arg.substr(5));
}
}
}
HttpDiscoveryServer discoveryServer(discoveryServerPort, proxyIp, proxyPort);
Proxy proxy(proxyPort);
proxy.start();
while(1)
{
proxy.update();
}
return 0;
}