1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Rename add_braces -> ipv6_brackets

"Braces" seemed misleading as usually that terms refers to `{}` rather
than `[]`, and also this only affects ipv6 addresses.
This commit is contained in:
Jason Rhinelander 2023-05-29 18:45:16 -03:00
parent fc050b3a09
commit ab606c48d4
No known key found for this signature in database
GPG key ID: C4992CE7A88D4262
2 changed files with 5 additions and 3 deletions

View file

@ -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());

View file

@ -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