| 568 | static const unsigned char pchOnionCat[] = {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43}; |
| 569 | |
| 570 | bool 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 | |
| 583 | CNetAddr::CNetAddr() { Init(); } |
| 584 |
no test coverage detected