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