Commit b608bc36 authored by 神楽坂玲奈's avatar 神楽坂玲奈

new

parent 87a89fc4
Pipeline #16669 passed with stages
in 45 seconds
...@@ -3,7 +3,7 @@ project(tun) ...@@ -3,7 +3,7 @@ project(tun)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
add_executable(tun src/main.cpp) add_executable(tun src/Config.h src/Router.h src/checksum.h src/main.cpp)
set(CMAKE_CXX_FLAGS_DEBUG -ggdb) set(CMAKE_CXX_FLAGS_DEBUG -ggdb)
...@@ -13,5 +13,5 @@ target_link_libraries(tun Threads::Threads) ...@@ -13,5 +13,5 @@ target_link_libraries(tun Threads::Threads)
find_package(nlohmann_json REQUIRED) find_package(nlohmann_json REQUIRED)
target_link_libraries(tun nlohmann_json::nlohmann_json) target_link_libraries(tun nlohmann_json::nlohmann_json)
find_package(Boost REQUIRED) set(Boost_USE_STATIC_LIBS ON)
target_link_libraries(tun Boost) find_package(Boost REQUIRED)
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#include "Config.h" #include "Config.h"
#include <boost/core/noncopyable.hpp> #include <boost/core/noncopyable.hpp>
#include <netdb.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_tun.h> #include <linux/if_tun.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <boost/beast/core/detail/base64.hpp> #include <boost/beast/core/detail/base64.hpp>
#include <netdb.h>
class Router : private boost::noncopyable { class Router : private boost::noncopyable {
public: public:
...@@ -92,4 +92,8 @@ public: ...@@ -92,4 +92,8 @@ public:
} }
}; };
std::map<int, Router *> Router::all = {};
std::map<std::pair<unsigned char, unsigned char>, int> Router::raws = {};
unsigned char Router::local_secret[Router::secret_length] = {};
#endif #endif
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <sys/socket.h> #include <sys/socket.h>
#include <linux/ip.h>
#include <linux/if_tun.h> #include <linux/if_tun.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
#include <nlohmann/json.hpp>
#include <linux/ipv6.h>
#include <vector>
#include <linux/ip.h>
#include "checksum.h" #include "checksum.h"
#include "Config.h" #include "Config.h"
#include "Router.h" #include "Router.h"
#include <linux/ipv6.h>
using json = nlohmann::json; using json = nlohmann::json;
struct Meta { struct Meta {
unsigned char src_id; unsigned char src_id;
unsigned char dst_id; unsigned char dst_id;
......
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