2017-04-08 16:51:35 +00:00
|
|
|
#ifndef MATCHED_DESTINATION_H_
|
|
|
|
#define MATCHED_DESTINATION_H_
|
|
|
|
#include "Destination.h"
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
|
|
|
namespace client
|
|
|
|
{
|
2017-04-08 19:14:47 +00:00
|
|
|
/**
|
|
|
|
client tunnel that uses same OBEP as IBGW of each remote lease for a remote destination
|
|
|
|
*/
|
2020-02-04 19:17:23 +00:00
|
|
|
class MatchedTunnelDestination : public RunnableClientDestination, public i2p::tunnel::ITunnelPeerSelector
|
2017-04-08 19:14:47 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MatchedTunnelDestination(const i2p::data::PrivateKeys& keys, const std::string & remoteName, const std::map<std::string, std::string> * params = nullptr);
|
2020-02-02 23:58:58 +00:00
|
|
|
void Start();
|
|
|
|
void Stop();
|
2017-04-08 16:51:35 +00:00
|
|
|
|
2017-04-08 19:14:47 +00:00
|
|
|
bool SelectPeers(i2p::tunnel::Path & peers, int hops, bool inbound);
|
|
|
|
bool OnBuildResult(const i2p::tunnel::Path & peers, bool inbound, i2p::tunnel::TunnelBuildResult result);
|
2017-04-08 16:51:35 +00:00
|
|
|
|
2017-04-08 19:14:47 +00:00
|
|
|
private:
|
|
|
|
void ResolveCurrentLeaseSet();
|
|
|
|
void HandleFoundCurrentLeaseSet(std::shared_ptr<const i2p::data::LeaseSet> ls);
|
2017-04-08 16:51:35 +00:00
|
|
|
|
2017-04-08 19:14:47 +00:00
|
|
|
private:
|
|
|
|
std::string m_RemoteName;
|
|
|
|
i2p::data::IdentHash m_RemoteIdent;
|
|
|
|
std::shared_ptr<const i2p::data::LeaseSet> m_RemoteLeaseSet;
|
|
|
|
std::shared_ptr<boost::asio::deadline_timer> m_ResolveTimer;
|
|
|
|
};
|
2017-04-08 16:51:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|