2020-06-29 15:44:13 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <router/router.hpp>
|
|
|
|
|
|
|
|
namespace tooling
|
|
|
|
{
|
|
|
|
/// HiveRouter is a subclass of Router which overrides specific behavior in
|
|
|
|
/// order to perform testing-related functions. It exists largely to prevent
|
|
|
|
/// this behavior (which may often be "dangerous") from leaking into release
|
|
|
|
/// code.
|
|
|
|
struct HiveRouter : public llarp::Router
|
|
|
|
{
|
2021-01-11 23:13:22 +00:00
|
|
|
explicit HiveRouter(
|
2021-03-02 07:02:59 +00:00
|
|
|
llarp::EventLoop_ptr loop,
|
2021-02-02 18:16:34 +00:00
|
|
|
std::shared_ptr<llarp::vpn::Platform> vpnPlatform,
|
2021-01-11 23:13:22 +00:00
|
|
|
RouterHive* hive);
|
2020-06-29 15:44:13 +00:00
|
|
|
|
|
|
|
virtual ~HiveRouter() = default;
|
|
|
|
|
|
|
|
/// Override logic to prevent base Router class from gossiping its RC.
|
|
|
|
virtual bool
|
|
|
|
disableGossipingRC_TestingOnly() override;
|
|
|
|
|
|
|
|
void
|
|
|
|
disableGossiping();
|
|
|
|
|
|
|
|
void
|
|
|
|
enableGossiping();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_disableGossiping = false;
|
2020-07-01 19:46:52 +00:00
|
|
|
RouterHive* m_hive = nullptr;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
HandleRouterEvent(RouterEventPtr event) const override;
|
2020-06-29 15:44:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace tooling
|