MCPcopy Create free account
hub / github.com/LUX-Core/lux / SetSpecial

Method SetSpecial

src/netbase.cpp:633–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631static const unsigned char pchOnionCat[] = {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43};
632
633bool CNetAddr::SetSpecial(const std::string& strName)
634{
635 if (strName.size() > 6 && strName.substr(strName.size() - 6, 6) == ".onion") {
636 std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str());
637 if (vchAddr.size() != 16 - sizeof(pchOnionCat))
638 return false;
639 memcpy(ip, pchOnionCat, sizeof(pchOnionCat));
640 for (unsigned int i = 0; i < 16 - sizeof(pchOnionCat); i++)
641 ip[i + sizeof(pchOnionCat)] = vchAddr[i];
642 return true;
643 }
644 return false;
645}
646
647CNetAddr::CNetAddr()
648{

Callers 1

LookupInternFunction · 0.80

Calls 3

DecodeBase32Function · 0.85
memcpyFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected