mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-19 09:25:28 +00:00
f574cd798f
- includes are now sorted in consistent, logical order; first step in an attempt to fix the tomfoolery (no relation to Tom) brought in by include-what-you-use - shuffled around some cmake linking to simplify dependency graph - superfluous files removed
75 lines
1.2 KiB
C++
75 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <llarp/net/net_int.hpp>
|
|
|
|
#include <quic.hpp>
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
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
|