| 53 | } |
| 54 | |
| 55 | bool CNetAddr::SetSpecial(const std::string &strName) |
| 56 | { |
| 57 | if (strName.size()>6 && strName.substr(strName.size() - 6, 6) == ".onion") { |
| 58 | std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str()); |
| 59 | if (vchAddr.size() != 16-sizeof(pchOnionCat)) |
| 60 | return false; |
| 61 | memcpy(ip, pchOnionCat, sizeof(pchOnionCat)); |
| 62 | for (unsigned int i=0; i<16-sizeof(pchOnionCat); i++) |
| 63 | ip[i + sizeof(pchOnionCat)] = vchAddr[i]; |
| 64 | return true; |
| 65 | } |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | CNetAddr::CNetAddr(const struct in_addr& ipv4Addr) |
| 70 | { |
no test coverage detected