119 AddressV4::bytes_type d1 = {{10, 0, 0, 1}};
121 BEAST_EXPECT(v4.to_bytes()[0] == 10);
122 BEAST_EXPECT(v4.to_bytes()[1] == 0);
123 BEAST_EXPECT(v4.to_bytes()[2] == 0);
124 BEAST_EXPECT(v4.to_bytes()[3] == 1);
126 BEAST_EXPECT((~((0xff) << 16)) == 0xff00ffff);
128 auto d2 = v4.to_bytes();
131 BEAST_EXPECT(v4.to_bytes()[0] == 10);
132 BEAST_EXPECT(v4.to_bytes()[1] == 10);
133 BEAST_EXPECT(v4.to_bytes()[2] == 0);
134 BEAST_EXPECT(v4.to_bytes()[3] == 1);
219 "2001:db8:a0b:12f0::1",
220 {{32, 01, 13, 184, 10, 11, 18, 240, 0, 0, 0, 0, 0, 0, 0, 1}},
223 "[2001:db8:a0b:12f0::1]:8",
224 {{32, 01, 13, 184, 10, 11, 18, 240, 0, 0, 0, 0, 0, 0, 0, 1}},
227 "[2001:2002:2003:2004:2005:2006:2007:2008]:65535",
228 {{32, 1, 32, 2, 32, 3, 32, 4, 32, 5, 32, 6, 32, 7, 32, 8}},
231 "2001:2002:2003:2004:2005:2006:2007:2008 65535",
232 {{32, 1, 32, 2, 32, 3, 32, 4, 32, 5, 32, 6, 32, 7, 32, 8}},
234 "[2001:2002:2003:2004:2005:2006:2007:2008]:65535");
238 AddressV4::bytes_type d = {{127, 0, 0, 1}};
245 BEAST_EXPECT(
to_string(ep) ==
"127.0.0.1:80");
248 boost::asio::ip::make_address_v6(
249 boost::asio::ip::v4_mapped,
AddressV4{d}),
260 BEAST_EXPECT(
get_class(ep.to_v4()) ==
'A');
266 BEAST_EXPECT(
to_string(ep) ==
"10.0.0.1");
268 ep =
Endpoint(boost::asio::ip::make_address_v6(
269 boost::asio::ip::v4_mapped,
AddressV4{d}));
271 get_class(boost::asio::ip::make_address_v4(
272 boost::asio::ip::v4_mapped, ep.to_v6())) ==
'A');
280 d = {{166, 78, 151, 147}};
287 BEAST_EXPECT(
to_string(ep) ==
"166.78.151.147");
289 ep =
Endpoint(boost::asio::ip::make_address_v6(
290 boost::asio::ip::v4_mapped,
AddressV4{d}));
299 AddressV6::bytes_type d2 = {
300 {253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}};
316 BEAST_EXPECT(ep.address() == ep1.address());
317 BEAST_EXPECT(ep1.port() == 2016);
321 BEAST_EXPECT(ep.address() == ep2.address());
322 BEAST_EXPECT(ep2.port() == 2016);
323 BEAST_EXPECT(ep1 == ep2);
327 BEAST_EXPECT(ep.address() == ep3.address());
328 BEAST_EXPECT(ep3.port() == 2016);
329 BEAST_EXPECT(ep2 == ep3);
333 BEAST_EXPECT(ep.address() == ep4.address());
334 BEAST_EXPECT(ep4.port() == 2016);
335 BEAST_EXPECT(ep3 == ep4);
345 BEAST_EXPECT(ep.port() == 2017);
346 BEAST_EXPECT(ep.address() ==
AddressV6{});
371 failParseEP(
"[1234:5678:90ab:cdef:1234:5678:90ab:cdef:1111]:1");
372 failParseEP(
"[1234:5678:90ab:cdef:1234:5678:90ab:cdef:1111]:12345");
379 constexpr auto items{100};
381 for (
auto i = 0; i < items; ++i)
387 BEAST_EXPECT(max_lf > 0.90);