#ifndef LLARP_EXIT_CONTEXT_HPP #define LLARP_EXIT_CONTEXT_HPP #include #include #include #include namespace llarp { namespace exit { /// owner of all the exit endpoints struct Context { Context(AbstractRouter* r); ~Context(); void Tick(llarp_time_t now); void ClearAllEndpoints(); util::StatusObject ExtractStatus() const; /// send close to all exit sessions and remove all sessions void Stop(); void AddExitEndpoint( const std::string& name, const NetworkConfig& networkConfig, const DnsConfig& dnsConfig); bool ObtainNewExit(const PubKey& remote, const PathID_t& path, bool permitInternet); exit::Endpoint* FindEndpointForPath(const PathID_t& path) const; /// calculate (pk, tx, rx) for all exit traffic using TrafficStats = std::unordered_map, PubKey::Hash>; void CalculateExitTraffic(TrafficStats& stats); private: AbstractRouter* m_Router; std::unordered_map> m_Exits; std::list> m_Closed; }; } // namespace exit } // namespace llarp #endif