working commit

This commit is contained in:
Олег Бородин
2026-05-20 17:15:26 +02:00
parent 0d37d45543
commit 3f261b0922
5 changed files with 40 additions and 14 deletions
+14 -1
View File
@@ -13,7 +13,6 @@ extern "C" {
#include <uxlogger.hpp>
#include <networkaux.hpp>
using namespace std::chrono_literals;
TunService::TunService(int svcport, std::string itunnelnet, std::vector<std::string> ilocalnets) {
listenport = svcport;
@@ -21,6 +20,20 @@ TunService::TunService(int svcport, std::string itunnelnet, std::vector<std::str
localnets = ilocalnets;
}
std::expected<void, std::string> TunService::Init(void) {
auto netprefixRes = netprefix(tunnelnet);
if (!netprefixRes) {
return std::unexpected(netprefixRes.error());
}
auto networkRes = network(tunnelnet);
if (!netprefixRes) {
return std::unexpected(networkRes.error());
};
return {};
}
TunService::~TunService() {
close(listenport);
}