Exemple #1
0
	void TunnelPool::CreateInboundTunnel ()
	{
		auto outboundTunnel = GetNextOutboundTunnel ();
		if (!outboundTunnel)
			outboundTunnel = tunnels.GetNextOutboundTunnel ();
		LogPrint (eLogDebug, "Tunnels: Creating destination inbound tunnel...");
		std::vector<std::shared_ptr<const i2p::data::IdentityEx> > peers;
		if (SelectPeers (peers, true))
		{
			std::reverse (peers.begin (), peers.end ());	
			auto tunnel = tunnels.CreateTunnel<InboundTunnel> (std::make_shared<TunnelConfig> (peers), outboundTunnel);
			tunnel->SetTunnelPool (shared_from_this ());
		}	
		else
			LogPrint (eLogError, "Tunnels: Can't create inbound tunnel, no peers available");
	}
Exemple #2
0
void TunnelPool::CreateInboundTunnel() {
  auto outboundTunnel = GetNextOutboundTunnel();
  if (!outboundTunnel)
    outboundTunnel = tunnels.GetNextOutboundTunnel();
  LogPrint("Creating destination inbound tunnel...");
  std::vector<std::shared_ptr<const i2p::data::RouterInfo> > hops;
  if (SelectPeers(hops, true)) {
    std::reverse(hops.begin(), hops.end());
    auto tunnel = tunnels.CreateTunnel<InboundTunnel> (
        std::make_shared<TunnelConfig> (hops),
        outboundTunnel);
    tunnel->SetTunnelPool(shared_from_this());
  } else {
    LogPrint(eLogError, "Can't create inbound tunnel. No peers available");
  }
}
Exemple #3
0
	void TunnelPool::CreateOutboundTunnel ()
	{
		auto inboundTunnel = GetNextInboundTunnel ();
		if (!inboundTunnel)
			inboundTunnel = tunnels.GetNextInboundTunnel ();
		if (inboundTunnel)
		{	
			LogPrint (eLogDebug, "Tunnels: Creating destination outbound tunnel...");
			std::vector<std::shared_ptr<const i2p::data::IdentityEx> > peers;
			if (SelectPeers (peers, false))
			{	
				auto tunnel = tunnels.CreateTunnel<OutboundTunnel> (
					std::make_shared<TunnelConfig> (peers, inboundTunnel->GetNextTunnelID (), inboundTunnel->GetNextIdentHash ()));
				tunnel->SetTunnelPool (shared_from_this ());
			}	
			else
				LogPrint (eLogError, "Tunnels: Can't create outbound tunnel, no peers available");
		}	
		else
			LogPrint (eLogError, "Tunnels: Can't create outbound tunnel, no inbound tunnels found");
	}	
Exemple #4
0
void TunnelPool::CreateOutboundTunnel() {
  auto inboundTunnel = GetNextInboundTunnel();
  if (!inboundTunnel)
    inboundTunnel = tunnels.GetNextInboundTunnel();
  if (inboundTunnel) {
    LogPrint("Creating destination outbound tunnel...");
    std::vector<std::shared_ptr<const i2p::data::RouterInfo> > hops;
    if (SelectPeers(hops, false)) {
      auto tunnel = tunnels.CreateTunnel<OutboundTunnel> (
        std::make_shared<TunnelConfig> (
          hops,
          inboundTunnel->GetTunnelConfig()));
      tunnel->SetTunnelPool(shared_from_this());
    } else {
      LogPrint(eLogError,
          "Can't create outbound tunnel. No peers available");
    }
  } else {
    LogPrint(eLogError,
        "Can't create outbound tunnel. No inbound tunnels found");
  }
}