mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
273270916e
This commit reflects changes to clang-format rules. Unfortunately, these rule changes create a massive change to the codebase, which causes an apparent rewrite of git history. Git blame's --ignore-rev flag can be used to ignore this commit when attempting to `git blame` some code.
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
#include <router_contact.hpp>
|
|
#include <dht/key.hpp>
|
|
#include "common.hpp"
|
|
|
|
namespace llarp
|
|
{
|
|
void
|
|
RouterContact_Init(py::module& mod)
|
|
{
|
|
py::class_<RouterContact>(mod, "RouterContact")
|
|
.def(py::init<>())
|
|
.def_property_readonly(
|
|
"routerID",
|
|
[](const RouterContact* const rc) -> llarp::RouterID {
|
|
return llarp::RouterID(rc->pubkey);
|
|
})
|
|
.def_property_readonly(
|
|
"AsDHTKey",
|
|
[](const RouterContact* const rc) -> llarp::dht::Key_t {
|
|
return llarp::dht::Key_t{rc->pubkey.as_array()};
|
|
})
|
|
.def("ReadFile", &RouterContact::Read)
|
|
.def("WriteFile", &RouterContact::Write)
|
|
.def("ToString", &RouterContact::ToString)
|
|
.def("__str__", &RouterContact::ToString)
|
|
.def("__repr__", &RouterContact::ToString)
|
|
.def("Verify", [](const RouterContact* const rc) -> bool {
|
|
const llarp_time_t now = llarp::time_now_ms();
|
|
return rc->Verify(now);
|
|
});
|
|
}
|
|
} // namespace llarp
|