| 631 | static const unsigned char pchOnionCat[] = {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43}; |
| 632 | |
| 633 | bool 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 | |
| 647 | CNetAddr::CNetAddr() |
| 648 | { |
no test coverage detected