mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-17 12:51: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
|
@ -51,7 +51,16 @@ namespace i2p
|
|||
port = rand () % (30777 - 9111) + 9111; // I2P network ports range
|
||||
bool ipv4; i2p::config::GetOption("ipv4", ipv4);
|
||||
bool ipv6; i2p::config::GetOption("ipv6", ipv6);
|
||||
std::string host = i2p::util::config::GetHost(ipv4, ipv6);
|
||||
bool nat; i2p::config::GetOption("nat", nat);
|
||||
std::string ifname; i2p::config::GetOption("ifname", ifname);
|
||||
std::string host = ipv6 ? "::" : "127.0.0.1";
|
||||
if (nat) {
|
||||
if (!i2p::config::IsDefault("host"))
|
||||
i2p::config::GetOption("host", host);
|
||||
} else if (!ifname.empty()) {
|
||||
/* bind to interface, we have no NAT so set external address too */
|
||||
host = i2p::util::net::GetInterfaceAddress(ifname, ipv6).to_string();
|
||||
}
|
||||
routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ());
|
||||
routerInfo.AddNTCPAddress (host.c_str(), port);
|
||||
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue