MCPcopy Create free account
hub / github.com/ElementsProject/elements / ToStringIP

Method ToStringIP

src/netaddress.cpp:608–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608std::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
631std::string CNetAddr::ToString() const
632{

Callers 5

ConnectMethod · 0.80
ConnectNodeMethod · 0.80
FUZZ_TARGETFunction · 0.80
getnodeaddressesFunction · 0.80

Calls 4

IPv4ToStringFunction · 0.85
IPv6ToStringFunction · 0.85
OnionToStringFunction · 0.85
EncodeBase32Function · 0.85

Tested by 1

FUZZ_TARGETFunction · 0.64