working commit

This commit is contained in:
2026-04-22 14:26:33 +02:00
parent e9a527b5de
commit fb080285c6
23 changed files with 1198 additions and 1739 deletions
+1 -34
View File
@@ -14,15 +14,8 @@ extern "C" {
#include <tunnel.hpp>
#include <service.hpp>
#include <server.hpp>
using namespace std::chrono_literals;
class Server {
private:
Interface iface;
public:
std::expected<void, std::string> Create(const std::string name, const std::string addr, const int prefix);
};
std::expected<void, std::string> Server::Create(const std::string name, const std::string addr, const int prefix) {
auto createres = iface.Create(name);
@@ -44,29 +37,3 @@ std::expected<void, std::string> Server::Create(const std::string name, const st
return {};
}
int main(int argc, char** argv) {
#if 0
Service svc(1025);
auto bindres = svc.Bind();
if (!bindres) {
std::cerr << bindres.error() << std::endl;
return 1;
}
Handler handler;
auto listres = svc.Listen(&handler);
if (!listres) {
std::cerr << listres.error() << std::endl;
return 1;
}
#endif
Server srv;
auto createres = srv.Create("tun10", "10.1.2.1", 30);
if (!createres) {
std::cerr << "Error: " << createres.error() << std::endl;
return 1;
}
std::chrono::milliseconds timesleep(20s);
std::this_thread::sleep_for(timesleep);
return 0;
}