rippled
Loading...
Searching...
No Matches
IPAddressV6.cpp
1#include <xrpl/beast/net/IPAddressV4.h>
2#include <xrpl/beast/net/IPAddressV6.h>
3
4#include <boost/asio/ip/address_v4.hpp>
5
6namespace beast {
7namespace IP {
8
9bool
11{
12 return (
13 (addr.to_bytes()[0] & 0xfd) || // TODO fc00::/8 too ?
14 (addr.is_v4_mapped() &&
15 is_private(boost::asio::ip::make_address_v4(
16 boost::asio::ip::v4_mapped, addr))));
17}
18
19bool
20is_public(AddressV6 const& addr)
21{
22 // TODO is this correct?
23 return !is_private(addr) && !addr.is_multicast();
24}
25
26} // namespace IP
27} // namespace beast
boost::asio::ip::address_v6 AddressV6
Definition IPAddressV6.h:11
bool is_public(Address const &addr)
Returns true if the address is a public routable address.
Definition IPAddress.h:59
bool is_private(Address const &addr)
Returns true if the address is a private unroutable address.
Definition IPAddress.h:52