You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/include/llarp/exit/context.hpp

43 lines
1021 B
C++

#ifndef LLARP_EXIT_CONTEXT_HPP
#define LLARP_EXIT_CONTEXT_HPP
#include <llarp/exit/policy.hpp>
#include <string>
#include <unordered_map>
#include <llarp/handlers/exit.hpp>
#include <llarp/router.h>
namespace llarp
{
namespace exit
{
/// owner of all the exit endpoints
struct Context
{
using Config_t = std::unordered_multimap< std::string, std::string >;
Context(llarp_router *r);
~Context();
void
Tick(llarp_time_t now);
bool
AddExitEndpoint(const std::string &name, const Config_t &config);
bool
ObtainNewExit(const llarp::PubKey &remote, const llarp::PathID_t &path,
bool permitInternet);
llarp::exit::Endpoint *
FindEndpointForPath(const llarp::PathID_t &path) const;
private:
llarp_router *m_Router;
std::unordered_map< std::string,
std::unique_ptr< llarp::handlers::ExitEndpoint > >
m_Exits;
};
} // namespace exit
} // namespace llarp
#endif