-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathkcptun_server_main.cpp
31 lines (30 loc) · 1 KB
/
kcptun_server_main.cpp
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
#include "encrypt.h"
#include "kcptun_server.h"
#include "local.h"
#include "server.h"
int main(int argc, char **argv) {
gflags::SetUsageMessage("usage: kcptun_server");
parse_command_lines(argc, argv);
asio::io_service io_service;
asio::ip::udp::endpoint local_endpoint;
asio::ip::tcp::endpoint target_endpoint;
{
asio::ip::udp::resolver resolver(io_service);
local_endpoint = asio::ip::udp::endpoint(*resolver.resolve(
{get_host(FLAGS_localaddr), get_port(FLAGS_localaddr)}));
}
{
asio::ip::tcp::resolver resolver(io_service);
target_endpoint = asio::ip::tcp::endpoint(*resolver.resolve(
{get_host(FLAGS_targetaddr), get_port(FLAGS_targetaddr)}));
}
std::make_shared<kcptun_server>(io_service, local_endpoint, target_endpoint)
->run();
if (FLAGS_kvar) {
run_kvar_printer(io_service);
}
io_service.run();
gflags::ShutDownCommandLineFlags();
google::ShutdownGoogleLogging();
return 0;
}