i2pdtunnelwizard/main.cpp

41 lines
963 B
C++

// acetone, 2025
// I hate copyright of any kind. This is a public domain.
// Original source: http://git.community.i2p/acetone/i2pdtunnelwizard
#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;
HttpServer server(address, port);
try {
server.run();
} catch (std::exception& e) {
std::cerr << "Server failure: " << e.what() << std::endl;
return 1;
}
return 0;
}