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