mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
31 lines
721 B
C++
31 lines
721 B
C++
#include <tooling/hive_context.hpp>
|
|
|
|
#include <tooling/hive_router.hpp>
|
|
|
|
namespace tooling
|
|
{
|
|
HiveContext::HiveContext(RouterHive* hive) : m_hive(hive)
|
|
{}
|
|
|
|
std::shared_ptr<llarp::AbstractRouter>
|
|
HiveContext::makeRouter(llarp_ev_loop_ptr netloop, std::shared_ptr<llarp::Logic> logic)
|
|
{
|
|
return std::make_shared<HiveRouter>(netloop, logic, makeVPNPlatform(), m_hive);
|
|
}
|
|
|
|
HiveRouter*
|
|
HiveContext::getRouterAsHiveRouter()
|
|
{
|
|
if (not router)
|
|
return nullptr;
|
|
|
|
HiveRouter* hiveRouter = dynamic_cast<HiveRouter*>(router.get());
|
|
|
|
if (hiveRouter == nullptr)
|
|
throw std::runtime_error("HiveContext has a router not of type HiveRouter");
|
|
|
|
return hiveRouter;
|
|
}
|
|
|
|
} // namespace tooling
|