mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-07 15:20:31 +00:00
a3e6cec7e7
- llarp/router/router.hpp, route_poker, and platform code moved to libquic Address types - implementing required methods in link_manager for connection establishment - coming along nicely
73 lines
1.3 KiB
C++
73 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <llarp/net/net_int.hpp>
|
|
#include <external/oxen-libquic/include/quic.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
struct Router;
|
|
|
|
struct RoutePoker : public std::enable_shared_from_this<RoutePoker>
|
|
{
|
|
RoutePoker(Router& r) : router{r}
|
|
{}
|
|
|
|
void
|
|
add_route(oxen::quic::Address ip);
|
|
|
|
void
|
|
delete_route(oxen::quic::Address ip);
|
|
|
|
void
|
|
start();
|
|
|
|
~RoutePoker();
|
|
|
|
/// explicitly put routes up
|
|
void
|
|
put_up();
|
|
|
|
/// explicitly put routes down
|
|
void
|
|
put_down();
|
|
|
|
/// set dns resolver
|
|
/// pass in if we are using exit node mode right now as a bool
|
|
void
|
|
set_dns_mode(bool using_exit_mode) const;
|
|
|
|
private:
|
|
void
|
|
update();
|
|
|
|
bool
|
|
is_enabled() const;
|
|
|
|
void
|
|
delete_all_routes();
|
|
|
|
void
|
|
disable_all_routes();
|
|
|
|
void
|
|
refresh_all_routes();
|
|
|
|
void
|
|
enable_route(oxen::quic::Address ip, oxen::quic::Address gateway);
|
|
|
|
void
|
|
disable_route(oxen::quic::Address ip, oxen::quic::Address gateway);
|
|
|
|
std::unordered_map<oxen::quic::Address, oxen::quic::Address> poked_routes;
|
|
|
|
std::optional<oxen::quic::Address> current_gateway;
|
|
|
|
Router& router;
|
|
bool is_up{false};
|
|
};
|
|
} // namespace llarp
|