mirror of https://github.com/oxen-io/lokinet
git add because I'm dumb
parent
a9882ad475
commit
db2a0ef7f7
@ -0,0 +1,26 @@
|
||||
#include <path/path.hpp>
|
||||
#include "common.hpp"
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
namespace path
|
||||
{
|
||||
void
|
||||
PathHopConfig_Init(py::module& mod)
|
||||
{
|
||||
auto str_func = [](PathHopConfig *hop) {
|
||||
std::string s = "Hop: routerID = ";
|
||||
s += RouterID(hop->rc.pubkey).ToString();
|
||||
s += ", next routerID = ";
|
||||
s += hop->upstream.ToString();
|
||||
return s;
|
||||
};
|
||||
py::class_< PathHopConfig >(mod, "PathHopConfig")
|
||||
.def_readonly("rc", &PathHopConfig::rc)
|
||||
.def_readonly("upstreamRouter", &PathHopConfig::upstream)
|
||||
.def("ToString", str_func)
|
||||
.def("__str__", str_func)
|
||||
.def("__repr__", str_func);
|
||||
}
|
||||
} // namespace llarp::path
|
||||
} // namespace llarp
|
@ -0,0 +1,19 @@
|
||||
#include "common.hpp"
|
||||
|
||||
#include "router_id.hpp"
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
void
|
||||
RouterID_Init(py::module & mod)
|
||||
{
|
||||
py::class_<RouterID>(mod, "RouterID")
|
||||
.def("FromHex",
|
||||
[](RouterID* r, const std::string& hex) -> bool {
|
||||
return HexDecode(hex.c_str(), r->data(), r->size());
|
||||
})
|
||||
.def("__repr__", &RouterID::ToString)
|
||||
.def("__str__", &RouterID::ToString)
|
||||
.def("__eq__", &RouterID::operator==);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue