| 578 | } |
| 579 | |
| 580 | std::string CNetAddr::ToStringAddr() const |
| 581 | { |
| 582 | switch (m_net) { |
| 583 | case NET_IPV4: |
| 584 | return IPv4ToString(m_addr); |
| 585 | case NET_IPV6: |
| 586 | return IPv6ToString(m_addr, m_scope_id); |
| 587 | case NET_ONION: |
| 588 | return OnionToString(m_addr); |
| 589 | case NET_I2P: |
| 590 | return EncodeBase32(m_addr, false /* don't pad with = */) + ".b32.i2p"; |
| 591 | case NET_CJDNS: |
| 592 | return IPv6ToString(m_addr, 0); |
| 593 | case NET_INTERNAL: |
| 594 | return EncodeBase32(m_addr) + ".internal"; |
| 595 | case NET_UNROUTABLE: // m_net is never and should not be set to NET_UNROUTABLE |
| 596 | case NET_MAX: // m_net is never and should not be set to NET_MAX |
| 597 | assert(false); |
| 598 | } // no default case, so the compiler can warn about missing cases |
| 599 | |
| 600 | assert(false); |
| 601 | } |
| 602 | |
| 603 | bool operator==(const CNetAddr& a, const CNetAddr& b) |
| 604 | { |