Class PeerItem

  • All Implemented Interfaces:
    PeerDescriptor

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

      • 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 java.lang.String network
    • Constructor Detail

      • PeerItem

        protected PeerItem​(java.lang.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,
                           java.lang.String _network)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • getSerialization

        public byte[] getSerialization()
      • getAddressString

        public java.lang.String getAddressString()
      • getNetwork

        public java.lang.String getNetwork()
      • getSource

        public byte getSource()
      • getPeerSource

        public java.lang.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()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public int compareTo​(PeerItem other)
      • getPriority

        public long getPriority()
      • convertSourceString

        public static java.lang.String convertSourceString​(byte source_id)
      • convertSourceID

        public static byte convertSourceID​(java.lang.String source)
      • isIPv4

        public boolean isIPv4()