java.lang.Object
net.i2p.router.tunnel.OutboundReceiver
All Implemented Interfaces:
TunnelGateway.Receiver

class OutboundReceiverextends Object implements TunnelGateway.Receiver
We are the outbound gateway - we created this outbound tunnel. Receive the outbound message after it has been preprocessed and encrypted, then forward it on to the first hop in the tunnel.

Not used for zero-hop OBGWs.

  • Field Details

    • _context

      private final RouterContext _context
      The router context.
    • _log

      private final Log _log
      Logger for the outbound receiver.
    • _config

      private final TunnelCreatorConfig _config
      The tunnel the messages go through.
    • _nextHopCache

      private RouterInfo _nextHopCache
      The cached next hop router info.
    • _priority

      private final int _priority
      Send priority of the tunnel messages.
    • _sendFailJob

      private final JobImpl _sendFailJob
      The same job instance run after any failed send.
    • MAX_LOOKUP_TIME

      private static final long MAX_LOOKUP_TIME
      Time allowed for the next hop lookup.
      See Also:
    • PRIORITY

      private static final int PRIORITY
      Send priority of our own tunnel messages.
      See Also:
  • Constructor Details

    • OutboundReceiver

      public OutboundReceiver(RouterContext ctx, TunnelCreatorConfig cfg)
      Binds the context and tunnel config, caching the first hop router info.
      Parameters:
      ctx - router context, used for the log, the netdb lookup and the failure job
      cfg - tunnel configuration supplying the first hop, priority and send tunnel
  • Method Details

    • receiveEncrypted

      public long receiveEncrypted(byte[] encrypted)
      Forward the encrypted data to the first hop in the tunnel.
      Specified by:
      receiveEncrypted in interface TunnelGateway.Receiver
      Parameters:
      encrypted - the encrypted data
      Returns:
      message ID it was sent in, or -1 if it had to be deferred
    • getSendTo

      public Hash getSendTo()
      The next hop.
      Specified by:
      getSendTo in interface TunnelGateway.Receiver
      Returns:
      non-null
    • send

      private void send(TunnelDataMessage msg, RouterInfo ri)
      Queues the message for sending to the next hop.
      Parameters:
      msg - the message to send
      ri - the next hop's router info