-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.cpp
More file actions
26 lines (25 loc) · 796 Bytes
/
server.cpp
File metadata and controls
26 lines (25 loc) · 796 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
#ifdef TCPSERVER
#include "tcpServer.h"
#else
#include "udpServer.h"
#endif
#include "connectionManager.h"
#include "config.h"
int main() {
config::instance().init("./config/server.json");
int remotePort=config::instance().json["remotePort"].toInt();
int remoteProxyPort=config::instance().json["remoteProxyPort"].toInt();
safeQueue<std::promise<int>> connections;
std::thread manageThread([&](){
connectionManager manager(remotePort);
manager.doManage(config::instance().json["password"].toString(),connections);
});
#ifdef TCPSERVER
tcpServer server(remoteProxyPort);
server.doProxy(connections,tcpServer::SERVER);
#else
udpServer server(remoteProxyPort);
server.doProxy(connections,udpServer::SERVER);
#endif
manageThread.join();
}