mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
632f4ee70b
- Local and Remote RC's now implemented with discrete functionalities and uses
61 lines
1.0 KiB
C++
61 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "util/aligned.hpp"
|
|
#include "util/status.hpp"
|
|
|
|
#include <llarp/crypto/types.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
struct RouterID : public PubKey
|
|
{
|
|
static constexpr size_t SIZE = 32;
|
|
|
|
using Data = std::array<byte_t, SIZE>;
|
|
|
|
RouterID() = default;
|
|
|
|
RouterID(const byte_t* buf) : PubKey(buf)
|
|
{}
|
|
|
|
RouterID(const Data& data) : PubKey(data)
|
|
{}
|
|
|
|
util::StatusObject
|
|
ExtractStatus() const;
|
|
|
|
std::string
|
|
ToString() const;
|
|
|
|
std::string
|
|
ShortString() const;
|
|
|
|
bool
|
|
FromString(std::string_view str);
|
|
|
|
RouterID&
|
|
operator=(const byte_t* ptr)
|
|
{
|
|
std::copy(ptr, ptr + SIZE, begin());
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
inline bool
|
|
operator==(const RouterID& lhs, const RouterID& rhs)
|
|
{
|
|
return lhs.as_array() == rhs.as_array();
|
|
}
|
|
|
|
template <>
|
|
constexpr inline bool IsToStringFormattable<RouterID> = true;
|
|
|
|
} // namespace llarp
|
|
|
|
namespace std
|
|
{
|
|
template <>
|
|
struct hash<llarp::RouterID> : hash<llarp::AlignedBuffer<llarp::RouterID::SIZE>>
|
|
{};
|
|
} // namespace std
|