lokinet/llarp/service/tag.cpp
dr7ana ac6255c736 Squashed commits for merge errors afer fixing client-refactor:
- Deprecate pathset, smashed into PathBuilder (renamed to PathHandler)
- Re-abstraction of sessions and PathHandlers
  - Renamed PathBuilder -> PathHandler to more accurately reflect purpose
  - {Service,Exit}Handler will remain as PathHandlers, though currently no path-sharing amongst sessions being managed is to be implemented. Handlers will maintain their own paths for both lookups and initiating sessions, while sessions will manage their paths independantly.
  - Session object handling necessitates the differentiation between outbound and inbound sessions. Initiators of sessions are entirely responsible for dictating the chosen path on which the session communicates, and must therefore continually build and manage paths for the negotiated session.
  - Outbound sessions are now {Service,Exit}Sessions
  - Inbound sessions are implemented with InboundSession, which is agnostic to the type of service being operated locally (service vs exit, client vs relay, etc). When the Session initiator signals a switch to a different path, it will be assigned to the InboundSession object by {Service,Exit}Endpoint, which manages local services and exits
2024-02-05 05:19:05 -08:00

26 lines
601 B
C++

#include "tag.hpp"
namespace llarp::service
{
void SessionTag::Randomize()
{
llarp::AlignedBuffer<16>::Randomize();
/// ensure we are in the fc00 range
llarp::AlignedBuffer<16>::operator[](0) = 0xfc;
}
sockaddr_in6 SessionTag::ToV6() const
{
sockaddr_in6 saddr{};
saddr.sin6_family = AF_INET6;
std::copy_n(data(), size(), saddr.sin6_addr.s6_addr);
return saddr;
}
void SessionTag::FromV6(sockaddr_in6 saddr)
{
std::copy_n(saddr.sin6_addr.s6_addr, size(), data());
}
} // namespace llarp::service