All Known Implementing Classes:
PeerState2, PeerStateDestroyed

interface SSU2Sender
Basic interface over top of PeerState2 and PeerStateDestroyed, so we can pass them both to PacketBuilder2 to send packets.
  • Method Details

    • getRemoteHostId

      RemoteHostId getRemoteHostId()
      Remote host ID.
      Returns:
      the peer's IP and port as a RemoteHostId
    • isIPv6

      boolean isIPv6()
      Whether the remote is IPv6.
      Returns:
      true for IPv6
    • getRemoteIPAddress

      InetAddress getRemoteIPAddress()
      Remote IP address.
      Returns:
      remote IP address
    • getRemotePort

      int getRemotePort()
      Remote port.
      Returns:
      the port in the 1-65535 range
    • getMTU

      int getMTU()
      Maximum transmission unit.
      Returns:
      the largest payload size to build packets to, between PeerState2.MIN_MTU and PeerState2.MAX_MTU
    • getNextPacketNumber

      long getNextPacketNumber() throws IOException
      Next packet number to use.
      Returns:
      next packet number
      Throws:
      IOException - if the peer is already dead and cannot send
    • getSendConnID

      long getSendConnID()
      Connection ID to use when sending.
      Returns:
      send connection ID
    • getSendCipher

      CipherState getSendCipher()
      Cipher to use when sending.
      Returns:
      the cipher state; the caller must sync on it while encrypting
    • getSendHeaderEncryptKey1

      byte[] getSendHeaderEncryptKey1()
      Header encryption key 1.
      Returns:
      send header encrypt key 1
    • getSendHeaderEncryptKey2

      byte[] getSendHeaderEncryptKey2()
      Header encryption key 2.
      Returns:
      send header encrypt key 2
    • setDestroyReason

      void setDestroyReason(int reason)
      Reason the connection was destroyed.
      Parameters:
      reason - the SSU2Util termination code, echoed to the peer in a SessionDestroy and ignored once destroyed
    • getReceivedMessages

      SSU2Bitfield getReceivedMessages()
      Bitfield of received messages.
      Returns:
      received messages bitfield
    • getAckedMessages

      SSU2Bitfield getAckedMessages()
      Bitfield of acked messages.
      Returns:
      acked messages bitfield
    • fragmentsSent

      void fragmentsSent(long pktNum, int length, List<PacketBuilder2.Fragment> fragments)
      Records that a set of fragments was sent.
      Parameters:
      pktNum - the packet number the fragments were sent under
      length - the total payload length those fragments add up to
      fragments - fragment list
    • getFlags

      byte getFlags()
      Flags byte.
      Returns:
      flags byte