MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / SetSpecial

Method SetSpecial

src/netbase.cpp:570–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568static const unsigned char pchOnionCat[] = {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43};
569
570bool CNetAddr::SetSpecial(const string& strName) {
571 if (strName.size() > 6 && strName.substr(strName.size() - 6, 6) == ".onion") {
572 vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str());
573 if (vchAddr.size() != 16 - sizeof(pchOnionCat))
574 return false;
575 memcpy(ip, pchOnionCat, sizeof(pchOnionCat));
576 for (unsigned int i = 0; i < 16 - sizeof(pchOnionCat); i++)
577 ip[i + sizeof(pchOnionCat)] = vchAddr[i];
578 return true;
579 }
580 return false;
581}
582
583CNetAddr::CNetAddr() { Init(); }
584

Callers 1

LookupInternFunction · 0.80

Calls 3

DecodeBase32Function · 0.85
memcpyFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected