X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fnet.cpp;h=90824d00c53a334e82493c2b686056a22c8a4758;hb=92948780909cc9e3349409d6102dbe5adf1d5a10;hp=92201229591efd1b7ffa367f00c073d4917baff1;hpb=24b2f2d42d10153c24ccef4a14ba57ad24aac183;p=novacoin.git diff --git a/src/net.cpp b/src/net.cpp index 9220122..90824d0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -308,7 +308,7 @@ extern int GetExternalIPbySTUN(uint64_t rnd, struct sockaddr_in *mapped, const c bool GetMyExternalIP(CNetAddr& ipRet) { struct sockaddr_in mapped; - uint64_t rnd = GetRand(~0LL); + uint64_t rnd = ULLONG_MAX; const char *srv; int rc = GetExternalIPbySTUN(rnd, &mapped, &srv); if(rc >= 0) { @@ -470,8 +470,27 @@ void CNode::PushVersion() { /// when NTP implemented, change to just nTime = GetAdjustedTime() int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime()); - CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0))); - CAddress addrMe = GetLocalAddress(&addr); + CAddress addrYou, addrMe; + + bool fHidden = false; + if (addr.IsTor()) { + if (mapArgs.count("-torname")) { + // Our hidden service address + CService addrTorName(mapArgs["-torname"], GetListenPort()); + + if (addrTorName.IsValid()) { + addrYou = addr; + addrMe = CAddress(addrTorName); + fHidden = true; + } + } + } + + if (!fHidden) { + addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0))); + addrMe = GetLocalAddress(&addr); + } + RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce)); printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str()); PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe, @@ -1079,7 +1098,6 @@ void MapPort() // The second name should resolve to a list of seed addresses. static const char *strDNSSeed[][2] = { {"novacoin.karelia.pro", "dnsseed.novacoin.karelia.pro"}, - {"novacoin.su", "dnsseed.novacoin.su"}, {"novacoin.ru", "dnsseed.novacoin.ru"}, {"novacoin.ru", "testseed.novacoin.ru"}, {"novaco.in", "dnsseed.novaco.in"},