fix meshnet mode:

* don't default to ipv4 when creating router.info
* add i2p::util::config::GetHost for getting host to use from config
* proper check for no transports in Transports.cpp on startup
This commit is contained in:
Jeff Becker 2016-07-14 09:23:33 -04:00
parent 562f320198
commit 3ad196c4c7
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
5 changed files with 41 additions and 42 deletions

View file

@ -461,5 +461,30 @@ namespace net
}
}
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