aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2023-02-07 15:13:21 +0100
committerVasil Dimov <vd@FreeBSD.org>2023-10-05 15:10:34 +0200
commit53afa68026ffa1313ae4aba3664de7791d23b1c8 (patch)
tree273b7bbf1d5491e8e219c9946ec35ee2635b8dd0 /src
parent6e308651c441cbf8763c67cc099c538c333c2872 (diff)
net: move MaybeFlipIPv6toCJDNS() from net to netbase
It need not be in the `net` module and we need to call it from `LookupSubNet()`, thus move it to `netbase`.
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp16
-rw-r--r--src/net.h2
-rw-r--r--src/netbase.cpp9
-rw-r--r--src/netbase.h9
4 files changed, 18 insertions, 18 deletions
diff --git a/src/net.cpp b/src/net.cpp
index d20d185e27..cc4c676822 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -269,22 +269,6 @@ std::optional<CService> GetLocalAddrForPeer(CNode& node)
return std::nullopt;
}
-/**
- * If an IPv6 address belongs to the address range used by the CJDNS network and
- * the CJDNS network is reachable (-cjdnsreachable config is set), then change
- * the type from NET_IPV6 to NET_CJDNS.
- * @param[in] service Address to potentially convert.
- * @return a copy of `service` either unmodified or changed to CJDNS.
- */
-CService MaybeFlipIPv6toCJDNS(const CService& service)
-{
- CService ret{service};
- if (ret.IsIPv6() && ret.HasCJDNSPrefix() && g_reachable_nets.Contains(NET_CJDNS)) {
- ret.m_net = NET_CJDNS;
- }
- return ret;
-}
-
// learn a new local address
bool AddLocal(const CService& addr_, int nScore)
{
diff --git a/src/net.h b/src/net.h
index 9a517ac332..b6095ec53b 100644
--- a/src/net.h
+++ b/src/net.h
@@ -166,8 +166,6 @@ void RemoveLocal(const CService& addr);
bool SeenLocal(const CService& addr);
bool IsLocal(const CService& addr);
CService GetLocalAddress(const CNode& peer);
-CService MaybeFlipIPv6toCJDNS(const CService& service);
-
extern bool fDiscover;
extern bool fListen;
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 16b5e1c70d..09b8a606b6 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -774,3 +774,12 @@ bool IsBadPort(uint16_t port)
}
return false;
}
+
+CService MaybeFlipIPv6toCJDNS(const CService& service)
+{
+ CService ret{service};
+ if (ret.IsIPv6() && ret.HasCJDNSPrefix() && g_reachable_nets.Contains(NET_CJDNS)) {
+ ret.m_net = NET_CJDNS;
+ }
+ return ret;
+}
diff --git a/src/netbase.h b/src/netbase.h
index aaa5229b82..8b7da4109f 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -307,4 +307,13 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
*/
bool IsBadPort(uint16_t port);
+/**
+ * If an IPv6 address belongs to the address range used by the CJDNS network and
+ * the CJDNS network is reachable (-cjdnsreachable config is set), then change
+ * the type from NET_IPV6 to NET_CJDNS.
+ * @param[in] service Address to potentially convert.
+ * @return a copy of `service` either unmodified or changed to CJDNS.
+ */
+CService MaybeFlipIPv6toCJDNS(const CService& service);
+
#endif // BITCOIN_NETBASE_H