mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02: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:
parent
562f320198
commit
3ad196c4c7
5 changed files with 41 additions and 42 deletions
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue