working commit
This commit is contained in:
+1
-34
@@ -14,15 +14,8 @@ extern "C" {
|
||||
|
||||
#include <tunnel.hpp>
|
||||
#include <service.hpp>
|
||||
#include <server.hpp>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
class Server {
|
||||
private:
|
||||
Interface iface;
|
||||
public:
|
||||
std::expected<void, std::string> Create(const std::string name, const std::string addr, const int prefix);
|
||||
};
|
||||
|
||||
std::expected<void, std::string> Server::Create(const std::string name, const std::string addr, const int prefix) {
|
||||
auto createres = iface.Create(name);
|
||||
@@ -44,29 +37,3 @@ std::expected<void, std::string> Server::Create(const std::string name, const st
|
||||
return {};
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
#if 0
|
||||
Service svc(1025);
|
||||
auto bindres = svc.Bind();
|
||||
if (!bindres) {
|
||||
std::cerr << bindres.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
Handler handler;
|
||||
auto listres = svc.Listen(&handler);
|
||||
if (!listres) {
|
||||
std::cerr << listres.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
Server srv;
|
||||
auto createres = srv.Create("tun10", "10.1.2.1", 30);
|
||||
if (!createres) {
|
||||
std::cerr << "Error: " << createres.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds timesleep(20s);
|
||||
std::this_thread::sleep_for(timesleep);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user