public OutboundTunnel(TunnelConfig config, int replytunnelhops) : base(config) { TunnelSetup = config.Info; var outtunnel = TunnelSetup.Hops[0]; NextHop = outtunnel.Peer.IdentHash; SendTunnelId = outtunnel.TunnelId; ReplyTunnelHops = replytunnelhops; }
protected Tunnel(TunnelConfig config) { Config = config; TunnelMemberHops = config == null ? 1 : config.Info.Hops.Count; TunnelSeqNr = Interlocked.Increment(ref TunnelIdCounter); TunnelDebugTrace = "<" + TunnelSeqNr.ToString() + ">"; if (TunnelSeqNr > int.MaxValue - 100) { TunnelIdCounter = 1; } }
private void CreateExploratoryInboundTunnel() { var config = new TunnelConfig( TunnelConfig.TunnelDirection.Inbound, TunnelConfig.TunnelPool.Exploratory, CreateIncommingTunnelChain()); var tunnel = TunnelMgr.CreateTunnel(config); if (tunnel != null) { TunnelMgr.AddTunnel((InboundTunnel)tunnel); } }
private void CreateExploratoryOutboundTunnel() { var config = new TunnelConfig( TunnelConfig.TunnelDirection.Outbound, TunnelConfig.TunnelRole.Gateway, TunnelConfig.TunnelPool.Exploratory, CreateOutgoingTunnelChain()); var tunnel = TunnelMgr.CreateTunnel(config); if (tunnel != null) { TunnelMgr.AddTunnel((OutboundTunnel)tunnel); } }
public GatewayTunnel(BuildRequestRecord brrec) : base(null) { Config = new TunnelConfig( TunnelConfig.TunnelDirection.Outbound, TunnelConfig.TunnelPool.External, null); Limiter = new BandwidthLimiter(Bandwidth.SendBandwidth, TunnelSettings.GatewayTunnelBitrateLimit); ReceiveTunnelId = new I2PTunnelId(brrec.ReceiveTunnel); SendTunnelId = new I2PTunnelId(brrec.NextTunnel); NextHop = new I2PIdentHash(new BufRefLen(brrec.NextIdent.Hash.Clone())); IVKey = brrec.IVKey.Clone(); LayerKey = brrec.LayerKey.Clone(); }
public EndpointTunnel(BuildRequestRecord brrec) : base(null) { Config = new TunnelConfig( TunnelConfig.TunnelDirection.Inbound, TunnelConfig.TunnelRole.Endpoint, TunnelConfig.TunnelPool.External, null); Limiter = new BandwidthLimiter(Bandwidth.SendBandwidth, TunnelSettings.EndpointTunnelBitrateLimit); ReceiveTunnelId = new I2PTunnelId(brrec.ReceiveTunnel); ResponseTunnelId = new I2PTunnelId(brrec.NextTunnel); ResponseMessageId = brrec.SendMessageId; NextHop = new I2PIdentHash(new BufRefLen(brrec.NextIdent.Hash.Clone())); IVKey = brrec.IVKey.Clone(); LayerKey = brrec.LayerKey.Clone(); }
public InboundTunnel(TunnelConfig config, int outtunnelhops) : base(config) { if (config != null) { Fake0HopTunnel = false; TunnelSetup = config.Info; OutTunnelHops = outtunnelhops; var gw = TunnelSetup.Hops[0]; RemoteGateway = gw.Peer.IdentHash; GatewayTunnelId = gw.TunnelId; ReceiveTunnelId = TunnelSetup.Hops.Last().TunnelId; #if LOG_ALL_TUNNEL_TRANSFER Logging.LogDebug($"InboundTunnel: Tunnel {Destination.Id32Short} created."); #endif } else { Fake0HopTunnel = true; var hops = new List <HopInfo> { new HopInfo(RouterContext.Inst.MyRouterIdentity, new I2PTunnelId()) }; TunnelSetup = new TunnelInfo(hops); Config = new TunnelConfig( TunnelConfig.TunnelDirection.Inbound, TunnelConfig.TunnelPool.Exploratory, TunnelSetup); ReceiveTunnelId = TunnelSetup.Hops.Last().TunnelId; RemoteGateway = RouterContext.Inst.MyRouterIdentity.IdentHash; GatewayTunnelId = ReceiveTunnelId; #if LOG_ALL_TUNNEL_TRANSFER Logging.LogDebug($"InboundTunnel {TunnelDebugTrace}: 0-hop tunnel {Destination.Id32Short} created."); #endif } }
public InboundTunnel(TunnelConfig config, int outtunnelhops) : base(config) { if (config != null) { Fake0HopTunnel = false; TunnelSetup = config.Info; OutTunnelHops = outtunnelhops; var gw = TunnelSetup.Hops[0]; RemoteGateway = gw.Peer.IdentHash; GatewayTunnelId = gw.TunnelId; ReceiveTunnelId = TunnelSetup.Hops.Last().TunnelId; DebugUtils.LogDebug("InboundTunnel: Tunnel " + Destination.Id32Short + " created."); } else { Fake0HopTunnel = true; var hops = new List <HopInfo>(); hops.Add(new HopInfo(RouterContext.Inst.MyRouterIdentity, new I2PTunnelId())); TunnelSetup = new TunnelInfo(hops); Config = new TunnelConfig( TunnelConfig.TunnelDirection.Inbound, TunnelConfig.TunnelRole.Endpoint, TunnelConfig.TunnelPool.Exploratory, TunnelSetup); ReceiveTunnelId = TunnelSetup.Hops.Last().TunnelId; RemoteGateway = RouterContext.Inst.MyRouterIdentity.IdentHash; GatewayTunnelId = ReceiveTunnelId; DebugUtils.LogDebug("InboundTunnel " + TunnelDebugTrace + ": 0-hop tunnel " + Destination.Id32Short + " created."); } }