| 606 | } |
| 607 | |
| 608 | std::string CNetAddr::ToStringIP() const |
| 609 | { |
| 610 | switch (m_net) { |
| 611 | case NET_IPV4: |
| 612 | return IPv4ToString(m_addr); |
| 613 | case NET_IPV6: |
| 614 | return IPv6ToString(m_addr, m_scope_id); |
| 615 | case NET_ONION: |
| 616 | return OnionToString(m_addr); |
| 617 | case NET_I2P: |
| 618 | return EncodeBase32(m_addr, false /* don't pad with = */) + ".b32.i2p"; |
| 619 | case NET_CJDNS: |
| 620 | return IPv6ToString(m_addr, 0); |
| 621 | case NET_INTERNAL: |
| 622 | return EncodeBase32(m_addr) + ".internal"; |
| 623 | case NET_UNROUTABLE: // m_net is never and should not be set to NET_UNROUTABLE |
| 624 | case NET_MAX: // m_net is never and should not be set to NET_MAX |
| 625 | assert(false); |
| 626 | } // no default case, so the compiler can warn about missing cases |
| 627 | |
| 628 | assert(false); |
| 629 | } |
| 630 | |
| 631 | std::string CNetAddr::ToString() const |
| 632 | { |