Browse Source

create tunnel through any type of transports

pull/46/head
orignal 11 years ago
parent
commit
567816e6a5
  1. 3
      RouterInfo.cpp
  2. 11
      Tunnel.cpp

3
RouterInfo.cpp

@ -180,6 +180,9 @@ namespace data @@ -180,6 +180,9 @@ namespace data
CryptoPP::SHA256().CalculateDigest(m_IdentHash, (uint8_t *)&m_RouterIdentity, sizeof (m_RouterIdentity));
UpdateIdentHashBase64 ();
UpdateRoutingKey ();
if (!m_SupportedTransports)
SetUnreachable (true);
}
void RouterInfo::UpdateIdentHashBase64 ()

11
Tunnel.cpp

@ -389,7 +389,7 @@ namespace tunnel @@ -389,7 +389,7 @@ namespace tunnel
CreateTunnel<OutboundTunnel> (
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
{
i2p::data::netdb.GetRandomNTCPRouter ()
i2p::data::netdb.GetRandomRouter ()
},
inboundTunnel->GetTunnelConfig ()));
}
@ -397,7 +397,7 @@ namespace tunnel @@ -397,7 +397,7 @@ namespace tunnel
{
LogPrint ("Creating two hops outbound tunnel...");
auto firstHop = i2p::data::netdb.GetRandomNTCPRouter (); // first hop must be NTCP
auto firstHop = i2p::data::netdb.GetRandomRouter ();
CreateTunnel<OutboundTunnel> (
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
{
@ -439,7 +439,7 @@ namespace tunnel @@ -439,7 +439,7 @@ namespace tunnel
CreateTunnel<InboundTunnel> (
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
{
i2p::data::netdb.GetRandomNTCPRouter ()
i2p::data::netdb.GetRandomRouter ()
}));
}
else
@ -447,11 +447,12 @@ namespace tunnel @@ -447,11 +447,12 @@ namespace tunnel
OutboundTunnel * outboundTunnel = GetNextOutboundTunnel ();
LogPrint ("Creating two hops inbound tunnel...");
auto router = outboundTunnel->GetTunnelConfig ()->GetFirstHop ()->router;
auto firstHop = i2p::data::netdb.GetRandomRouter (outboundTunnel->GetEndpointRouter ());
CreateTunnel<InboundTunnel> (
new TunnelConfig (std::vector<const i2p::data::RouterInfo *>
{
i2p::data::netdb.GetRandomRouter (outboundTunnel->GetEndpointRouter ()),
router != &i2p::context.GetRouterInfo () ? router : i2p::data::netdb.GetRandomNTCPRouter () // last hop must be NTCP
firstHop,
router != &i2p::context.GetRouterInfo () ? router : i2p::data::netdb.GetRandomRouter (firstHop)
}),
outboundTunnel);
}

Loading…
Cancel
Save