-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.cpp
33 lines (29 loc) · 1.21 KB
/
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
32
33
#include "socks_server.h"
int main(int argc, char* argv[]) {
// parse command options
if (ServerParser::global_config()->parse_config_file("../config.json") !=
true) {
std::printf("bad configuration file !!!");
return EXIT_FAILURE;
}
// init log config
if (Logger::getInstance()->Init(
ServerParser::global_config()->get_log_file(),
ServerParser::global_config()->get_max_rotate_size(),
ServerParser::global_config()->get_max_rotate_count())) {
SPDLOG_INFO("Log initialization succeeded");
SPDLOG_INFO("log_file : {}",
ServerParser::global_config()->get_log_file());
SPDLOG_INFO("max_rotate_size : {} Bytes",
ServerParser::global_config()->get_max_rotate_size());
SPDLOG_INFO("max_rotate_count : {}",
ServerParser::global_config()->get_max_rotate_count());
} else {
return EXIT_FAILURE;
}
Socks5Server server(ServerParser::global_config()->get_host(),
ServerParser::global_config()->get_port(),
ServerParser::global_config()->get_thread_num());
server.start();
return EXIT_SUCCESS;
}