2013-12-10 13:05:42 +00:00
|
|
|
#include <iostream>
|
2014-01-12 19:35:51 +00:00
|
|
|
#include <thread>
|
2013-12-10 13:05:42 +00:00
|
|
|
#include <cryptopp/integer.h>
|
2014-02-01 03:09:55 +00:00
|
|
|
#include <boost/filesystem.hpp>
|
2013-12-10 13:05:42 +00:00
|
|
|
#include "Log.h"
|
|
|
|
#include "base64.h"
|
|
|
|
#include "Transports.h"
|
|
|
|
#include "NTCPSession.h"
|
|
|
|
#include "RouterInfo.h"
|
|
|
|
#include "RouterContext.h"
|
|
|
|
#include "Tunnel.h"
|
|
|
|
#include "NetDb.h"
|
|
|
|
#include "HTTPServer.h"
|
2014-01-30 00:56:48 +00:00
|
|
|
#include "util.h"
|
2013-12-10 13:05:42 +00:00
|
|
|
|
2014-01-30 00:56:48 +00:00
|
|
|
int main( int argc, char* argv[] )
|
2013-12-10 13:05:42 +00:00
|
|
|
{
|
2014-02-01 03:09:55 +00:00
|
|
|
i2p::util::config::OptionParser(argc,argv);
|
2014-01-25 06:58:11 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
setlocale(LC_CTYPE, "");
|
|
|
|
SetConsoleCP(1251);
|
|
|
|
SetConsoleOutputCP(1251);
|
|
|
|
setlocale(LC_ALL, "Russian");
|
|
|
|
#endif
|
|
|
|
|
2014-02-01 03:09:55 +00:00
|
|
|
LogPrint("\n\n\n\ni2pd starting\n");
|
2014-02-01 03:51:58 +00:00
|
|
|
LogPrint("data directory: ", i2p::util::filesystem::GetDataDir().string());
|
2014-02-01 03:09:55 +00:00
|
|
|
i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs);
|
|
|
|
|
2014-01-31 00:39:16 +00:00
|
|
|
//TODO: This is an ugly workaround. fix it.
|
|
|
|
//TODO: Autodetect public IP.
|
2014-02-01 03:09:55 +00:00
|
|
|
i2p::context.OverrideNTCPAddress(i2p::util::config::GetCharArg("-host", "127.0.0.1"),
|
|
|
|
i2p::util::config::GetArg("-port", 17070));
|
|
|
|
int httpport = i2p::util::config::GetArg("-httpport", 7070);
|
2014-01-30 00:56:48 +00:00
|
|
|
|
|
|
|
i2p::util::HTTPServer httpServer (httpport);
|
2013-12-10 13:05:42 +00:00
|
|
|
|
|
|
|
httpServer.Start ();
|
|
|
|
i2p::data::netdb.Start ();
|
|
|
|
i2p::transports.Start ();
|
|
|
|
i2p::tunnel::tunnels.Start ();
|
|
|
|
|
2014-01-12 19:35:51 +00:00
|
|
|
std::this_thread::sleep_for (std::chrono::seconds(10000));
|
2013-12-10 13:05:42 +00:00
|
|
|
i2p::tunnel::tunnels.Stop ();
|
|
|
|
i2p::transports.Stop ();
|
|
|
|
i2p::data::netdb.Stop ();
|
|
|
|
httpServer.Stop ();
|
|
|
|
return 0;
|
|
|
|
}
|