Class PeerItem
- java.lang.Object
-
- com.biglybt.core.peermanager.peerdb.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().
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PeerItem(byte[] _serialization, byte _source, byte _handshake, int _udp_port, java.lang.String _network)
protected
PeerItem(java.lang.String _address, int _tcp_port, byte _source, byte _handshake, int _udp_port, byte _crypto_level, int _up_speed)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PeerItem other)
static byte
convertSourceID(java.lang.String source)
static java.lang.String
convertSourceString(byte source_id)
boolean
equals(java.lang.Object obj)
java.lang.String
getAddressString()
byte
getCryptoLevel()
byte
getHandshakeType()
java.lang.String
getIP()
java.lang.String
getNetwork()
java.lang.String
getPeerSource()
source as defined in DownloadAnnounceResultPeerlong
getPriority()
byte[]
getSerialization()
byte
getSource()
int
getTCPPort()
int
getUDPPort()
int
hashCode()
boolean
isIPv4()
boolean
useCrypto()
-
-
-
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()
-
getIP
public java.lang.String getIP()
- Specified by:
getIP
in interfacePeerDescriptor
-
getNetwork
public java.lang.String getNetwork()
-
getTCPPort
public int getTCPPort()
- Specified by:
getTCPPort
in interfacePeerDescriptor
-
getUDPPort
public int getUDPPort()
- Specified by:
getUDPPort
in interfacePeerDescriptor
-
getSource
public byte getSource()
-
getPeerSource
public java.lang.String getPeerSource()
Description copied from interface:PeerDescriptor
source as defined in DownloadAnnounceResultPeer- Specified by:
getPeerSource
in interfacePeerDescriptor
- Returns:
-
getHandshakeType
public byte getHandshakeType()
-
getCryptoLevel
public byte getCryptoLevel()
-
useCrypto
public boolean useCrypto()
- Specified by:
useCrypto
in interfacePeerDescriptor
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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()
-
-