Class PeerItem

java.lang.Object
com.biglybt.core.peermanager.peerdb.PeerItem
All Implemented Interfaces:
PeerDescriptor

public class PeerItem extends Object implements PeerDescriptor
Represents a peer item, unique by ip address + port combo. NOTE: Overrides equals().
  • Field Details

    • address

      private final byte[] address
    • udp_port

      private final short udp_port
    • tcp_port

      private final short tcp_port
    • source

      private final byte source
    • hashcode

      private final int hashcode
    • handshake

      private final byte handshake
    • crypto_level

      private final byte crypto_level
    • up_speed

      private final short up_speed
    • priority

      private final int priority
    • network

      private final String network
  • Constructor Details

    • PeerItem

      protected PeerItem(String _address, int _tcp_port, byte _source, byte _handshake, int _udp_port, byte _crypto_level, int _up_speed)
    • PeerItem

      protected PeerItem(byte[] _serialization, byte _source, byte _handshake, int _udp_port, String _network) throws Exception
      Throws:
      Exception
  • Method Details

    • getSerialization

      public byte[] getSerialization()
    • getAddressString

      public String getAddressString()
    • getIP

      public String getIP()
      Specified by:
      getIP in interface PeerDescriptor
    • getNetwork

      public String getNetwork()
    • getTCPPort

      public int getTCPPort()
      Specified by:
      getTCPPort in interface PeerDescriptor
    • getUDPPort

      public int getUDPPort()
      Specified by:
      getUDPPort in interface PeerDescriptor
    • getSource

      public byte getSource()
    • getPeerSource

      public String getPeerSource()
      Description copied from interface: PeerDescriptor
      source as defined in DownloadAnnounceResultPeer
      Specified by:
      getPeerSource in interface PeerDescriptor
      Returns:
    • getHandshakeType

      public byte getHandshakeType()
    • getCryptoLevel

      public byte getCryptoLevel()
    • useCrypto

      public boolean useCrypto()
      Specified by:
      useCrypto in interface PeerDescriptor
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(PeerItem other)
    • getPriority

      public long getPriority()
    • convertSourceString

      public static String convertSourceString(byte source_id)
    • convertSourceID

      public static byte convertSourceID(String source)
    • isIPv4

      public boolean isIPv4()