|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.klomp.snark.PeerID
public class PeerID
Store the address information about a peer. Prior to 0.8.1, an instantiation required a peer ID, and full Destination address. Starting with 0.8.1, to support compact tracker responses, a PeerID can be instantiated with a Destination Hash alone. The full destination lookup is deferred until getAddress() is called, and the PeerID is not required. Equality is now determined solely by the dest hash.
| Constructor Summary | |
|---|---|
PeerID(BDecoder be)
Creates a PeerID from a BDecoder. |
|
PeerID(byte[] id,
Destination address)
|
|
PeerID(byte[] dest_hash,
I2PSnarkUtil util)
Creates a PeerID from a destHash |
|
PeerID(Map m)
Creates a PeerID from a Map containing BEncoded peer id, ip and port. |
|
| Method Summary | |
|---|---|
int |
compareTo(Object o)
Deprecated. unused? and will NPE now that address can be null? |
boolean |
equals(Object o)
Two PeerIDs are equal when they have the same dest hash |
Destination |
getAddress()
Get the destination. |
byte[] |
getDestHash()
|
byte[] |
getID()
|
int |
getPort()
|
int |
hashCode()
The hash code of a PeerID is the hashcode of the desthash |
static String |
idencode(byte[] bs)
Encode an id as a hex encoded string and remove leading zeros. |
boolean |
sameID(PeerID pid)
Returns true if and only if this peerID and the given peerID have the same destination hash |
void |
setID(byte[] xid)
for connecting out to peer based on desthash @since 0.8.1 |
String |
toString()
Returns the String "id@address" where id is the base64 encoded id and address is the base64 dest (was the base64 hash of the dest) which should match what the bytemonsoon tracker reports on its web pages. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PeerID(byte[] id,
Destination address)
public PeerID(BDecoder be)
throws IOException
IOException
public PeerID(Map m)
throws InvalidBEncodingException,
UnknownHostException
InvalidBEncodingException
UnknownHostException
public PeerID(byte[] dest_hash,
I2PSnarkUtil util)
throws InvalidBEncodingException
util - for eventual destination lookup
InvalidBEncodingException| Method Detail |
|---|
public byte[] getID()
public void setID(byte[] xid)
public Destination getAddress()
public int getPort()
public byte[] getDestHash()
public int hashCode()
hashCode in class Objectpublic boolean sameID(PeerID pid)
public boolean equals(Object o)
equals in class Objectpublic int compareTo(Object o)
compareTo in interface Comparablepublic String toString()
toString in class Objectpublic static String idencode(byte[] bs)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||