i2pdtunnelwizard/main.cpp

40 lines
893 B
C++

#include <iostream>
#include "http/httpserver.h"
#include "versionnumber.h"
void usage(char* argv0)
{
std::cout << "usage: " << argv0 << " <bind address> <bind port>" << std::endl;
}
int main(int argc, char* argv[])
{
std::cout << "i2pd tunnel wizard v" << VERSION << std::endl;
std::cout << "src: http://git.i2p/acetone/i2pdtunnelwizard" << std::endl;
if (argc < 3)
{
usage(argv[0]);
return 0;
}
const std::string address (argv[1]);
const uint16_t port (std::stoi(argv[2]));
std::cout << "web ui: http://" << address << ":" << port << std::endl;
crow::App<crow::UTF8> app;
app.loglevel(crow::LogLevel::Critical);
HttpServer server(address, port);
try {
server.run();
} catch (std::exception& e) {
std::cerr << "Server failure: " << e.what() << std::endl;
return 1;
}
return 0;
}