mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-13 01:10:24 +00:00
100a953a23
still needs the quic sides to work
30 lines
578 B
C++
30 lines
578 B
C++
#include "convotag.hpp"
|
|
#include "net/ip.hpp"
|
|
|
|
namespace llarp::service
|
|
{
|
|
void
|
|
ConvoTag::Randomize()
|
|
{
|
|
llarp::AlignedBuffer<16>::Randomize();
|
|
/// ensure we are in the fc00 range
|
|
llarp::AlignedBuffer<16>::operator[](0) = 0xfc;
|
|
}
|
|
|
|
sockaddr_in6
|
|
ConvoTag::ToV6() const
|
|
{
|
|
sockaddr_in6 saddr{};
|
|
saddr.sin6_family = AF_INET6;
|
|
std::copy_n(data(), size(), saddr.sin6_addr.s6_addr);
|
|
return saddr;
|
|
}
|
|
|
|
void
|
|
ConvoTag::FromV6(sockaddr_in6 saddr)
|
|
{
|
|
std::copy_n(saddr.sin6_addr.s6_addr, size(), data());
|
|
}
|
|
|
|
} // namespace llarp::service
|