working commit

This commit is contained in:
Олег Бородин
2026-05-20 16:32:06 +02:00
parent 4bed66d2bb
commit 0d37d45543
2 changed files with 13 additions and 5 deletions
+5 -5
View File
@@ -75,16 +75,16 @@ std::expected<void, std::string> TunService::Listen(void) {
void TunService::Handle(int sock) {
auto prefixRes = netprefix(tunnelnet);
if (!prefixRes) {
uxlogger.Error(prefixRes.error());
return;
}
auto networkRes = network(tunnelnet);
if (!networkRes) {
uxlogger.Error(networkRes.error());
return;
}
auto prefixRes = netprefix(tunnelnet);
if (!prefixRes) {
uxlogger.Error(prefixRes.error());
return;
}
int num = (sock - 3);
auto localaddrRes = nethost(networkRes.value(), prefixRes.value(), num);
if (!networkRes) {
+8
View File
@@ -8,12 +8,20 @@
#include <sockhand.hpp>
class ClientSlot {
private:
bool free;
int num;
};
class TunService {
private:
std::string tunnelnet;
std::vector<std::string> localnets;
int listenport;
int sock;
std::vector<ClientSlot> clientSlots;
public:
explicit TunService(int port, std::string tunnelnet, std::vector<std::string> localnets);
std::expected<void, std::string> Bind(void);