working commit
This commit is contained in:
+14
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user