|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.data.DataStructureImpl
net.i2p.data.RouterInfo
public class RouterInfo
Defines the data that a router either publishes to the global routing table or provides to trusted peers.
Field Summary | |
---|---|
static java.lang.String |
BW_CAPABILITY_CHARS
|
static char |
CAPABILITY_HIDDEN
|
static java.lang.String |
PROP_CAPABILITIES
|
static java.lang.String |
PROP_NETWORK_ID
|
Constructor Summary | |
---|---|
RouterInfo()
|
|
RouterInfo(RouterInfo old)
|
Method Summary | |
---|---|
void |
addCapability(char cap)
|
void |
delCapability(char cap)
|
boolean |
equals(java.lang.Object object)
|
java.util.Set |
getAddresses()
Retrieve the set of RouterAddress structures at which this router can be contacted. |
java.lang.String |
getBandwidthTier()
Return a string representation of this node's bandwidth tier, or "Unknown" |
java.lang.String |
getCapabilities()
what special capabilities this router offers |
RouterIdentity |
getIdentity()
Retrieve the identity of the router represented |
int |
getNetworkId()
which network is this routerInfo a part of. |
java.lang.String |
getOption(java.lang.String opt)
|
java.util.Properties |
getOptions()
Retrieve a set of options or statistics that the router can expose |
java.util.Set |
getPeers()
Retrieve a set of SHA-256 hashes of RouterIdentities from rotuers this router can be reached through. |
long |
getPublished()
Retrieve the approximate date on which the info was published (essentially a version number for the routerInfo structure, except that it also contains freshness information - whether or not the router is currently publishing its information). |
Hash |
getRoutingKey()
Get the routing key for the structure using the current modifier in the RoutingKeyGenerator. |
Signature |
getSignature()
Retrieve the proof that the identity stands behind the info here |
RouterAddress |
getTargetAddress(java.lang.String transportStyle)
Pull the first workable target address for the given transport |
int |
hashCode()
|
boolean |
isCurrent(long maxAgeMs)
Determine whether the router was published recently (within the given age milliseconds). |
boolean |
isHidden()
Is this a hidden node? |
boolean |
isValid()
Determine whether this router info is authorized with a valid signature |
void |
readBytes(java.io.InputStream in)
Load up the current object with data from the given stream. |
void |
setAddresses(java.util.Set addresses)
Specify a set of RouterAddress structures at which this router can be contacted. |
void |
setIdentity(RouterIdentity ident)
Configure the identity of the router represented |
void |
setOptions(java.util.Properties options)
Configure a set of options or statistics that the router can expose |
void |
setPeers(java.util.Set peers)
Specify a set of SHA-256 hashes of RouterIdentities from rotuers this router can be reached through. |
void |
setPublished(long published)
Date on which it was published, in milliseconds since Midnight GMT on Jan 01, 1970 |
void |
setRoutingKey(Hash key)
|
void |
setSignature(Signature signature)
Configure the proof that the entity stands behind the info here |
void |
sign(SigningPrivateKey key)
Sign the structure using the supplied signing key |
java.lang.String |
toString()
|
boolean |
validateRoutingKey()
|
void |
writeBytes(java.io.OutputStream out)
Write out the data structure to the stream, using the format defined in the I2P data structure specification. |
Methods inherited from class net.i2p.data.DataStructureImpl |
---|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROP_NETWORK_ID
public static final java.lang.String PROP_CAPABILITIES
public static final char CAPABILITY_HIDDEN
public static final java.lang.String BW_CAPABILITY_CHARS
Constructor Detail |
---|
public RouterInfo()
public RouterInfo(RouterInfo old)
Method Detail |
---|
public RouterIdentity getIdentity()
public void setIdentity(RouterIdentity ident)
public long getPublished()
public void setPublished(long published)
public java.util.Set getAddresses()
public void setAddresses(java.util.Set addresses)
public java.util.Set getPeers()
public void setPeers(java.util.Set peers)
public java.util.Properties getOptions()
public java.lang.String getOption(java.lang.String opt)
public void setOptions(java.util.Properties options)
public Signature getSignature()
public void setSignature(Signature signature)
public void sign(SigningPrivateKey key) throws DataFormatException
DataFormatException
public boolean isValid()
public int getNetworkId()
public java.lang.String getCapabilities()
public boolean isHidden()
public java.lang.String getBandwidthTier()
public void addCapability(char cap)
public void delCapability(char cap)
public Hash getRoutingKey()
public void setRoutingKey(Hash key)
public boolean validateRoutingKey()
public boolean isCurrent(long maxAgeMs)
maxAgeMs
- milliseconds between the current time and publish date to check
public RouterAddress getTargetAddress(java.lang.String transportStyle)
public void readBytes(java.io.InputStream in) throws DataFormatException, java.io.IOException
DataStructure
in
- stream to read from
DataFormatException
- if the data is improperly formatted
java.io.IOException
- if there was a problem reading the streampublic void writeBytes(java.io.OutputStream out) throws DataFormatException, java.io.IOException
DataStructure
out
- stream to write to
DataFormatException
- if the data was incomplete or not yet ready to be written
java.io.IOException
- if there was a problem writing to the streampublic boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |