示例#1
0
void TunnelPool::CreatePairedInboundTunnel(
    std::shared_ptr<OutboundTunnel> outboundTunnel) {
  LogPrint(eLogInfo, "Creating paired inbound tunnel...");
  auto tunnel = tunnels.CreateTunnel<InboundTunnel> (
      outboundTunnel->GetTunnelConfig()->Invert(),
      outboundTunnel);
  tunnel->SetTunnelPool(shared_from_this());
}
示例#2
0
	void TunnelPool::RecreateInboundTunnel (std::shared_ptr<InboundTunnel> tunnel)
	{
		auto outboundTunnel = GetNextOutboundTunnel ();
		if (!outboundTunnel)
			outboundTunnel = tunnels.GetNextOutboundTunnel ();
		LogPrint (eLogDebug, "Tunnels: Re-creating destination inbound tunnel...");
		auto newTunnel = tunnels.CreateTunnel<InboundTunnel> (std::make_shared<TunnelConfig>(tunnel->GetPeers ()), outboundTunnel);
		newTunnel->SetTunnelPool (shared_from_this());
	}	
示例#3
0
void TunnelPool::RecreateInboundTunnel(
    std::shared_ptr<InboundTunnel> tunnel) {
  auto outboundTunnel = GetNextOutboundTunnel();
  if (!outboundTunnel)
    outboundTunnel = tunnels.GetNextOutboundTunnel();
  LogPrint("Re-creating destination inbound tunnel...");
  auto newTunnel =
    tunnels.CreateTunnel<InboundTunnel> (
      tunnel->GetTunnelConfig()->Clone(),
      outboundTunnel);
  newTunnel->SetTunnelPool(shared_from_this());
}
示例#4
0
void TunnelPool::RecreateOutboundTunnel(
    std::shared_ptr<OutboundTunnel> tunnel) {
  auto inboundTunnel = GetNextInboundTunnel();
  if (!inboundTunnel)
    inboundTunnel = tunnels.GetNextInboundTunnel();
  if (inboundTunnel) {
    LogPrint("Re-creating destination outbound tunnel...");
    auto newTunnel = tunnels.CreateTunnel<OutboundTunnel> (
      tunnel->GetTunnelConfig()->Clone(
        inboundTunnel->GetTunnelConfig()));
    newTunnel->SetTunnelPool(shared_from_this());
  } else {
    LogPrint("Can't re-create outbound tunnel. No inbound tunnels found");
  }
}
示例#5
0
	void TunnelPool::RecreateOutboundTunnel (std::shared_ptr<OutboundTunnel> tunnel)
	{
		auto inboundTunnel = GetNextInboundTunnel ();
		if (!inboundTunnel)
			inboundTunnel = tunnels.GetNextInboundTunnel ();
		if (inboundTunnel)
		{	
			LogPrint (eLogDebug, "Tunnels: Re-creating destination outbound tunnel...");
			auto newTunnel = tunnels.CreateTunnel<OutboundTunnel> (
				std::make_shared<TunnelConfig> (tunnel->GetPeers (),
					inboundTunnel->GetNextTunnelID (), inboundTunnel->GetNextIdentHash ()));
			newTunnel->SetTunnelPool (shared_from_this ());
		}	
		else
			LogPrint (eLogDebug, "Tunnels: Can't re-create outbound tunnel, no inbound tunnels found");
	}		
示例#6
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");
	}
示例#7
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");
  }
}
示例#8
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");
	}	
示例#9
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");
  }
}
示例#10
0
	void TunnelPool::CreatePairedInboundTunnel (std::shared_ptr<OutboundTunnel> outboundTunnel)
	{
		LogPrint (eLogDebug, "Tunnels: Creating paired inbound tunnel...");
		auto tunnel = tunnels.CreateTunnel<InboundTunnel> (std::make_shared<TunnelConfig>(outboundTunnel->GetInvertedPeers ()), outboundTunnel);
		tunnel->SetTunnelPool (shared_from_this ());
	}