|
|
@ -142,34 +142,46 @@ namespace i2p
|
|
|
|
i2p::context.SetAcceptsTunnels (!transit);
|
|
|
|
i2p::context.SetAcceptsTunnels (!transit);
|
|
|
|
|
|
|
|
|
|
|
|
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
|
|
|
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
|
|
|
char bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
|
|
|
if (isFloodfill) {
|
|
|
|
|
|
|
|
|
|
|
|
if (isFloodfill)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
|
|
|
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
|
|
|
i2p::context.SetFloodfill (true);
|
|
|
|
i2p::context.SetFloodfill (true);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
i2p::context.SetFloodfill (false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* this section also honors 'floodfill' flag, if set above */
|
|
|
|
|
|
|
|
std::string bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
|
|
|
|
|
|
|
if (bandwidth.length () > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (bandwidth[0] >= 'K' && bandwidth[0] <= 'X')
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
i2p::context.SetBandwidth (bandwidth[0]);
|
|
|
|
|
|
|
|
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
i2p::context.SetFloodfill (false);
|
|
|
|
|
|
|
|
if (bandwidth != '-')
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogPrint(eLogInfo, "Daemon: bandwidth set to ", bandwidth);
|
|
|
|
auto value = std::atoi(bandwidth.c_str());
|
|
|
|
if (bandwidth > 'O')
|
|
|
|
if (value > 0)
|
|
|
|
i2p::context.SetExtraBandwidth ();
|
|
|
|
{
|
|
|
|
else if (bandwidth > 'L')
|
|
|
|
i2p::context.SetBandwidth (value);
|
|
|
|
i2p::context.SetHighBandwidth ();
|
|
|
|
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
i2p::context.SetLowBandwidth ();
|
|
|
|
{
|
|
|
|
|
|
|
|
LogPrint(eLogInfo, "Daemon: unexpected bandwidth ", bandwidth, ". Set to 'low'");
|
|
|
|
|
|
|
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isFloodfill)
|
|
|
|
else if (isFloodfill)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
|
|
|
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
|
|
|
i2p::context.SetExtraBandwidth ();
|
|
|
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
|
|
|
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
|
|
|
i2p::context.SetLowBandwidth ();
|
|
|
|
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string family; i2p::config::GetOption("family", family);
|
|
|
|
std::string family; i2p::config::GetOption("family", family);
|
|
|
|