Files
stvpn/tservice.hpp
Олег Бородин 46e1193cb2 working commit
2026-05-20 18:32:34 +02:00

39 lines
811 B
C++

#ifndef TSERVICE_HPP
#define TSERVICE_HPP
#include <expected>
#include <string>
#include <vector>
#include <sockhand.hpp>
class TunNetwork {
public:
TunNetwork(std::string iladdr, std::string iraddr);
std::string laddr;
std::string raddr;
bool used;
};
class TunService {
private:
std::string tunnelnet;
std::vector<std::string> localnets;
std::vector<TunNetwork> tunnets;
int listenport;
int sock;
public:
explicit TunService(int port, std::string tunnelnet, std::vector<std::string> localnets);
std::expected<void, std::string> Init(void);
std::expected<void, std::string> Bind(void);
std::expected<void, std::string> Listen(void);
void Handle(int sock);
~TunService();
};
#endif