|
|
|
@ -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 |
|
|
|
|
|