rippled
Loading...
Searching...
No Matches
test
beast
IPEndpointCommon.h
1
#include <xrpl/basics/random.h>
2
#include <xrpl/beast/net/IPEndpoint.h>
3
4
namespace
beast
{
5
namespace
IP {
6
7
inline
Endpoint
8
randomEP
(
bool
v4 =
true
)
9
{
10
using namespace
xrpl
;
11
auto
dv4 = []() -> AddressV4::bytes_type {
12
return
{
13
{
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
14
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
15
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
16
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX))}};
17
};
18
auto
dv6 = []() -> AddressV6::bytes_type {
19
return
{
20
{
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
21
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
22
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
23
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
24
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
25
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
26
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
27
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
28
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
29
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
30
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
31
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
32
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
33
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
34
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX)),
35
static_cast<
std::uint8_t
>
(rand_int<int>(1, UINT8_MAX))}};
36
};
37
return
Endpoint
{v4 ?
Address
{
AddressV4
{dv4()}} :
Address
{
AddressV6
{dv6()}}, rand_int<std::uint16_t>(1, UINT16_MAX)};
38
}
39
40
}
// namespace IP
41
}
// namespace beast
beast::IP::Endpoint
A version-independent IP address and port combination.
Definition
IPEndpoint.h:18
std::uint8_t
beast::IP::AddressV6
boost::asio::ip::address_v6 AddressV6
Definition
IPAddressV6.h:10
beast::IP::randomEP
Endpoint randomEP(bool v4=true)
Definition
IPEndpointCommon.h:8
beast::IP::AddressV4
boost::asio::ip::address_v4 AddressV4
Definition
IPAddressV4.h:10
beast::IP::Address
boost::asio::ip::address Address
Definition
IPAddress.h:19
beast
Definition
base_uint.h:637
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
Generated by
1.9.8