mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
* move i2p::util::config::GetHost to RouterContext.cpp
This commit is contained in:
parent
b7c5e3b5d5
commit
26be0c7c82
3 changed files with 10 additions and 35 deletions
27
util.cpp
27
util.cpp
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue