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) {
|
void TunService::Handle(int sock) {
|
||||||
auto prefixRes = netprefix(tunnelnet);
|
|
||||||
if (!prefixRes) {
|
|
||||||
uxlogger.Error(prefixRes.error());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto networkRes = network(tunnelnet);
|
auto networkRes = network(tunnelnet);
|
||||||
if (!networkRes) {
|
if (!networkRes) {
|
||||||
uxlogger.Error(networkRes.error());
|
uxlogger.Error(networkRes.error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto prefixRes = netprefix(tunnelnet);
|
||||||
|
if (!prefixRes) {
|
||||||
|
uxlogger.Error(prefixRes.error());
|
||||||
|
return;
|
||||||
|
}
|
||||||
int num = (sock - 3);
|
int num = (sock - 3);
|
||||||
auto localaddrRes = nethost(networkRes.value(), prefixRes.value(), num);
|
auto localaddrRes = nethost(networkRes.value(), prefixRes.value(), num);
|
||||||
if (!networkRes) {
|
if (!networkRes) {
|
||||||
|
|||||||
@@ -8,12 +8,20 @@
|
|||||||
|
|
||||||
#include <sockhand.hpp>
|
#include <sockhand.hpp>
|
||||||
|
|
||||||
|
class ClientSlot {
|
||||||
|
private:
|
||||||
|
bool free;
|
||||||
|
int num;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class TunService {
|
class TunService {
|
||||||
private:
|
private:
|
||||||
std::string tunnelnet;
|
std::string tunnelnet;
|
||||||
std::vector<std::string> localnets;
|
std::vector<std::string> localnets;
|
||||||
int listenport;
|
int listenport;
|
||||||
int sock;
|
int sock;
|
||||||
|
std::vector<ClientSlot> clientSlots;
|
||||||
public:
|
public:
|
||||||
explicit TunService(int port, std::string tunnelnet, std::vector<std::string> localnets);
|
explicit TunService(int port, std::string tunnelnet, std::vector<std::string> localnets);
|
||||||
std::expected<void, std::string> Bind(void);
|
std::expected<void, std::string> Bind(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user