* move i2p::util::config::GetHost to RouterContext.cpp

This commit is contained in:
hagen 2016-07-19 00:00:00 +00:00
parent b7c5e3b5d5
commit 26be0c7c82
3 changed files with 10 additions and 35 deletions

View file

@ -7,7 +7,6 @@
#include <set>
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include "Config.h"
#include "util.h"
#include "Log.h"
@ -460,31 +459,5 @@ namespace net
#endif
}
}
namespace config
{
std::string GetHost(bool ipv4, bool ipv6)
{
std::string host;
if(ipv6)
host = "::";
else if(ipv4)
host = "127.0.0.1";
bool nat; i2p::config::GetOption("nat", nat);
if (nat)
{
if (!i2p::config::IsDefault("host"))
i2p::config::GetOption("host", host);
}
else
{
// we are not behind nat
std::string ifname; i2p::config::GetOption("ifname", ifname);
if (ifname.size())
host = i2p::util::net::GetInterfaceAddress(ifname, ipv6).to_string(); // bind to interface, we have no NAT so set external address too
}
return host;
}
} // config
} // util
} // i2p