DataStructure
public class RouterInfo extends DatabaseEntry
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static java.lang.String |
BW_CAPABILITY_CHARS |
Public string of chars which serve as bandwidth capacity markers
NOTE: individual chars defined in Router.java
|
static char |
CAPABILITY_HIDDEN |
|
static java.lang.String |
PROP_CAPABILITIES |
|
static java.lang.String |
PROP_NETWORK_ID |
_currentRoutingKey, _routingKeyGenMod, _signature, KEY_TYPE_LEASESET, KEY_TYPE_ROUTERINFO
コンストラクタ | 説明 |
---|---|
RouterInfo() |
|
RouterInfo(RouterInfo old) |
Used only by Router and PublishLocalRouterInfoJob.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
boolean |
equals(java.lang.Object object) |
|
int |
getAddressCount() |
Return the number of router addresses.
|
java.util.Collection<RouterAddress> |
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"
|
protected byte[] |
getBytes() |
Write out the raw payload of the routerInfo, excluding the signature.
|
java.lang.String |
getCapabilities() |
what special capabilities this router offers
|
long |
getDate() |
A common interface to the timestamp of the two subclasses.
|
RouterIdentity |
getIdentity() |
Retrieve the identity of the router represented
|
KeysAndCert |
getKeysAndCert() |
Get the keys and the cert
Identical to getDestination() in LeaseSet,
and getIdentity() in RouterInfo.
|
int |
getNetworkId() |
which network is this routerInfo a part of.
|
java.lang.String |
getOption(java.lang.String opt) |
|
java.util.Properties |
getOptions() |
推奨されていません。
use getOptionsMap()
|
java.util.Map<java.lang.Object,java.lang.Object> |
getOptionsMap() |
Retrieve a set of options or statistics that the router can expose.
|
java.util.Set<Hash> |
getPeers() |
推奨されていません。
Implemented here but unused elsewhere
|
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).
|
RouterAddress |
getTargetAddress(java.lang.String transportStyle) |
Pull the first workable target address for the given transport.
|
java.util.List<RouterAddress> |
getTargetAddresses(java.lang.String transportStyle) |
For multiple addresses per-transport (IPv4 or IPv6)
|
int |
getType() |
Get the type of the data structure.
|
java.lang.String |
getVersion() |
For convenience, the same as getOption("router.version"),
but returns "0" if unset.
|
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
|
static void |
main(java.lang.String[] args) |
Print out routerinfos from files specified on the command line.
|
void |
readBytes(java.io.InputStream in) |
This does NOT validate the signature
|
void |
readBytes(java.io.InputStream in,
boolean verifySig) |
If verifySig is true,
this validates the signature while reading in,
and throws a DataFormatException if the sig is invalid.
|
void |
setAddresses(java.util.Collection<RouterAddress> 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<Hash> peers) |
推奨されていません。
Implemented here but unused elsewhere
|
void |
setPublished(long published) |
Date on which it was published, in milliseconds since Midnight GMT on Jan 01, 1970
|
java.lang.String |
toString() |
|
boolean |
verifySignature() |
Same as isValid()
|
void |
writeBytes(java.io.OutputStream out) |
This does NOT validate the signature
|
getHash, getRoutingKey, getSignature, getSigningPublicKey, setSignature, sign, validateRoutingKey
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArray
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
public RouterInfo()
public RouterInfo(RouterInfo old)
public long getDate()
DatabaseEntry
getDate
クラス内 DatabaseEntry
public KeysAndCert getKeysAndCert()
DatabaseEntry
getKeysAndCert
クラス内 DatabaseEntry
public int getType()
DatabaseEntry
getType
クラス内 DatabaseEntry
public RouterIdentity getIdentity()
public void setIdentity(RouterIdentity ident)
java.lang.IllegalStateException
- if RouterInfo is already signedpublic long getPublished()
public void setPublished(long published)
java.lang.IllegalStateException
- if RouterInfo is already signedpublic int getAddressCount()
public java.util.Collection<RouterAddress> getAddresses()
public void setAddresses(java.util.Collection<RouterAddress> addresses)
addresses
- may be nulljava.lang.IllegalStateException
- if RouterInfo is already signed or addresses previously set@Deprecated public java.util.Set<Hash> getPeers()
@Deprecated public void setPeers(java.util.Set<Hash> peers)
java.lang.IllegalStateException
- if RouterInfo is already signed@Deprecated public java.util.Properties getOptions()
public java.util.Map<java.lang.Object,java.lang.Object> getOptionsMap()
public java.lang.String getOption(java.lang.String opt)
public java.lang.String getVersion()
public void setOptions(java.util.Properties options)
options
- if null, clears current optionsjava.lang.IllegalStateException
- if RouterInfo is already signedprotected byte[] getBytes() throws DataFormatException
getBytes
クラス内 DatabaseEntry
DataFormatException
- if the data is somehow b0rked (missing props, etc)public boolean isValid()
public boolean verifySignature()
verifySignature
クラス内 DatabaseEntry
public int getNetworkId()
public java.lang.String getCapabilities()
public boolean isHidden()
public java.lang.String getBandwidthTier()
public boolean isCurrent(long maxAgeMs)
maxAgeMs
- milliseconds between the current time and publish date to checkpublic RouterAddress getTargetAddress(java.lang.String transportStyle)
public java.util.List<RouterAddress> getTargetAddresses(java.lang.String transportStyle)
public void readBytes(java.io.InputStream in) throws DataFormatException, java.io.IOException
in
- stream to read fromjava.lang.IllegalStateException
- if RouterInfo was already read inDataFormatException
- if the data is improperly formattedjava.io.IOException
- if there was a problem reading the streampublic void readBytes(java.io.InputStream in, boolean verifySig) throws DataFormatException, java.io.IOException
java.lang.IllegalStateException
- if RouterInfo was already read inDataFormatException
java.io.IOException
public void writeBytes(java.io.OutputStream out) throws DataFormatException, java.io.IOException
out
- stream to write toDataFormatException
- if the data was incomplete or not yet ready to be writtenjava.io.IOException
- if there was a problem writing to the streampublic boolean equals(java.lang.Object object)
equals
クラス内 java.lang.Object
public int hashCode()
hashCode
クラス内 java.lang.Object
public java.lang.String toString()
toString
クラス内 java.lang.Object
public static void main(java.lang.String[] args)