Rename `add_braces` -> `ipv6_brackets`

"Braces" seemed misleading as usually that terms refers to `{}` rather
than `[]`, and also this only affects ipv6 addresses.
pull/2180/head
Jason Rhinelander 12 months ago
parent fc050b3a09
commit ab606c48d4
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262

@ -290,7 +290,7 @@ namespace llarp
} }
std::string std::string
SockAddr::hostString(bool add_braces) const SockAddr::hostString(bool ipv6_brackets) const
{ {
std::array<char, 128> buf{}; std::array<char, 128> buf{};
if (isIPv4()) if (isIPv4())
@ -301,7 +301,7 @@ namespace llarp
} }
inet_ntop(AF_INET6, &m_addr.sin6_addr.s6_addr, buf.data(), buf.size()); inet_ntop(AF_INET6, &m_addr.sin6_addr.s6_addr, buf.data(), buf.size());
if (not add_braces) if (not ipv6_brackets)
return buf.data(); return buf.data();
return fmt::format("[{}]", buf.data()); return fmt::format("[{}]", buf.data());

@ -86,8 +86,10 @@ namespace llarp
std::string std::string
ToString() const; ToString() const;
/// convert ip address to string; ipv6_brackets - if true or omitted we add [...] around the
/// IPv6 address, otherwise we return it bare.
std::string std::string
hostString(bool add_braces = true) const; hostString(bool ipv6_brackets = true) const;
inline int inline int
Family() const Family() const

Loading…
Cancel
Save