mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
739 B
C++
31 lines
739 B
C++
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
namespace llarp::RCFetchMessage
|
|
{
|
|
inline constexpr auto INVALID_REQUEST = "Invalid relay ID requested."sv;
|
|
|
|
inline static std::string
|
|
serialize(std::chrono::system_clock::time_point since, const std::vector<RouterID>& explicit_ids)
|
|
{
|
|
oxenc::bt_dict_producer btdp;
|
|
|
|
try
|
|
{
|
|
btdp.append("since", since.time_since_epoch() / 1s);
|
|
{
|
|
auto id_list = btdp.append_list("explicit_ids");
|
|
for (const auto& rid : explicit_ids)
|
|
id_list.append(rid.ToView());
|
|
}
|
|
}
|
|
catch (...)
|
|
{
|
|
log::error(link_cat, "Error: RCFetchMessage failed to bt encode contents!");
|
|
}
|
|
|
|
return std::move(btdp).str();
|
|
}
|
|
} // namespace llarp::RCFetchMessage
|