Interface ServerDescriptor
-
- All Superinterfaces:
Descriptor
,java.io.Serializable
- All Known Subinterfaces:
BridgeServerDescriptor
,RelayServerDescriptor
public interface ServerDescriptor extends Descriptor
Contains a relay or sanitized bridge server descriptor.Relays publish server descriptors to the directory authorities to register in the network. Server descriptors contain information about the capabilities of a server, like their exit policy, that clients use to select servers for their circuits (along with information provided by directory authorities on reachability, stability, and capacity of servers). Server descriptors also contain network addresses and cryptographic material that clients use to build circuits.
Prior to the introduction of microdescriptors (
Microdescriptor
), the directory authorities included cryptographic digests of server descriptors in network statuses (RelayNetworkStatusConsensus
) and clients downloaded all referenced server descriptors. Nowadays, the directory authorities derive microdescriptors from server descriptors and reference those in network statuses, and clients only download microdescriptors instead of server descriptors.Bridges publish server descriptors to the bridge directory authority, also to announce themselves in the network. The bridge directory authority compiles a list of available bridges (
BridgeNetworkStatus
) for the bridge distribution service BridgeDB. There are no microdescriptors for bridges, so that bridge clients still rely on downloading bridge server descriptors directly from the bridge they're connecting to.It's worth noting that all contents of server descriptors are written and signed by relays and bridges without a third party verifying their correctness. The (bridge) directory authorities may decide to exclude dishonest servers from the network statuses they produce, but that wouldn't be reflected in server descriptors.
- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getAddress()
Return the server's primary IPv4 address in dotted-quad format.boolean
getAllowSingleHopExits()
Return whether this server allows single-hop circuits to make exit connections.int
getBandwidthBurst()
Return the burst bandwidth in bytes per second that the server is willing to sustain in very short intervals.int
getBandwidthObserved()
Return the observed bandwidth in bytes per second as an estimate of the capacity that the server can handle, or -1 if the descriptor doesn't contain an observed bandwidth value (which is the case for Tor 0.0.8 or older).int
getBandwidthRate()
Return the average bandwidth in bytes per second that the server is willing to sustain over long periods.java.lang.String
getBridgeDistributionRequest()
Return the method how a bridge requests to be distributed by BridgeDB, ornull
if no such request is contained in the descriptor.boolean
getCachesExtraInfo()
Return whether this server is a directory cache that provides extra-info descriptors.java.util.List<java.lang.Integer>
getCircuitProtocolVersions()
Return the list of circuit protocol versions that this server supports.java.lang.String
getContact()
Return the contact information for this server, which may contain non-ASCII characters, or null if no contact information is included in the descriptor.java.lang.String
getDigestSha1Hex()
Return the SHA-1 descriptor digest, encoded as 40 lower-case (relay descriptors) or upper-case (bridge descriptors) hexadecimal characters, that is used to reference this descriptor from a network status descriptor.java.lang.String
getDigestSha256Base64()
Return the SHA-256 descriptor digest, encoded as 43 base64 characters without padding characters, that may be used to reference this server descriptor from a network status descriptor.int
getDirPort()
Return the TCP port where this server accepts directory-related HTTP connections, or 0 if the server does not accept such connections.java.util.List<java.lang.String>
getExitPolicyLines()
Return the server's exit policy consisting of one or more accept or reject rules that the server follows when deciding whether to allow a new stream to a given IP address and TCP port.java.lang.String
getExtraInfoDigestSha1Hex()
Return the SHA-1 digest of the server's extra-info descriptor, encoded as 40 upper-case hexadecimal characters, or null if the server did not upload a corresponding extra-info descriptor.java.lang.String
getExtraInfoDigestSha256Base64()
Return the SHA-256 digest of the server's extra-info descriptor, encoded as 43 base64 characters without padding characters, or null if the server either did not upload a corresponding extra-info descriptor or did not refer to it using a SHA-256 digest.java.util.List<java.lang.String>
getFamilyEntries()
Return nicknames, $-prefixed identity fingerprints, or tuples of the format$fingerprint=nickname
or$fingerprint~nickname
of servers contained in this server's family, or null if the descriptor does not contain a family line.java.lang.String
getFingerprint()
Return a SHA-1 digest of the server's public identity key, encoded as 40 upper-case hexadecimal characters (without spaces after every 4 characters as opposed to the encoding in the descriptor), that is typically used to uniquely identify the server, or null if this descriptor does not contain a fingerprint line.java.util.List<java.lang.Integer>
getHiddenServiceDirVersions()
Deprecated.Replaced withisHiddenServiceDir()
, because Tor has never supported versions in the hidden-service-dir descriptor line.java.lang.String
getIdentityEd25519()
Return the Ed25519 certificate in PEM format, or null if the descriptor doesn't contain one.java.lang.String
getIpv6DefaultPolicy()
Return the default policy,"accept"
or"reject"
, of the IPv6 port summary, or null if the descriptor didn't contain an IPv6 exit-policy summary line which is equivalent to rejecting all streams to IPv6 targets.java.lang.String
getIpv6PortList()
Return the port list of the IPv6 exit-policy summary, or null if the descriptor didn't contain an IPv6 exit-policy summary line which is equivalent to rejecting all streams to IPv6 targets.java.util.List<java.lang.Integer>
getLinkProtocolVersions()
Return the list of link protocol versions that this server supports.java.lang.String
getMasterKeyEd25519()
Return the Ed25519 master key, encoded as 43 base64 characters without padding characters, which was either parsed from the optional"master-key-ed25519"
line or derived from the (likewise optional) Ed25519 certificate following the"identity-ed25519"
line, or null if the descriptor contains neither Ed25519 master key nor Ed25519 certificate.java.lang.String
getNickname()
Return the server's nickname consisting of 1 to 19 alphanumeric characters.java.lang.String
getNtorOnionKey()
Return the curve25519 public key, encoded as 43 base64 characters without padding characters, that is used for the ntor circuit extended handshake, or null if the descriptor didn't contain an ntor-onion-key line.java.lang.String
getNtorOnionKeyCrosscert()
Return an Ed25519 signature in PEM format, generated using the server's ntor onion key, that proves that the party creating the descriptor had control over the private key corresponding to the ntor onion key, or null if the descriptor does not contain such a signature.int
getNtorOnionKeyCrosscertSign()
Return the sign of the Ed25519 public key corresponding to the ntor onion key as 0 or 1, or -1 if the descriptor does not contain this information.java.lang.String
getOnionKey()
Return the RSA-1024 public key in PEM format used to encrypt CREATE cells for this server, or null if the descriptor doesn't contain an onion key (which is the case in sanitized bridge descriptors).java.lang.String
getOnionKeyCrosscert()
Return an RSA-1024 signature in PEM format, generated using the server's onion key, that proves that the party creating the descriptor had control over the private key corresponding to the onion key, or null if the descriptor does not contain such a signature.java.util.List<java.lang.String>
getOrAddresses()
Return IP addresses and TCP ports where this server accepts TLS connections for the main OR protocol, or an empty list if the server does not support additional addresses or ports; entries are given in the order as they are listed in the descriptor; IPv4 addresses are given in dotted-quad format, IPv6 addresses use the colon-separated hexadecimal format surrounded by square brackets, and TCP ports are separated from the IP address using a colon.int
getOrPort()
Return the TCP port where this server accepts TLS connections for the main OR protocol, or 0 if the server does not accept such connections.java.lang.String
getPlatform()
Return a human-readable string describing the Tor software version and the operating system of this server, which may contain non-ASCII characters, typically written as"Tor $version on $system"
, or null if this descriptor does not contain a platform line.java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.Long>>
getProtocols()
Return the version numbers of all protocols supported by this server, or null if this descriptor does not specify supported protocol versions.long
getPublishedMillis()
Return the time in milliseconds since the epoch when this descriptor and the corresponding extra-info descriptor were generated.BandwidthHistory
getReadHistory()
Return the server's history of read bytes, or null if the descriptor does not contain a bandwidth history; current Tor versions include bandwidth histories in their extra-info descriptors (ExtraInfoDescriptor.getReadHistory()
), not in their server descriptors.java.lang.String
getRouterSignature()
Return the RSA-1024 signature of the PKCS1-padded descriptor digest, taken from the beginning of the router line through the newline after the router-signature line, or null if the descriptor doesn't contain a signature (which is the case in sanitized bridge descriptors).java.lang.String
getRouterSignatureEd25519()
Return the Ed25519 signature of the SHA-256 digest of the entire descriptor, encoded as 86 base64 characters without padding characters, from the first character up to and including the first space after the"router-sig-ed25519"
string, prefixed with the string"Tor router descriptor signature v1"
.java.lang.String
getSigningKey()
Return the RSA-1024 public key in PEM format used by this server as long-term identity key, or null if the descriptor doesn't contain a signing key (which is the case in sanitized bridge descriptors).int
getSocksPort()
Return the TCP port where this server accepts SOCKS connections, which is deprecated in the Tor Protocol and should always be 0.boolean
getTunnelledDirServer()
Return whether the server accepts "tunneled" directory requests using a BEGIN_DIR cell over the server's OR port.java.lang.Long
getUptime()
Return the number of seconds that the server process has been running (which might even be negative in a few descriptors due to a bug that was fixed in Tor 0.1.2.7-alpha), or null if the descriptor does not contain an uptime line.boolean
getUsesEnhancedDnsLogic()
Return true if the server uses the enhanced DNS logic, or false if doesn't use it or doesn't include an eventdns line in its descriptor; current Tor versions should be presumed to have the evdns backend.BandwidthHistory
getWriteHistory()
Return the server's history of written bytes, or null if the descriptor does not contain a bandwidth history; current Tor versions include bandwidth histories in their extra-info descriptors (ExtraInfoDescriptor.getWriteHistory()
), not in their server descriptors.boolean
isHibernating()
Return whether the server was hibernating when this descriptor was published and should not be used to build circuits.boolean
isHiddenServiceDir()
Return whether this server stores and serves hidden service descriptors.-
Methods inherited from interface org.torproject.descriptor.Descriptor
getAnnotations, getDescriptorFile, getRawDescriptorBytes, getRawDescriptorLength, getUnrecognizedLines
-
-
-
-
Method Detail
-
getDigestSha1Hex
java.lang.String getDigestSha1Hex()
Return the SHA-1 descriptor digest, encoded as 40 lower-case (relay descriptors) or upper-case (bridge descriptors) hexadecimal characters, that is used to reference this descriptor from a network status descriptor.- Since:
- 1.7.0
-
getDigestSha256Base64
java.lang.String getDigestSha256Base64()
Return the SHA-256 descriptor digest, encoded as 43 base64 characters without padding characters, that may be used to reference this server descriptor from a network status descriptor.- Since:
- 1.7.0
-
getNickname
java.lang.String getNickname()
Return the server's nickname consisting of 1 to 19 alphanumeric characters.- Since:
- 1.0.0
-
getAddress
java.lang.String getAddress()
Return the server's primary IPv4 address in dotted-quad format.- Since:
- 1.0.0
-
getOrPort
int getOrPort()
Return the TCP port where this server accepts TLS connections for the main OR protocol, or 0 if the server does not accept such connections.- Since:
- 1.0.0
-
getSocksPort
int getSocksPort()
Return the TCP port where this server accepts SOCKS connections, which is deprecated in the Tor Protocol and should always be 0.- Since:
- 1.0.0
-
getDirPort
int getDirPort()
Return the TCP port where this server accepts directory-related HTTP connections, or 0 if the server does not accept such connections.- Since:
- 1.0.0
-
getOrAddresses
java.util.List<java.lang.String> getOrAddresses()
Return IP addresses and TCP ports where this server accepts TLS connections for the main OR protocol, or an empty list if the server does not support additional addresses or ports; entries are given in the order as they are listed in the descriptor; IPv4 addresses are given in dotted-quad format, IPv6 addresses use the colon-separated hexadecimal format surrounded by square brackets, and TCP ports are separated from the IP address using a colon.- Since:
- 1.0.0
-
getBandwidthRate
int getBandwidthRate()
Return the average bandwidth in bytes per second that the server is willing to sustain over long periods.- Since:
- 1.0.0
-
getBandwidthBurst
int getBandwidthBurst()
Return the burst bandwidth in bytes per second that the server is willing to sustain in very short intervals.- Since:
- 1.0.0
-
getBandwidthObserved
int getBandwidthObserved()
Return the observed bandwidth in bytes per second as an estimate of the capacity that the server can handle, or -1 if the descriptor doesn't contain an observed bandwidth value (which is the case for Tor 0.0.8 or older).- Since:
- 1.0.0
-
getPlatform
java.lang.String getPlatform()
Return a human-readable string describing the Tor software version and the operating system of this server, which may contain non-ASCII characters, typically written as"Tor $version on $system"
, or null if this descriptor does not contain a platform line.- Since:
- 1.0.0
-
getProtocols
java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.Long>> getProtocols()
Return the version numbers of all protocols supported by this server, or null if this descriptor does not specify supported protocol versions.- Since:
- 1.6.0
-
getPublishedMillis
long getPublishedMillis()
Return the time in milliseconds since the epoch when this descriptor and the corresponding extra-info descriptor were generated.- Since:
- 1.0.0
-
getFingerprint
java.lang.String getFingerprint()
Return a SHA-1 digest of the server's public identity key, encoded as 40 upper-case hexadecimal characters (without spaces after every 4 characters as opposed to the encoding in the descriptor), that is typically used to uniquely identify the server, or null if this descriptor does not contain a fingerprint line.- Since:
- 1.0.0
-
isHibernating
boolean isHibernating()
Return whether the server was hibernating when this descriptor was published and should not be used to build circuits.- Since:
- 1.0.0
-
getUptime
java.lang.Long getUptime()
Return the number of seconds that the server process has been running (which might even be negative in a few descriptors due to a bug that was fixed in Tor 0.1.2.7-alpha), or null if the descriptor does not contain an uptime line.- Since:
- 1.0.0
-
getOnionKey
java.lang.String getOnionKey()
Return the RSA-1024 public key in PEM format used to encrypt CREATE cells for this server, or null if the descriptor doesn't contain an onion key (which is the case in sanitized bridge descriptors).- Since:
- 1.0.0
-
getSigningKey
java.lang.String getSigningKey()
Return the RSA-1024 public key in PEM format used by this server as long-term identity key, or null if the descriptor doesn't contain a signing key (which is the case in sanitized bridge descriptors).- Since:
- 1.0.0
-
getExitPolicyLines
java.util.List<java.lang.String> getExitPolicyLines()
Return the server's exit policy consisting of one or more accept or reject rules that the server follows when deciding whether to allow a new stream to a given IP address and TCP port.- Since:
- 1.0.0
-
getRouterSignature
java.lang.String getRouterSignature()
Return the RSA-1024 signature of the PKCS1-padded descriptor digest, taken from the beginning of the router line through the newline after the router-signature line, or null if the descriptor doesn't contain a signature (which is the case in sanitized bridge descriptors).- Since:
- 1.0.0
-
getContact
java.lang.String getContact()
Return the contact information for this server, which may contain non-ASCII characters, or null if no contact information is included in the descriptor.- Since:
- 1.0.0
-
getBridgeDistributionRequest
java.lang.String getBridgeDistributionRequest()
Return the method how a bridge requests to be distributed by BridgeDB, ornull
if no such request is contained in the descriptor.- Since:
- 2.11.0
-
getFamilyEntries
java.util.List<java.lang.String> getFamilyEntries()
Return nicknames, $-prefixed identity fingerprints, or tuples of the format$fingerprint=nickname
or$fingerprint~nickname
of servers contained in this server's family, or null if the descriptor does not contain a family line.- Since:
- 1.0.0
-
getReadHistory
BandwidthHistory getReadHistory()
Return the server's history of read bytes, or null if the descriptor does not contain a bandwidth history; current Tor versions include bandwidth histories in their extra-info descriptors (ExtraInfoDescriptor.getReadHistory()
), not in their server descriptors.- Since:
- 1.0.0
-
getWriteHistory
BandwidthHistory getWriteHistory()
Return the server's history of written bytes, or null if the descriptor does not contain a bandwidth history; current Tor versions include bandwidth histories in their extra-info descriptors (ExtraInfoDescriptor.getWriteHistory()
), not in their server descriptors.- Since:
- 1.0.0
-
getUsesEnhancedDnsLogic
boolean getUsesEnhancedDnsLogic()
Return true if the server uses the enhanced DNS logic, or false if doesn't use it or doesn't include an eventdns line in its descriptor; current Tor versions should be presumed to have the evdns backend.- Since:
- 1.0.0
-
getCachesExtraInfo
boolean getCachesExtraInfo()
Return whether this server is a directory cache that provides extra-info descriptors.- Since:
- 1.0.0
-
getExtraInfoDigestSha1Hex
java.lang.String getExtraInfoDigestSha1Hex()
Return the SHA-1 digest of the server's extra-info descriptor, encoded as 40 upper-case hexadecimal characters, or null if the server did not upload a corresponding extra-info descriptor.- Since:
- 1.7.0
-
getExtraInfoDigestSha256Base64
java.lang.String getExtraInfoDigestSha256Base64()
Return the SHA-256 digest of the server's extra-info descriptor, encoded as 43 base64 characters without padding characters, or null if the server either did not upload a corresponding extra-info descriptor or did not refer to it using a SHA-256 digest.- Since:
- 1.7.0
-
getHiddenServiceDirVersions
@Deprecated java.util.List<java.lang.Integer> getHiddenServiceDirVersions()
Deprecated.Replaced withisHiddenServiceDir()
, because Tor has never supported versions in the hidden-service-dir descriptor line.Return the list of hidden service descriptor version numbers that this server stores and serves, or null if it doesn't store and serve any hidden service descriptors.- Since:
- 1.0.0
-
isHiddenServiceDir
boolean isHiddenServiceDir()
Return whether this server stores and serves hidden service descriptors.- Since:
- 2.3.0
-
getLinkProtocolVersions
java.util.List<java.lang.Integer> getLinkProtocolVersions()
Return the list of link protocol versions that this server supports.- Since:
- 1.0.0
-
getCircuitProtocolVersions
java.util.List<java.lang.Integer> getCircuitProtocolVersions()
Return the list of circuit protocol versions that this server supports.- Since:
- 1.0.0
-
getAllowSingleHopExits
boolean getAllowSingleHopExits()
Return whether this server allows single-hop circuits to make exit connections.- Since:
- 1.0.0
-
getIpv6DefaultPolicy
java.lang.String getIpv6DefaultPolicy()
Return the default policy,"accept"
or"reject"
, of the IPv6 port summary, or null if the descriptor didn't contain an IPv6 exit-policy summary line which is equivalent to rejecting all streams to IPv6 targets.- Since:
- 1.0.0
-
getIpv6PortList
java.lang.String getIpv6PortList()
Return the port list of the IPv6 exit-policy summary, or null if the descriptor didn't contain an IPv6 exit-policy summary line which is equivalent to rejecting all streams to IPv6 targets.- Since:
- 1.0.0
-
getNtorOnionKey
java.lang.String getNtorOnionKey()
Return the curve25519 public key, encoded as 43 base64 characters without padding characters, that is used for the ntor circuit extended handshake, or null if the descriptor didn't contain an ntor-onion-key line.
-
getIdentityEd25519
java.lang.String getIdentityEd25519()
Return the Ed25519 certificate in PEM format, or null if the descriptor doesn't contain one.- Since:
- 1.1.0
-
getMasterKeyEd25519
java.lang.String getMasterKeyEd25519()
Return the Ed25519 master key, encoded as 43 base64 characters without padding characters, which was either parsed from the optional"master-key-ed25519"
line or derived from the (likewise optional) Ed25519 certificate following the"identity-ed25519"
line, or null if the descriptor contains neither Ed25519 master key nor Ed25519 certificate.- Since:
- 1.1.0
-
getRouterSignatureEd25519
java.lang.String getRouterSignatureEd25519()
Return the Ed25519 signature of the SHA-256 digest of the entire descriptor, encoded as 86 base64 characters without padding characters, from the first character up to and including the first space after the"router-sig-ed25519"
string, prefixed with the string"Tor router descriptor signature v1"
.- Since:
- 1.1.0
-
getOnionKeyCrosscert
java.lang.String getOnionKeyCrosscert()
Return an RSA-1024 signature in PEM format, generated using the server's onion key, that proves that the party creating the descriptor had control over the private key corresponding to the onion key, or null if the descriptor does not contain such a signature.- Since:
- 1.1.0
-
getNtorOnionKeyCrosscert
java.lang.String getNtorOnionKeyCrosscert()
Return an Ed25519 signature in PEM format, generated using the server's ntor onion key, that proves that the party creating the descriptor had control over the private key corresponding to the ntor onion key, or null if the descriptor does not contain such a signature.- Since:
- 1.1.0
-
getNtorOnionKeyCrosscertSign
int getNtorOnionKeyCrosscertSign()
Return the sign of the Ed25519 public key corresponding to the ntor onion key as 0 or 1, or -1 if the descriptor does not contain this information.- Since:
- 1.1.0
-
getTunnelledDirServer
boolean getTunnelledDirServer()
Return whether the server accepts "tunneled" directory requests using a BEGIN_DIR cell over the server's OR port.- Since:
- 1.3.0
-
-