mirror of https://github.com/oxen-io/lokinet
first draft of router event tooling
parent
ef8570ff58
commit
07c5d6f5df
@ -0,0 +1,36 @@
|
||||
#include "tooling/router_event.cpp"
|
||||
#include "llarp/router_id.hpp"
|
||||
|
||||
namespace tooling
|
||||
{
|
||||
|
||||
PathBuildAttemptEvent::PathBuildAttemptEvent(const llarp::RouterID& routerID, std::vector<llarp::RouterID> hops)
|
||||
: routerID(routerID), hops(hops)
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
PathBuildAttemptEvent::ToString() const
|
||||
{
|
||||
std::string result = "PathBuildAttemptEvent [";
|
||||
result += routerID.ToString().substr(0, 8);
|
||||
result += "] ---- [";
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto& hop : hops)
|
||||
{
|
||||
i++;
|
||||
|
||||
result += hop.ToString().substr(0, 8);
|
||||
result += "]";
|
||||
|
||||
if (i != hops.size())
|
||||
{
|
||||
result += " -> [";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace tooling
|
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
||||
struct RouterID;
|
||||
|
||||
} // namespace llarp
|
||||
|
||||
|
||||
namespace tooling
|
||||
{
|
||||
|
||||
struct RouterEvent
|
||||
{
|
||||
virtual ~RouterEvent() = default;
|
||||
|
||||
virtual std::string ToString() const = 0;
|
||||
|
||||
llarp::RouterID routerID;
|
||||
};
|
||||
|
||||
struct PathBuildAttemptEvent : public RouterEvent
|
||||
{
|
||||
PathBuildAttemptEvent(const llarp::RouterID& routerID, std::vector<llarp::RouterID> hops);
|
||||
|
||||
std::string ToString() const override;
|
||||
|
||||
std::vector<llarp::RouterID> hops;
|
||||
}
|
||||
|
||||
} // namespace tooling
|
Loading…
Reference in New Issue