Commit 570c8886 authored by 神楽坂玲奈's avatar 神楽坂玲奈

new

parent 3757850c
Pipeline #16667 failed with stages
in 1 minute and 3 seconds
......@@ -3,7 +3,7 @@ project(tun)
set(CMAKE_CXX_STANDARD 23)
add_executable(tun src/main.cpp src/Router.h)
add_executable(tun src/main.cpp)
set(CMAKE_CXX_FLAGS_DEBUG -ggdb)
......
......@@ -17,27 +17,14 @@ struct ConfigRouter {
std::string endpoint;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ConfigRouter, remote_id, proto, mark, family, remote_secret, dev, up, endpoint);
struct Config {
unsigned char local_id;
std::string local_secret;
std::vector<ConfigRouter> routers;
};
void from_json(const json &j, ConfigRouter &p) {
j.at("remote_id").get_to(p.remote_id);
j.at("proto").get_to(p.proto);
j.at("mark").get_to(p.mark);
j.at("family").get_to(p.family);
j.at("remote_secret").get_to(p.remote_secret);
j.at("dev").get_to(p.dev);
j.at("up").get_to(p.up);
j.at("endpoint").get_to(p.endpoint);
}
void from_json(const json &j, Config &p) {
j.at("local_id").get_to(p.local_id);
j.at("local_secret").get_to(p.local_secret);
j.at("routers").get_to(p.routers);
}
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Config, local_id, local_secret, routers);
#endif //TUN_CONFIG_H
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment