mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
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:
25
util.cpp
25
util.cpp
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user