dir-spec.txt 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366
  1. Tor directory protocol, version 3
  2. 0. Scope and preliminaries
  3. This directory protocol is used by Tor version 0.2.0.x-alpha and later.
  4. See dir-spec-v1.txt for information on the protocol used up to the
  5. 0.1.0.x series, and dir-spec-v2.txt for information on the protocol
  6. used by the 0.1.1.x and 0.1.2.x series.
  7. Caches and authorities must still support older versions of the
  8. directory protocols, until the versions of Tor that require them are
  9. finally out of commission.
  10. This document merges and supersedes the following proposals:
  11. 101 Voting on the Tor Directory System
  12. 103 Splitting identity key from regularly used signing key
  13. 104 Long and Short Router Descriptors
  14. AS OF 14 JUNE 2007, THIS SPECIFICATION HAS NOT YET BEEN COMPLETELY
  15. IMPLEMENTED, OR COMPLETELY COMPLETED.
  16. XXX when to download certificates.
  17. XXX timeline
  18. XXX fill in XXXXs
  19. 0.1. History
  20. The earliest versions of Onion Routing shipped with a list of known
  21. routers and their keys. When the set of routers changed, users needed to
  22. fetch a new list.
  23. The Version 1 Directory protocol
  24. --------------------------------
  25. Early versions of Tor (0.0.2) introduced "Directory authorities": servers
  26. that served signed "directory" documents containing a list of signed
  27. "router descriptors", along with short summary of the status of each
  28. router. Thus, clients could get up-to-date information on the state of
  29. the network automatically, and be certain that the list they were getting
  30. was attested by a trusted directory authority.
  31. Later versions (0.0.8) added directory caches, which download
  32. directories from the authorities and serve them to clients. Non-caches
  33. fetch from the caches in preference to fetching from the authorities, thus
  34. distributing bandwidth requirements.
  35. Also added during the version 1 directory protocol were "router status"
  36. documents: short documents that listed only the up/down status of the
  37. routers on the network, rather than a complete list of all the
  38. descriptors. Clients and caches would fetch these documents far more
  39. frequently than they would fetch full directories.
  40. The Version 2 Directory Protocol
  41. --------------------------------
  42. During the Tor 0.1.1.x series, Tor revised its handling of directory
  43. documents in order to address two major problems:
  44. * Directories had grown quite large (over 1MB), and most directory
  45. downloads consisted mainly of router descriptors that clients
  46. already had.
  47. * Every directory authority was a trust bottleneck: if a single
  48. directory authority lied, it could make clients believe for a time
  49. an arbitrarily distorted view of the Tor network. (Clients
  50. trusted the most recent signed document they downloaded.) Thus,
  51. adding more authorities would make the system less secure, not
  52. more.
  53. To address these, we extended the directory protocol so that
  54. authorities now published signed "network status" documents. Each
  55. network status listed, for every router in the network: a hash of its
  56. identity key, a hash of its most recent descriptor, and a summary of
  57. what the authority believed about its status. Clients would download
  58. the authorities' network status documents in turn, and believe
  59. statements about routers iff they were attested to by more than half of
  60. the authorities.
  61. Instead of downloading all router descriptors at once, clients
  62. downloaded only the descriptors that they did not have. Descriptors
  63. were indexed by their digests, in order to prevent malicious caches
  64. from giving different versions of a router descriptor to different
  65. clients.
  66. Routers began working harder to upload new descriptors only when their
  67. contents were substantially changed.
  68. 0.2. Goals of the version 3 protocol
  69. Version 3 of the Tor directory protocol tries to solve the following
  70. issues:
  71. * A great deal of bandwidth used to transmit router descriptors was
  72. used by two fields that are not actually used by Tor routers
  73. (namely read-history and write-history). We save about 60% by
  74. moving them into a separate document that most clients do not
  75. fetch or use.
  76. * It was possible under certain perverse circumstances for clients
  77. to download an unusual set of network status documents, thus
  78. partitioning themselves from clients who have a more recent and/or
  79. typical set of documents. Even under the best of circumstances,
  80. clients were sensitive to the ages of the network status documents
  81. they downloaded. Therefore, instead of having the clients
  82. correlate multiple network status documents, we have the
  83. authorities collectively vote on a single consensus network status
  84. document.
  85. * The most sensitive data in the entire network (the identity keys
  86. of the directory authorities) needed to be stored unencrypted so
  87. that the authorities can sign network-status documents on the fly.
  88. Now, the authorities' identity keys are stored offline, and used
  89. to certify medium-term signing keys that can be rotated.
  90. 0.3. Some Remaining questions
  91. Things we could solve on a v3 timeframe:
  92. The SHA-1 hash is showing its age. We should do something about our
  93. dependency on it. We could probably future-proof ourselves here in
  94. this revision, at least so far as documents from the authorities are
  95. concerned.
  96. Too many things about the authorities are hardcoded by IP.
  97. Perhaps we should start accepting longer identity keys for routers
  98. too.
  99. Things to solve eventually:
  100. Requiring every client to know about every router won't scale forever.
  101. Requiring every directory cache to know every router won't scale
  102. forever.
  103. 1. Outline
  104. There is a small set (say, around 5-10) of semi-trusted directory
  105. authorities. A default list of authorities is shipped with the Tor
  106. software. Users can change this list, but are encouraged not to do so,
  107. in order to avoid partitioning attacks.
  108. Every authority has a very-secret, long-term "Authority Identity Key".
  109. This is stored encrypted and/or offline, and is used to sign "key
  110. certificate" documents. Every key certificate contains a medium-term
  111. (3-12 months) "authority signing key", that is used by the authority to
  112. sign other directory information. (Note that the authority identity
  113. key is distinct from the router identity key that the authority uses
  114. in its role as an ordinary router.)
  115. Routers periodically upload signed "routers descriptors" to the
  116. directory authorities describing their keys, capabilities, and other
  117. information. Routers may also upload signed "extra info documents"
  118. containing information that is not required for the Tor protocol.
  119. Directory authorities serve router descriptors indexed by router
  120. identity, or by hash of the descriptor.
  121. Routers may act as directory caches to reduce load on the directory
  122. authorities. They announce this in their descriptors.
  123. Periodically, each directory authority generates a view of
  124. the current descriptors and status for known routers. They send a
  125. signed summary of this view (a "status vote") to the other
  126. authorities. The authorities compute the result of this vote, and sign
  127. a "consensus status" document containing the result of the vote.
  128. Directory caches download, cache, and re-serve consensus documents.
  129. Clients, directory caches, and directory authorities all use consensus
  130. documents to find out when their list of routers is out-of-date.
  131. (Directory authorities also use vote statuses.) If it is, they download
  132. any missing router descriptors. Clients download missing descriptors
  133. from caches; caches and authorities download from authorities.
  134. Descriptors are downloaded by the hash of the descriptor, not by the
  135. server's identity key: this prevents servers from attacking clients by
  136. giving them descriptors nobody else uses.
  137. All directory information is uploaded and downloaded with HTTP.
  138. [Authorities also generate and caches also cache documents produced and
  139. used by earlier versions of this protocol; see dir-spec-v1.txt and
  140. dir-spec-v2.txt for notes on those versions.]
  141. 1.1. What's different from version 2?
  142. Clients used to download multiple network status documents,
  143. corresponding roughly to "status votes" above. They would compute the
  144. result of the vote on the client side.
  145. Authorities used to sign documents using the same private keys they used
  146. for their roles as routers. This forced them to keep these extremely
  147. sensitive keys in memory unencrypted.
  148. All of the information in extra-info documents used to be kept in the
  149. main descriptors.
  150. 1.2. Document meta-format
  151. Router descriptors, directories, and running-routers documents all obey the
  152. following lightweight extensible information format.
  153. The highest level object is a Document, which consists of one or more
  154. Items. Every Item begins with a KeywordLine, followed by zero or more
  155. Objects. A KeywordLine begins with a Keyword, optionally followed by
  156. whitespace and more non-newline characters, and ends with a newline. A
  157. Keyword is a sequence of one or more characters in the set [A-Za-z0-9-].
  158. An Object is a block of encoded data in pseudo-Open-PGP-style
  159. armor. (cf. RFC 2440)
  160. More formally:
  161. NL = The ascii LF character (hex value 0x0a).
  162. Document ::= (Item | NL)+
  163. Item ::= KeywordLine Object*
  164. KeywordLine ::= Keyword NL | Keyword WS ArgumentChar+ NL
  165. Keyword = KeywordChar+
  166. KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'
  167. ArgumentChar ::= any printing ASCII character except NL.
  168. WS = (SP | TAB)+
  169. Object ::= BeginLine Base-64-encoded-data EndLine
  170. BeginLine ::= "-----BEGIN " Keyword "-----" NL
  171. EndLine ::= "-----END " Keyword "-----" NL
  172. The BeginLine and EndLine of an Object must use the same keyword.
  173. When interpreting a Document, software MUST ignore any KeywordLine that
  174. starts with a keyword it doesn't recognize; future implementations MUST NOT
  175. require current clients to understand any KeywordLine not currently
  176. described.
  177. The "opt" keyword was used until Tor 0.1.2.5-alpha for non-critical future
  178. extensions. All implementations MUST ignore any item of the form "opt
  179. keyword ....." when they would not recognize "keyword ....."; and MUST
  180. treat "opt keyword ....." as synonymous with "keyword ......" when keyword
  181. is recognized.
  182. Implementations before 0.1.2.5-alpha rejected any document with a
  183. KeywordLine that started with a keyword that they didn't recognize.
  184. When generating documents that need to be read by older versions of Tor,
  185. implementations MUST prefix items not recognized by older versions of
  186. Tor with an "opt" until those versions of Tor are obsolete. [Note that
  187. key certificates, status vote documents, extra info documents, and
  188. status consensus documents will never be read by older versions of Tor.]
  189. Other implementations that want to extend Tor's directory format MAY
  190. introduce their own items. The keywords for extension items SHOULD start
  191. with the characters "x-" or "X-", to guarantee that they will not conflict
  192. with keywords used by future versions of Tor.
  193. In our document descriptions below, we tag Items with a multiplicity in
  194. brackets. Possible tags are:
  195. "At start, exactly once": These items MUST occur in every instance of
  196. the document type, and MUST appear exactly once, and MUST be the
  197. first item in their documents.
  198. "Exactly once": These items MUST occur exactly one time in every
  199. instance of the document type.
  200. "At end, exactly once": These items MUST occur in every instance of
  201. the document type, and MUST appear exactly once, and MUST be the
  202. last item in their documents.
  203. "At most once": These items MAY occur zero or one times in any
  204. instance of the document type, but MUST NOT occur more than once.
  205. "Any number": These items MAY occur zero, one, or more times in any
  206. instance of the document type.
  207. "Once or more": These items MUST occur at least once in any instance
  208. of the document type, and MAY occur more.
  209. 1.3. Signing documents
  210. Every signable document below is signed in a similar manner, using a
  211. given "Initial Item", a final "Signature Item", a digest algorithm, and
  212. a signing key.
  213. The Initial Item must be the first item in the document.
  214. The Signature Item has the following format:
  215. <signature item keyword> [arguments] NL SIGNATURE NL
  216. The "SIGNATURE" Object contains a signature (using the signing key) of
  217. the PKCS1-padded digest of the entire document, taken from the
  218. beginning of the Initial item, through the newline after the Signature
  219. Item's keyword and its arguments.
  220. Unless otherwise, the digest algorithm is SHA-1.
  221. All documents are invalid unless signed with the correct signing key.
  222. The "Digest" of a document, unless stated otherwise, is its digest *as
  223. signed by this signature scheme*.
  224. 1.4. Voting timeline
  225. Every consensus document has a "valid-after" (VA) time, a "fresh-until"
  226. (FU) time and a "valid-until" (VU) time. VA MUST precede FU, which MUST
  227. in turn precede VU. Times are chosen so that every consensus will be
  228. "fresh" until the next consensus becomes valid, and "valid" for a while
  229. after. At least 3 consensuses should be valid at any given time.
  230. The timeline for a given consensus is as follows:
  231. VA-DistSeconds-VoteSeconds: The authorities exchange votes.
  232. VA-DistSeconds-VoteSeconds/2: The authorities try to download any
  233. votes they don't have.
  234. VA-DistSeconds: The authorities calculate the consensus and exchange
  235. signatures.
  236. VA-DistSeconds/2: The authorities try to download any signatures
  237. they don't have.
  238. VA: All authorities have a multiply signed consensus.
  239. VA ... FU: Caches download the consensus. (Note that since caches have
  240. no way of telling what VA and FU are until they have downloaded
  241. the consensus, they assume that the present consensus's VA is
  242. equal to the previous one's FU, and that its FU is one interval after
  243. that.)
  244. FU: The consensus is no longer the freshest consensus.
  245. FU ... (the current consensus's VU): Clients download the consensus.
  246. (See note above: clients guess that the next consensus's FU will be
  247. two intervals after the current VA.)
  248. VU: The consensus is no longer valid.
  249. VoteSeconds and DistSeconds MUST each be at least 20 seconds; FU-VA and
  250. VU-FU MUST each be at least 5 minutes.
  251. 2. Router operation and formats
  252. ORs SHOULD generate a new router descriptor and a new extra-info
  253. document whenever any of the following events have occurred:
  254. - A period of time (18 hrs by default) has passed since the last
  255. time a descriptor was generated.
  256. - A descriptor field other than bandwidth or uptime has changed.
  257. - Bandwidth has changed by a factor of 2 from the last time a
  258. descriptor was generated, and at least a given interval of time
  259. (20 mins by default) has passed since then.
  260. - Its uptime has been reset (by restarting).
  261. [XXX this list is incomplete; see router_differences_are_cosmetic()
  262. in routerlist.c for others]
  263. ORs SHOULD NOT publish a new router descriptor or extra-info document
  264. if none of the above events have occurred and not much time has passed
  265. (12 hours by default).
  266. After generating a descriptor, ORs upload them to every directory
  267. authority they know, by posting them (in order) to the URL
  268. http://<hostname:port>/tor/
  269. 2.1. Router descriptor format
  270. Router descriptors consist of the following items. For backward
  271. compatibility, there should be an extra NL at the end of each router
  272. descriptor.
  273. In lines that take multiple arguments, extra arguments SHOULD be
  274. accepted and ignored. Many of the nonterminals below are defined in
  275. section 2.3.
  276. "router" nickname address ORPort SOCKSPort DirPort NL
  277. [At start, exactly once.]
  278. Indicates the beginning of a router descriptor. "nickname" must be a
  279. valid router nickname as specified in 2.3. "address" must be an IPv4
  280. address in dotted-quad format. The last three numbers indicate the
  281. TCP ports at which this OR exposes functionality. ORPort is a port at
  282. which this OR accepts TLS connections for the main OR protocol;
  283. SOCKSPort is deprecated and should always be 0; and DirPort is the
  284. port at which this OR accepts directory-related HTTP connections. If
  285. any port is not supported, the value 0 is given instead of a port
  286. number. (At least one of DirPort and ORPort SHOULD be set;
  287. authorities MAY reject any descriptor with both DirPort and ORPort of
  288. 0.)
  289. "bandwidth" bandwidth-avg bandwidth-burst bandwidth-observed NL
  290. [Exactly once]
  291. Estimated bandwidth for this router, in bytes per second. The
  292. "average" bandwidth is the volume per second that the OR is willing to
  293. sustain over long periods; the "burst" bandwidth is the volume that
  294. the OR is willing to sustain in very short intervals. The "observed"
  295. value is an estimate of the capacity this server can handle. The
  296. server remembers the max bandwidth sustained output over any ten
  297. second period in the past day, and another sustained input. The
  298. "observed" value is the lesser of these two numbers.
  299. "platform" string NL
  300. [At most once]
  301. A human-readable string describing the system on which this OR is
  302. running. This MAY include the operating system, and SHOULD include
  303. the name and version of the software implementing the Tor protocol.
  304. "published" YYYY-MM-DD HH:MM:SS NL
  305. [Exactly once]
  306. The time, in GMT, when this descriptor (and its corresponding
  307. extra-info document if any) was generated.
  308. "fingerprint" fingerprint NL
  309. [At most once]
  310. A fingerprint (a HASH_LEN-byte of asn1 encoded public key, encoded in
  311. hex, with a single space after every 4 characters) for this router's
  312. identity key. A descriptor is considered invalid (and MUST be
  313. rejected) if the fingerprint line does not match the public key.
  314. [We didn't start parsing this line until Tor 0.1.0.6-rc; it should
  315. be marked with "opt" until earlier versions of Tor are obsolete.]
  316. "hibernating" bool NL
  317. [At most once]
  318. If the value is 1, then the Tor server was hibernating when the
  319. descriptor was published, and shouldn't be used to build circuits.
  320. [We didn't start parsing this line until Tor 0.1.0.6-rc; it should be
  321. marked with "opt" until earlier versions of Tor are obsolete.]
  322. "uptime" number NL
  323. [At most once]
  324. The number of seconds that this OR process has been running.
  325. "onion-key" NL a public key in PEM format
  326. [Exactly once]
  327. This key is used to encrypt EXTEND cells for this OR. The key MUST be
  328. accepted for at least 1 week after any new key is published in a
  329. subsequent descriptor. It MUST be 1024 bits.
  330. "signing-key" NL a public key in PEM format
  331. [Exactly once]
  332. The OR's long-term identity key. It MUST be 1024 bits.
  333. "accept" exitpattern NL
  334. "reject" exitpattern NL
  335. [Any number]
  336. These lines describe an "exit policy": the rules that an OR follows
  337. when deciding whether to allow a new stream to a given address. The
  338. 'exitpattern' syntax is described below. There MUST be at least one
  339. such entry. The rules are considered in order; if no rule matches,
  340. the address will be accepted. For clarity, the last such entry SHOULD
  341. be accept *:* or reject *:*.
  342. "router-signature" NL Signature NL
  343. [At end, exactly once]
  344. The "SIGNATURE" object contains a signature of the PKCS1-padded
  345. hash of the entire router descriptor, taken from the beginning of the
  346. "router" line, through the newline after the "router-signature" line.
  347. The router descriptor is invalid unless the signature is performed
  348. with the router's identity key.
  349. "contact" info NL
  350. [At most once]
  351. Describes a way to contact the server's administrator, preferably
  352. including an email address and a PGP key fingerprint.
  353. "family" names NL
  354. [At most once]
  355. 'Names' is a space-separated list of server nicknames or
  356. hexdigests. If two ORs list one another in their "family" entries,
  357. then OPs should treat them as a single OR for the purpose of path
  358. selection.
  359. For example, if node A's descriptor contains "family B", and node B's
  360. descriptor contains "family A", then node A and node B should never
  361. be used on the same circuit.
  362. "read-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  363. [At most once]
  364. "write-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  365. [At most once]
  366. Declare how much bandwidth the OR has used recently. Usage is divided
  367. into intervals of NSEC seconds. The YYYY-MM-DD HH:MM:SS field
  368. defines the end of the most recent interval. The numbers are the
  369. number of bytes used in the most recent intervals, ordered from
  370. oldest to newest.
  371. [We didn't start parsing these lines until Tor 0.1.0.6-rc; they should
  372. be marked with "opt" until earlier versions of Tor are obsolete.]
  373. [See also migration notes in section 2.2.1.]
  374. "eventdns" bool NL
  375. [At most once]
  376. Declare whether this version of Tor is using the newer enhanced
  377. dns logic. Versions of Tor with this field set to false SHOULD NOT
  378. be used for reverse hostname lookups.
  379. [All versions of Tor before 0.1.2.2-alpha should be assumed to have
  380. this option set to 0 if it is not present. All Tor versions at
  381. 0.1.2.2-alpha or later should be assumed to have this option set to
  382. 1 if it is not present. Until 0.1.2.1-alpha-dev, this option was
  383. not generated, even when the new DNS code was in use. Versions of Tor
  384. before 0.1.2.1-alpha-dev did not parse this option, so it should be
  385. marked "opt". The dnsworker logic has been removed, so this option
  386. should not be used by new server code. However, it can still be
  387. used, and should still be recognized by new code until Tor 0.1.2.x
  388. is obsolete.]
  389. "caches-extra-info" NL
  390. [At most once.]
  391. Present only if this router is a directory cache that provides
  392. extra-info documents.
  393. [Versions before 0.2.0.1-alpha don't recognize this, and versions
  394. before 0.1.2.5-alpha will reject descriptors containing it unless
  395. it is prefixed with "opt"; it should be so prefixed until these
  396. versions are obsolete.]
  397. "extra-info-digest" digest NL
  398. [At most once]
  399. "Digest" is a hex-encoded digest (using upper-case characters) of the
  400. router's extra-info document, as signed in the router's extra-info
  401. (that is, not including the signature). (If this field is absent, the
  402. router is not uploading a corresponding extra-info document.)
  403. [Versions before 0.2.0.1-alpha don't recognize this, and versions
  404. before 0.1.2.5-alpha will reject descriptors containing it unless
  405. it is prefixed with "opt"; it should be so prefixed until these
  406. versions are obsolete.]
  407. "hidden-service-dir" *(SP VersionNum) NL
  408. [At most once.]
  409. Present only if this router stores and serves hidden service
  410. descriptors. If any VersionNum(s) are specified, this router
  411. supports those descriptor versions. If none are specified, it
  412. defaults to version 2 descriptors.
  413. [Versions of Tor before 0.1.2.5-alpha rejected router descriptors
  414. with unrecognized items; the protocols line should be preceded with
  415. an "opt" until these Tors are obsolete.]
  416. "protocols" SP "Link" SP LINK-VERSION-LIST SP "Circuit" SP
  417. CIRCUIT-VERSION-LIST NL
  418. [At most once.]
  419. Both lists are space-separated sequences of numbers, to indicate which
  420. protocols the server supports. As of 30 Mar 2008, specified
  421. protocols are "Link 1 2 Circuit 1". See section 4.1 of tor-spec.txt
  422. for more information about link protocol versions.
  423. [Versions of Tor before 0.1.2.5-alpha rejected router descriptors
  424. with unrecognized items; the protocols line should be preceded with
  425. an "opt" until these Tors are obsolete.]
  426. "allow-single-hop-exits" NL
  427. [At most once.]
  428. Present only if the router allows single-hop circuits to make exit
  429. connections. Most Tor servers do not support this: this is
  430. included for specialized controllers designed to support perspective
  431. access and such.
  432. 2.2. Extra-info documents
  433. Extra-info documents consist of the following items:
  434. "extra-info" Nickname Fingerprint NL
  435. [At start, exactly once.]
  436. Identifies what router this is an extra info descriptor for.
  437. Fingerprint is encoded in hex (using upper-case letters), with
  438. no spaces.
  439. "published" YYYY-MM-DD HH:MM:SS NL
  440. [Exactly once.]
  441. The time, in GMT, when this document (and its corresponding router
  442. descriptor if any) was generated. It MUST match the published time
  443. in the corresponding router descriptor.
  444. "read-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  445. [At most once.]
  446. "write-history" YYYY-MM-DD HH:MM:SS (NSEC s) NUM,NUM,NUM,NUM,NUM... NL
  447. [At most once.]
  448. As documented in 2.1 above. See migration notes in section 2.2.1.
  449. ("geoip-start" YYYY-MM-DD HH:MM:SS NL)
  450. ("geoip-client-origins" CC=N,CC=N,... NL)
  451. Only generated by bridge routers (see blocking.pdf), and only
  452. when they have been configured with a geoip database.
  453. Non-bridges SHOULD NOT generate these fields. Contains a list
  454. of mappings from two-letter country codes (CC) to the number
  455. of clients that have connected to that bridge from that
  456. country (approximate, and rounded up to the nearest multiple of 8
  457. in order to hamper traffic analysis). A country is included
  458. only if it has at least one address. The time in
  459. "geoip-start" is the time at which we began collecting geoip
  460. statistics.
  461. "geoip-start" and "geoip-client-origins" have been replaced by
  462. "bridge-stats-end" and "bridge-stats-ips" in 0.2.2.4-alpha. The
  463. reason is that the measurement interval with "geoip-stats" as
  464. determined by subtracting "geoip-start" from "published" could
  465. have had a variable length, whereas the measurement interval in
  466. 0.2.2.4-alpha and later is set to be exactly 24 hours long. In
  467. order to clearly distinguish the new measurement intervals from
  468. the old ones, the new keywords have been introduced.
  469. "bridge-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
  470. [At most once.]
  471. YYYY-MM-DD HH:MM:SS defines the end of the included measurement
  472. interval of length NSEC seconds (86400 seconds by default).
  473. A "bridge-stats-end" line, as well as any other "bridge-*" line,
  474. is only added when the relay has been running as a bridge for at
  475. least 24 hours.
  476. "bridge-ips" CC=N,CC=N,... NL
  477. [At most once.]
  478. List of mappings from two-letter country codes to the number of
  479. unique IP addresses that have connected from that country to the
  480. bridge and which are no known relays, rounded up to the nearest
  481. multiple of 8.
  482. "dirreq-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
  483. [At most once.]
  484. YYYY-MM-DD HH:MM:SS defines the end of the included measurement
  485. interval of length NSEC seconds (86400 seconds by default).
  486. A "dirreq-stats-end" line, as well as any other "dirreq-*" line,
  487. is only added when the relay has opened its Dir port and after 24
  488. hours of measuring directory requests.
  489. "dirreq-v2-ips" CC=N,CC=N,... NL
  490. [At most once.]
  491. "dirreq-v3-ips" CC=N,CC=N,... NL
  492. [At most once.]
  493. List of mappings from two-letter country codes to the number of
  494. unique IP addresses that have connected from that country to
  495. request a v2/v3 network status, rounded up to the nearest multiple
  496. of 8. Only those IP addresses are counted that the directory can
  497. answer with a 200 OK status code.
  498. "dirreq-v2-reqs" CC=N,CC=N,... NL
  499. [At most once.]
  500. "dirreq-v3-reqs" CC=N,CC=N,... NL
  501. [At most once.]
  502. List of mappings from two-letter country codes to the number of
  503. requests for v2/v3 network statuses from that country, rounded up
  504. to the nearest multiple of 8. Only those requests are counted that
  505. the directory can answer with a 200 OK status code.
  506. "dirreq-v2-share" num% NL
  507. [At most once.]
  508. "dirreq-v3-share" num% NL
  509. [At most once.]
  510. The share of v2/v3 network status requests that the directory
  511. expects to receive from clients based on its advertised bandwidth
  512. compared to the overall network bandwidth capacity. Shares are
  513. formatted in percent with two decimal places. Shares are
  514. calculated as means over the whole 24-hour interval.
  515. "dirreq-v2-resp" status=num,... NL
  516. [At most once.]
  517. "dirreq-v3-resp" status=nul,... NL
  518. [At most once.]
  519. List of mappings from response statuses to the number of requests
  520. for v2/v3 network statuses that were answered with that response
  521. status, rounded up to the nearest multiple of 4. Only response
  522. statuses with at least 1 response are reported. New response
  523. statuses can be added at any time. The current list of response
  524. statuses is as follows:
  525. "ok": a network status request is answered; this number
  526. corresponds to the sum of all requests as reported in
  527. "dirreq-v2-reqs" or "dirreq-v3-reqs", respectively, before
  528. rounding up.
  529. "not-enough-sigs: a version 3 network status is not signed by a
  530. sufficient number of requested authorities.
  531. "unavailable": a requested network status object is unavailable.
  532. "not-found": a requested network status is not found.
  533. "not-modified": a network status has not been modified since the
  534. If-Modified-Since time that is included in the request.
  535. "busy": the directory is busy.
  536. "dirreq-v2-direct-dl" key=val,... NL
  537. [At most once.]
  538. "dirreq-v3-direct-dl" key=val,... NL
  539. [At most once.]
  540. "dirreq-v2-tunneled-dl" key=val,... NL
  541. [At most once.]
  542. "dirreq-v3-tunneled-dl" key=val,... NL
  543. [At most once.]
  544. List of statistics about possible failures in the download process
  545. of v2/v3 network statuses. Requests are either "direct"
  546. HTTP-encoded requests over the relay's directory port, or
  547. "tunneled" requests using a BEGIN_DIR cell over the relay's OR
  548. port. The list of possible statistics can change, and statistics
  549. can be left out from reporting. The current list of statistics is
  550. as follows:
  551. Successful downloads and failures:
  552. "complete": a client has finished the download successfully.
  553. "timeout": a download did not finish within 10 minutes after
  554. starting to send the response.
  555. "running": a download is still running at the end of the
  556. measurement period for less than 10 minutes after starting to
  557. send the response.
  558. Download times:
  559. "min", "max": smallest and largest measured bandwidth in B/s.
  560. "d[1-4,6-9]": 1st to 4th and 6th to 9th decile of measured
  561. bandwidth in B/s. For a given decile i, i/10 of all downloads
  562. had a smaller bandwidth than di, and (10-i)/10 of all downloads
  563. had a larger bandwidth than di.
  564. "q[1,3]": 1st and 3rd quartile of measured bandwidth in B/s. One
  565. fourth of all downloads had a smaller bandwidth than q1, one
  566. fourth of all downloads had a larger bandwidth than q3, and the
  567. remaining half of all downloads had a bandwidth between q1 and
  568. q3.
  569. "md": median of measured bandwidth in B/s. Half of the downloads
  570. had a smaller bandwidth than md, the other half had a larger
  571. bandwidth than md.
  572. "entry-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
  573. [At most once.]
  574. YYYY-MM-DD HH:MM:SS defines the end of the included measurement
  575. interval of length NSEC seconds (86400 seconds by default).
  576. An "entry-stats-end" line, as well as any other "entry-*"
  577. line, is first added after the relay has been running for at least
  578. 24 hours.
  579. "entry-ips" CC=N,CC=N,... NL
  580. [At most once.]
  581. List of mappings from two-letter country codes to the number of
  582. unique IP addresses that have connected from that country to the
  583. relay and which are no known other relays, rounded up to the
  584. nearest multiple of 8.
  585. "cell-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
  586. [At most once.]
  587. YYYY-MM-DD HH:MM:SS defines the end of the included measurement
  588. interval of length NSEC seconds (86400 seconds by default).
  589. A "cell-stats-end" line, as well as any other "cell-*" line,
  590. is first added after the relay has been running for at least 24
  591. hours.
  592. "cell-processed-cells" num,...,num NL
  593. [At most once.]
  594. Mean number of processed cells per circuit, subdivided into
  595. deciles of circuits by the number of cells they have processed in
  596. descending order from loudest to quietest circuits.
  597. "cell-queued-cells" num,...,num NL
  598. [At most once.]
  599. Mean number of cells contained in queues by circuit decile. These
  600. means are calculated by 1) determining the mean number of cells in
  601. a single circuit between its creation and its termination and 2)
  602. calculating the mean for all circuits in a given decile as
  603. determined in "cell-processed-cells". Numbers have a precision of
  604. two decimal places.
  605. "cell-time-in-queue" num,...,num NL
  606. [At most once.]
  607. Mean time cells spend in circuit queues in milliseconds. Times are
  608. calculated by 1) determining the mean time cells spend in the
  609. queue of a single circuit and 2) calculating the mean for all
  610. circuits in a given decile as determined in
  611. "cell-processed-cells".
  612. "cell-circuits-per-decile" num NL
  613. [At most once.]
  614. Mean number of circuits that are included in any of the deciles,
  615. rounded up to the next integer.
  616. "exit-stats-end" YYYY-MM-DD HH:MM:SS (NSEC s) NL
  617. [At most once.]
  618. YYYY-MM-DD HH:MM:SS defines the end of the included measurement
  619. interval of length NSEC seconds (86400 seconds by default).
  620. An "exit-stats-end" line, as well as any other "exit-*" line, is
  621. first added after the relay has been running for at least 24 hours
  622. and only if the relay permits exiting (where exiting to a single
  623. port and IP address is sufficient).
  624. "exit-kibibytes-written" port=N,port=N,... NL
  625. [At most once.]
  626. "exit-kibibytes-read" port=N,port=N,... NL
  627. [At most once.]
  628. List of mappings from ports to the number of kibibytes that the
  629. relay has written to or read from exit connections to that port,
  630. rounded up to the next full kibibyte.
  631. "exit-streams-opened" port=N,port=N,... NL
  632. [At most once.]
  633. List of mappings from ports to the number of opened exit streams
  634. to that port, rounded up to the nearest multiple of 4.
  635. "router-signature" NL Signature NL
  636. [At end, exactly once.]
  637. A document signature as documented in section 1.3, using the
  638. initial item "extra-info" and the final item "router-signature",
  639. signed with the router's identity key.
  640. 2.2.1. Moving history fields to extra-info documents.
  641. Tools that want to use the read-history and write-history values SHOULD
  642. download extra-info documents as well as router descriptors. Such
  643. tools SHOULD accept history values from both sources; if they appear in
  644. both documents, the values in the extra-info documents are authoritative.
  645. New versions of Tor no longer generate router descriptors
  646. containing read-history or write-history. Tools should continue to
  647. accept read-history and write-history values in router descriptors
  648. produced by older versions of Tor until all Tor versions earlier
  649. than 0.2.0.x are obsolete.
  650. 2.3. Nonterminals in router descriptors
  651. nickname ::= between 1 and 19 alphanumeric characters ([A-Za-z0-9]),
  652. case-insensitive.
  653. hexdigest ::= a '$', followed by 40 hexadecimal characters
  654. ([A-Fa-f0-9]). [Represents a server by the digest of its identity
  655. key.]
  656. exitpattern ::= addrspec ":" portspec
  657. portspec ::= "*" | port | port "-" port
  658. port ::= an integer between 1 and 65535, inclusive.
  659. [Some implementations incorrectly generate ports with value 0.
  660. Implementations SHOULD accept this, and SHOULD NOT generate it.
  661. Connections to port 0 are never permitted.]
  662. addrspec ::= "*" | ip4spec | ip6spec
  663. ipv4spec ::= ip4 | ip4 "/" num_ip4_bits | ip4 "/" ip4mask
  664. ip4 ::= an IPv4 address in dotted-quad format
  665. ip4mask ::= an IPv4 mask in dotted-quad format
  666. num_ip4_bits ::= an integer between 0 and 32
  667. ip6spec ::= ip6 | ip6 "/" num_ip6_bits
  668. ip6 ::= an IPv6 address, surrounded by square brackets.
  669. num_ip6_bits ::= an integer between 0 and 128
  670. bool ::= "0" | "1"
  671. 3. Formats produced by directory authorities.
  672. Every authority has two keys used in this protocol: a signing key, and
  673. an authority identity key. (Authorities also have a router identity
  674. key used in their role as a router and by earlier versions of the
  675. directory protocol.) The identity key is used from time to time to
  676. sign new key certificates using new signing keys; it is very sensitive.
  677. The signing key is used to sign key certificates and status documents.
  678. There are three kinds of documents generated by directory authorities:
  679. Key certificates
  680. Status votes
  681. Status consensuses
  682. Each is discussed below.
  683. 3.1. Key certificates
  684. Key certificates consist of the following items:
  685. "dir-key-certificate-version" version NL
  686. [At start, exactly once.]
  687. Determines the version of the key certificate. MUST be "3" for
  688. the protocol described in this document. Implementations MUST
  689. reject formats they don't understand.
  690. "dir-address" IPPort NL
  691. [At most once]
  692. An IP:Port for this authority's directory port.
  693. "fingerprint" fingerprint NL
  694. [Exactly once.]
  695. Hexadecimal encoding without spaces based on the authority's
  696. identity key.
  697. "dir-identity-key" NL a public key in PEM format
  698. [Exactly once.]
  699. The long-term authority identity key for this authority. This key
  700. SHOULD be at least 2048 bits long; it MUST NOT be shorter than
  701. 1024 bits.
  702. "dir-key-published" YYYY-MM-DD HH:MM:SS NL
  703. [Exactly once.]
  704. The time (in GMT) when this document and corresponding key were
  705. last generated.
  706. "dir-key-expires" YYYY-MM-DD HH:MM:SS NL
  707. [Exactly once.]
  708. A time (in GMT) after which this key is no longer valid.
  709. "dir-signing-key" NL a key in PEM format
  710. [Exactly once.]
  711. The directory server's public signing key. This key MUST be at
  712. least 1024 bits, and MAY be longer.
  713. "dir-key-crosscert" NL CrossSignature NL
  714. [At most once.]
  715. NOTE: Authorities MUST include this field in all newly generated
  716. certificates. A future version of this specification will make
  717. the field required.
  718. CrossSignature is a signature, made using the certificate's signing
  719. key, of the digest of the PKCS1-padded hash of the certificate's
  720. identity key. For backward compatibility with broken versions of the
  721. parser, we wrap the base64-encoded signature in -----BEGIN ID
  722. SIGNATURE---- and -----END ID SIGNATURE----- tags. Implementations
  723. MUST allow the "ID " portion to be omitted, however.
  724. When encountering a certificate with a dir-key-crosscert entry,
  725. implementations MUST verify that the signature is a correct signature
  726. of the hash of the identity key using the signing key.
  727. "dir-key-certification" NL Signature NL
  728. [At end, exactly once.]
  729. A document signature as documented in section 1.3, using the
  730. initial item "dir-key-certificate-version" and the final item
  731. "dir-key-certification", signed with the authority identity key.
  732. Authorities MUST generate a new signing key and corresponding
  733. certificate before the key expires.
  734. 3.2. Vote and consensus status documents
  735. Votes and consensuses are more strictly formatted then other documents
  736. in this specification, since different authorities must be able to
  737. generate exactly the same consensus given the same set of votes.
  738. The procedure for deciding when to generate vote and consensus status
  739. documents are described in section 1.4 on the voting timeline.
  740. Status documents contain a preamble, an authority section, a list of
  741. router status entries, and one or more footer signature, in that order.
  742. Unlike other formats described above, a SP in these documents must be a
  743. single space character (hex 20).
  744. Some items appear only in votes, and some items appear only in
  745. consensuses. Unless specified, items occur in both.
  746. The preamble contains the following items. They MUST occur in the
  747. order given here:
  748. "network-status-version" SP version NL.
  749. [At start, exactly once.]
  750. A document format version. For this specification, the version is
  751. "3".
  752. "vote-status" SP type NL
  753. [Exactly once.]
  754. The status MUST be "vote" or "consensus", depending on the type of
  755. the document.
  756. "consensus-methods" SP IntegerList NL
  757. [Exactly once for votes; does not occur in consensuses.]
  758. A space-separated list of supported methods for generating
  759. consensuses from votes. See section 3.4.1 for details. Method "1"
  760. MUST be included.
  761. "consensus-method" SP Integer NL
  762. [Exactly once for consensuses; does not occur in votes.]
  763. See section 3.4.1 for details.
  764. (Only included when the vote is generated with consensus-method 2 or
  765. later.)
  766. "published" SP YYYY-MM-DD SP HH:MM:SS NL
  767. [Exactly once for votes; does not occur in consensuses.]
  768. The publication time for this status document (if a vote).
  769. "valid-after" SP YYYY-MM-DD SP HH:MM:SS NL
  770. [Exactly once.]
  771. The start of the Interval for this vote. Before this time, the
  772. consensus document produced from this vote should not be used.
  773. See 1.4 for voting timeline information.
  774. "fresh-until" SP YYYY-MM-DD SP HH:MM:SS NL
  775. [Exactly once.]
  776. The time at which the next consensus should be produced; before this
  777. time, there is no point in downloading another consensus, since there
  778. won't be a new one. See 1.4 for voting timeline information.
  779. "valid-until" SP YYYY-MM-DD SP HH:MM:SS NL
  780. [Exactly once.]
  781. The end of the Interval for this vote. After this time, the
  782. consensus produced by this vote should not be used. See 1.4 for
  783. voting timeline information.
  784. "voting-delay" SP VoteSeconds SP DistSeconds NL
  785. [Exactly once.]
  786. VoteSeconds is the number of seconds that we will allow to collect
  787. votes from all authorities; DistSeconds is the number of seconds
  788. we'll allow to collect signatures from all authorities. See 1.4 for
  789. voting timeline information.
  790. "client-versions" SP VersionList NL
  791. [At most once.]
  792. A comma-separated list of recommended client versions, in
  793. ascending order. If absent, no opinion is held about client
  794. versions.
  795. "server-versions" SP VersionList NL
  796. [At most once.]
  797. A comma-separated list of recommended server versions, in
  798. ascending order. If absent, no opinion is held about server
  799. versions.
  800. "known-flags" SP FlagList NL
  801. [Exactly once.]
  802. A space-separated list of all of the flags that this document
  803. might contain. A flag is "known" either because the authority
  804. knows about them and might set them (if in a vote), or because
  805. enough votes were counted for the consensus for an authoritative
  806. opinion to have been formed about their status.
  807. "params" SP [Parameters] NL
  808. [At most once]
  809. Parameter ::= Keyword '=' Int32
  810. Int32 ::= A decimal integer between -2147483648 and 2147483647.
  811. Parameters ::= Parameter | Parameters SP Parameter
  812. The parameters list, if present, contains a space-separated list of
  813. key-value pairs, sorted in lexical order by their keyword. Each
  814. parameter has its own meaning.
  815. (Only included when the vote is generated with consensus-method 7 or
  816. later.)
  817. Commonly used "param" arguments at this point include:
  818. "CircWindow" -- the default package window that circuits should
  819. be established with. It started out at 1000 cells, but some
  820. research indicates that a lower value would mean fewer cells in
  821. transit in the network at any given time. Obeyed by Tor 0.2.1.20
  822. and later.
  823. "CircuitPriorityHalflifeMsec" -- the halflife parameter used when
  824. weighting which circuit will send the next cell. Obeyed by Tor
  825. 0.2.2.10-alpha and later. (Versions of Tor between 0.2.2.7-alpha
  826. and 0.2.2.10-alpha recognized a "CircPriorityHalflifeMsec" parameter,
  827. but mishandled it badly.)
  828. The authority section of a vote contains the following items, followed
  829. in turn by the authority's current key certificate:
  830. "dir-source" SP nickname SP identity SP address SP IP SP dirport SP
  831. orport NL
  832. [Exactly once, at start]
  833. Describes this authority. The nickname is a convenient identifier
  834. for the authority. The identity is an uppercase hex fingerprint of
  835. the authority's current (v3 authority) identity key. The address is
  836. the server's hostname. The IP is the server's current IP address,
  837. and dirport is its current directory port. XXXXorport
  838. "contact" SP string NL
  839. [At most once.]
  840. An arbitrary string describing how to contact the directory
  841. server's administrator. Administrators should include at least an
  842. email address and a PGP fingerprint.
  843. "legacy-key" SP FINGERPRINT NL
  844. [At most once]
  845. Lists a fingerprint for an obsolete _identity_ key still used
  846. by this authority to keep older clients working. This option
  847. is used to keep key around for a little while in case the
  848. authorities need to migrate many identity keys at once.
  849. (Generally, this would only happen because of a security
  850. vulnerability that affected multiple authorities, like the
  851. Debian OpenSSL RNG bug of May 2008.)
  852. The authority section of a consensus contains groups the following items,
  853. in the order given, with one group for each authority that contributed to
  854. the consensus, with groups sorted by authority identity digest:
  855. "dir-source" SP nickname SP identity SP address SP IP SP dirport SP
  856. orport NL
  857. [Exactly once, at start]
  858. As in the authority section of a vote.
  859. "contact" SP string NL
  860. [At most once.]
  861. As in the authority section of a vote.
  862. "vote-digest" SP digest NL
  863. [Exactly once.]
  864. A digest of the vote from the authority that contributed to this
  865. consensus, as signed (that is, not including the signature).
  866. (Hex, upper-case.)
  867. Each router status entry contains the following items. Router status
  868. entries are sorted in ascending order by identity digest.
  869. "r" SP nickname SP identity SP digest SP publication SP IP SP ORPort
  870. SP DirPort NL
  871. [At start, exactly once.]
  872. "Nickname" is the OR's nickname. "Identity" is a hash of its
  873. identity key, encoded in base64, with trailing equals sign(s)
  874. removed. "Digest" is a hash of its most recent descriptor as
  875. signed (that is, not including the signature), encoded in base64.
  876. "Publication" is the
  877. publication time of its most recent descriptor, in the form
  878. YYYY-MM-DD HH:MM:SS, in GMT. "IP" is its current IP address;
  879. ORPort is its current OR port, "DirPort" is it's current directory
  880. port, or "0" for "none".
  881. "s" SP Flags NL
  882. [At most once.]
  883. A series of space-separated status flags, in alphabetical order.
  884. Currently documented flags are:
  885. "Authority" if the router is a directory authority.
  886. "BadExit" if the router is believed to be useless as an exit node
  887. (because its ISP censors it, because it is behind a restrictive
  888. proxy, or for some similar reason).
  889. "BadDirectory" if the router is believed to be useless as a
  890. directory cache (because its directory port isn't working,
  891. its bandwidth is always throttled, or for some similar
  892. reason).
  893. "Exit" if the router is more useful for building
  894. general-purpose exit circuits than for relay circuits. The
  895. path building algorithm uses this flag; see path-spec.txt.
  896. "Fast" if the router is suitable for high-bandwidth circuits.
  897. "Guard" if the router is suitable for use as an entry guard.
  898. "HSDir" if the router is considered a v2 hidden service directory.
  899. "Named" if the router's identity-nickname mapping is canonical,
  900. and this authority binds names.
  901. "Stable" if the router is suitable for long-lived circuits.
  902. "Running" if the router is currently usable.
  903. "Unnamed" if another router has bound the name used by this
  904. router, and this authority binds names.
  905. "Valid" if the router has been 'validated'.
  906. "V2Dir" if the router implements the v2 directory protocol.
  907. "V3Dir" if the router implements this protocol.
  908. "v" SP version NL
  909. [At most once.]
  910. The version of the Tor protocol that this server is running. If
  911. the value begins with "Tor" SP, the rest of the string is a Tor
  912. version number, and the protocol is "The Tor protocol as supported
  913. by the given version of Tor." Otherwise, if the value begins with
  914. some other string, Tor has upgraded to a more sophisticated
  915. protocol versioning system, and the protocol is "a version of the
  916. Tor protocol more recent than any we recognize."
  917. Directory authorities SHOULD omit version strings they receive from
  918. descriptors if they would cause "v" lines to be over 128 characters
  919. long.
  920. "w" SP "Bandwidth=" INT [SP "Measured=" INT] NL
  921. [At most once.]
  922. An estimate of the bandwidth of this server, in an arbitrary
  923. unit (currently kilobytes per second). Used to weight router
  924. selection.
  925. Additionally, the Measured= keyword is present in votes by
  926. participating bandwidth measurement authorities to indicate
  927. a measured bandwidth currently produced by measuring stream
  928. capacities.
  929. Other weighting keywords may be added later.
  930. Clients MUST ignore keywords they do not recognize.
  931. "p" SP ("accept" / "reject") SP PortList NL
  932. [At most once.]
  933. PortList = PortOrRange
  934. PortList = PortList "," PortOrRange
  935. PortOrRange = INT "-" INT / INT
  936. A list of those ports that this router supports (if 'accept')
  937. or does not support (if 'reject') for exit to "most
  938. addresses".
  939. The footer section is delineated in all votes and consensuses supporting
  940. consensus method 9 and above with the following:
  941. "directory-footer" NL
  942. It contains two subsections, a bandwidths-weights line and a
  943. directory-signature.
  944. The bandwidths-weights line appears At Most Once for a consensus. It does
  945. not appear in votes.
  946. "bandwidth-weights" SP
  947. "Wbd=" INT SP "Wbe=" INT SP "Wbg=" INT SP "Wbm=" INT SP
  948. "Wdb=" INT SP
  949. "Web=" INT SP "Wed=" INT SP "Wee=" INT SP "Weg=" INT SP "Wem=" INT SP
  950. "Wgb=" INT SP "Wgd=" INT SP "Wgg=" INT SP "Wgm=" INT SP
  951. "Wmb=" INT SP "Wmd=" INT SP "Wme=" INT SP "Wmg=" INT SP "Wmm=" INT NL
  952. These values represent the weights to apply to router bandwidths during
  953. path selection. They are sorted in alphabetical order in the list. The
  954. integer values are divided by BW_WEIGHT_SCALE=10000 or the consensus
  955. param "bwweightscale". They are:
  956. Wgg - Weight for Guard-flagged nodes in the guard position
  957. Wgm - Weight for non-flagged nodes in the guard Position
  958. Wgd - Weight for Guard+Exit-flagged nodes in the guard Position
  959. Wmg - Weight for Guard-flagged nodes in the middle Position
  960. Wmm - Weight for non-flagged nodes in the middle Position
  961. Wme - Weight for Exit-flagged nodes in the middle Position
  962. Wmd - Weight for Guard+Exit flagged nodes in the middle Position
  963. Weg - Weight for Guard flagged nodes in the exit Position
  964. Wem - Weight for non-flagged nodes in the exit Position
  965. Wee - Weight for Exit-flagged nodes in the exit Position
  966. Wed - Weight for Guard+Exit-flagged nodes in the exit Position
  967. Wgb - Weight for BEGIN_DIR-supporting Guard-flagged nodes
  968. Wmb - Weight for BEGIN_DIR-supporting non-flagged nodes
  969. Web - Weight for BEGIN_DIR-supporting Exit-flagged nodes
  970. Wdb - Weight for BEGIN_DIR-supporting Guard+Exit-flagged nodes
  971. Wbg - Weight for Guard+Exit-flagged nodes for BEGIN_DIR requests
  972. Wbm - Weight for Guard+Exit-flagged nodes for BEGIN_DIR requests
  973. Wbe - Weight for Guard+Exit-flagged nodes for BEGIN_DIR requests
  974. Wbd - Weight for Guard+Exit-flagged nodes for BEGIN_DIR requests
  975. These values are calculated as specified in Section 3.4.3.
  976. The signature contains the following item, which appears Exactly Once
  977. for a vote, and At Least Once for a consensus.
  978. "directory-signature" SP identity SP signing-key-digest NL Signature
  979. This is a signature of the status document, with the initial item
  980. "network-status-version", and the signature item
  981. "directory-signature", using the signing key. (In this case, we take
  982. the hash through the _space_ after directory-signature, not the
  983. newline: this ensures that all authorities sign the same thing.)
  984. "identity" is the hex-encoded digest of the authority identity key of
  985. the signing authority, and "signing-key-digest" is the hex-encoded
  986. digest of the current authority signing key of the signing authority.
  987. 3.3. Assigning flags in a vote
  988. (This section describes how directory authorities choose which status
  989. flags to apply to routers, as of Tor 0.2.0.0-alpha-dev. Later directory
  990. authorities MAY do things differently, so long as clients keep working
  991. well. Clients MUST NOT depend on the exact behaviors in this section.)
  992. In the below definitions, a router is considered "active" if it is
  993. running, valid, and not hibernating.
  994. "Valid" -- a router is 'Valid' if it is running a version of Tor not
  995. known to be broken, and the directory authority has not blacklisted
  996. it as suspicious.
  997. "Named" -- Directory authority administrators may decide to support name
  998. binding. If they do, then they must maintain a file of
  999. nickname-to-identity-key mappings, and try to keep this file consistent
  1000. with other directory authorities. If they don't, they act as clients, and
  1001. report bindings made by other directory authorities (name X is bound to
  1002. identity Y if at least one binding directory lists it, and no directory
  1003. binds X to some other Y'.) A router is called 'Named' if the router
  1004. believes the given name should be bound to the given key.
  1005. Two strategies exist on the current network for deciding on
  1006. values for the Named flag. In the original version, server
  1007. operators were asked to send nickname-identity pairs to a
  1008. mailing list of Naming directory authorities operators. The
  1009. operators were then supposed to add the pairs to their
  1010. mapping files; in practice, they didn't get to this often.
  1011. Newer Naming authorities run a script that registers routers
  1012. in their mapping files once the routers have been online at
  1013. least two weeks, no other router has that nickname, and no
  1014. other router has wanted the nickname for a month. If a router
  1015. has not been online for six months, the router is removed.
  1016. "Unnamed" -- Directory authorities that support naming should vote for a
  1017. router to be 'Unnamed' if its given nickname is mapped to a different
  1018. identity.
  1019. "Running" -- A router is 'Running' if the authority managed to connect to
  1020. it successfully within the last 30 minutes.
  1021. "Stable" -- A router is 'Stable' if it is active, and either its Weighted
  1022. MTBF is at least the median for known active routers or its Weighted MTBF
  1023. corresponds to at least 7 days. Routers are never called Stable if they are
  1024. running a version of Tor known to drop circuits stupidly. (0.1.1.10-alpha
  1025. through 0.1.1.16-rc are stupid this way.)
  1026. To calculate weighted MTBF, compute the weighted mean of the lengths
  1027. of all intervals when the router was observed to be up, weighting
  1028. intervals by $\alpha^n$, where $n$ is the amount of time that has
  1029. passed since the interval ended, and $\alpha$ is chosen so that
  1030. measurements over approximately one month old no longer influence the
  1031. weighted MTBF much.
  1032. [XXXX what happens when we have less than 4 days of MTBF info.]
  1033. "Exit" -- A router is called an 'Exit' iff it allows exits to at
  1034. least two of the ports 80, 443, and 6667 and allows exits to at
  1035. least one /8 address space.
  1036. "Fast" -- A router is 'Fast' if it is active, and its bandwidth is
  1037. either in the top 7/8ths for known active routers or at least 20KB/s.
  1038. "Guard" -- A router is a possible 'Guard' if its Weighted Fractional
  1039. Uptime is at least the median for "familiar" active routers, and if
  1040. its bandwidth is at least median or at least 250KB/s.
  1041. If the total bandwidth of active non-BadExit Exit servers is less
  1042. than one third of the total bandwidth of all active servers, no Exit is
  1043. listed as a Guard.
  1044. To calculate weighted fractional uptime, compute the fraction
  1045. of time that the router is up in any given day, weighting so that
  1046. downtime and uptime in the past counts less.
  1047. A node is 'familiar' if 1/8 of all active nodes have appeared more
  1048. recently than it, OR it has been around for a few weeks.
  1049. "Authority" -- A router is called an 'Authority' if the authority
  1050. generating the network-status document believes it is an authority.
  1051. "V2Dir" -- A router supports the v2 directory protocol if it has an open
  1052. directory port, and it is running a version of the directory protocol that
  1053. supports the functionality clients need. (Currently, this is
  1054. 0.1.1.9-alpha or later.)
  1055. "V3Dir" -- A router supports the v3 directory protocol if it has an open
  1056. directory port, and it is running a version of the directory protocol that
  1057. supports the functionality clients need. (Currently, this is
  1058. 0.2.0.?????-alpha or later.)
  1059. "HSDir" -- A router is a v2 hidden service directory if it stores and
  1060. serves v2 hidden service descriptors and the authority managed to connect
  1061. to it successfully within the last 24 hours.
  1062. Directory server administrators may label some servers or IPs as
  1063. blacklisted, and elect not to include them in their network-status lists.
  1064. Authorities SHOULD 'disable' any servers in excess of 3 on any single IP.
  1065. When there are more than 3 to choose from, authorities should first prefer
  1066. authorities to non-authorities, then prefer Running to non-Running, and
  1067. then prefer high-bandwidth to low-bandwidth. To 'disable' a server, the
  1068. authority *should* advertise it without the Running or Valid flag.
  1069. Thus, the network-status vote includes all non-blacklisted,
  1070. non-expired, non-superseded descriptors.
  1071. The bandwidth in a "w" line should be taken as the best estimate
  1072. of the router's actual capacity that the authority has. For now,
  1073. this should be the lesser of the observed bandwidth and bandwidth
  1074. rate limit from the router descriptor. It is given in kilobytes
  1075. per second, and capped at some arbitrary value (currently 10 MB/s).
  1076. The Measured= keyword on a "w" line vote is currently computed
  1077. by multiplying the previous published consensus bandwidth by the
  1078. ratio of the measured average node stream capacity to the network
  1079. average. If 3 or more authorities provide a Measured= keyword for
  1080. a router, the authorities produce a consensus containing a "w"
  1081. Bandwidth= keyword equal to the median of the Measured= votes.
  1082. The ports listed in a "p" line should be taken as those ports for
  1083. which the router's exit policy permits 'most' addresses, ignoring any
  1084. accept not for all addresses, ignoring all rejects for private
  1085. netblocks. "Most" addresses are permitted if no more than 2^25
  1086. IPv4 addresses (two /8 networks) were blocked. The list is encoded
  1087. as described in 3.4.2.
  1088. 3.4. Computing a consensus from a set of votes
  1089. Given a set of votes, authorities compute the contents of the consensus
  1090. document as follows:
  1091. The "valid-after", "valid-until", and "fresh-until" times are taken as
  1092. the median of the respective values from all the votes.
  1093. The times in the "voting-delay" line are taken as the median of the
  1094. VoteSeconds and DistSeconds times in the votes.
  1095. Known-flags is the union of all flags known by any voter.
  1096. Entries are given on the "params" line for every keyword on which any
  1097. authority voted. The values given are the low-median of all votes on
  1098. that keyword.
  1099. "client-versions" and "server-versions" are sorted in ascending
  1100. order; A version is recommended in the consensus if it is recommended
  1101. by more than half of the voting authorities that included a
  1102. client-versions or server-versions lines in their votes.
  1103. The authority item groups (dir-source, contact, fingerprint,
  1104. vote-digest) are taken from the votes of the voting
  1105. authorities. These groups are sorted by the digests of the
  1106. authorities identity keys, in ascending order. If the consensus
  1107. method is 3 or later, a dir-source line must be included for
  1108. every vote with legacy-key entry, using the legacy-key's
  1109. fingerprint, the voter's ordinary nickname with the string
  1110. "-legacy" appended, and all other fields as from the original
  1111. vote's dir-source line.
  1112. A router status entry:
  1113. * is included in the result if some router status entry with the same
  1114. identity is included by more than half of the authorities (total
  1115. authorities, not just those whose votes we have).
  1116. * For any given identity, we include at most one router status entry.
  1117. * A router entry has a flag set if that is included by more than half
  1118. of the authorities who care about that flag.
  1119. * Two router entries are "the same" if they have the same
  1120. <descriptor digest, published time, nickname, IP, ports> tuple.
  1121. We choose the tuple for a given router as whichever tuple appears
  1122. for that router in the most votes. We break ties first in favor of
  1123. the more recently published, then in favor of smaller server
  1124. descriptor digest.
  1125. * The Named flag appears if it is included for this routerstatus by
  1126. _any_ authority, and if all authorities that list it list the same
  1127. nickname. However, if consensus-method 2 or later is in use, and
  1128. any authority calls this identity/nickname pair Unnamed, then
  1129. this routerstatus does not get the Named flag.
  1130. * If consensus-method 2 or later is in use, the Unnamed flag is
  1131. set for a routerstatus if any authorities have voted for a different
  1132. identities to be Named with that nickname, or if any authority
  1133. lists that nickname/ID pair as Unnamed.
  1134. (With consensus-method 1, Unnamed is set like any other flag.)
  1135. * The version is given as whichever version is listed by the most
  1136. voters, with ties decided in favor of more recent versions.
  1137. * If consensus-method 4 or later is in use, then routers that
  1138. do not have the Running flag are not listed at all.
  1139. * If consensus-method 5 or later is in use, then the "w" line
  1140. is generated using a low-median of the bandwidth values from
  1141. the votes that included "w" lines for this router.
  1142. * If consensus-method 5 or later is in use, then the "p" line
  1143. is taken from the votes that have the same policy summary
  1144. for the descriptor we are listing. (They should all be the
  1145. same. If they are not, we pick the most commonly listed
  1146. one, breaking ties in favor of the lexicographically larger
  1147. vote.) The port list is encoded as specified in 3.4.2.
  1148. * If consensus-method 6 or later is in use and if 3 or more
  1149. authorities provide a Measured= keyword in their votes for
  1150. a router, the authorities produce a consensus containing a
  1151. Bandwidth= keyword equal to the median of the Measured= votes.
  1152. * If consensus-method 7 or later is in use, the params line is
  1153. included in the output.
  1154. The signatures at the end of a consensus document are sorted in
  1155. ascending order by identity digest.
  1156. All ties in computing medians are broken in favor of the smaller or
  1157. earlier item.
  1158. 3.4.1. Forward compatibility
  1159. Future versions of Tor will need to include new information in the
  1160. consensus documents, but it is important that all authorities (or at least
  1161. half) generate and sign the same signed consensus.
  1162. To achieve this, authorities list in their votes their supported methods
  1163. for generating consensuses from votes. Later methods will be assigned
  1164. higher numbers. Currently recognized methods:
  1165. "1" -- The first implemented version.
  1166. "2" -- Added support for the Unnamed flag.
  1167. "3" -- Added legacy ID key support to aid in authority ID key rollovers
  1168. "4" -- No longer list routers that are not running in the consensus
  1169. "5" -- adds support for "w" and "p" lines.
  1170. "6" -- Prefers measured bandwidth values rather than advertised
  1171. "7" -- Provides keyword=integer pairs of consensus parameters
  1172. "8" -- Provides microdescriptor summaries
  1173. "9" -- Provides weights for selecting flagged routers in paths
  1174. Before generating a consensus, an authority must decide which consensus
  1175. method to use. To do this, it looks for the highest version number
  1176. supported by more than 2/3 of the authorities voting. If it supports this
  1177. method, then it uses it. Otherwise, it falls back to method 1.
  1178. (The consensuses generated by new methods must be parsable by
  1179. implementations that only understand the old methods, and must not cause
  1180. those implementations to compromise their anonymity. This is a means for
  1181. making changes in the contents of consensus; not for making
  1182. backward-incompatible changes in their format.)
  1183. 3.4.2. Encoding port lists
  1184. Whether the summary shows the list of accepted ports or the list of
  1185. rejected ports depends on which list is shorter (has a shorter string
  1186. representation). In case of ties we choose the list of accepted
  1187. ports. As an exception to this rule an allow-all policy is
  1188. represented as "accept 1-65535" instead of "reject " and a reject-all
  1189. policy is similarly given as "reject 1-65535".
  1190. Summary items are compressed, that is instead of "80-88,89-100" there
  1191. only is a single item of "80-100", similarly instead of "20,21" a
  1192. summary will say "20-21".
  1193. Port lists are sorted in ascending order.
  1194. The maximum allowed length of a policy summary (including the "accept "
  1195. or "reject ") is 1000 characters. If a summary exceeds that length we
  1196. use an accept-style summary and list as much of the port list as is
  1197. possible within these 1000 bytes. [XXXX be more specific.]
  1198. 3.4.3. Computing Bandwidth Weights
  1199. Let weight_scale = 10000
  1200. Let G be the total bandwidth for Guard-flagged nodes.
  1201. Let M be the total bandwidth for non-flagged nodes.
  1202. Let E be the total bandwidth for Exit-flagged nodes.
  1203. Let D be the total bandwidth for Guard+Exit-flagged nodes.
  1204. Let T = G+M+E+D
  1205. Let Wgd be the weight for choosing a Guard+Exit for the guard position.
  1206. Let Wmd be the weight for choosing a Guard+Exit for the middle position.
  1207. Let Wed be the weight for choosing a Guard+Exit for the exit position.
  1208. Let Wme be the weight for choosing an Exit for the middle position.
  1209. Let Wmg be the weight for choosing a Guard for the middle position.
  1210. Let Wgg be the weight for choosing a Guard for the guard position.
  1211. Let Wee be the weight for choosing an Exit for the exit position.
  1212. Balanced network conditions then arise from solutions to the following
  1213. system of equations:
  1214. Wgg*G + Wgd*D == M + Wmd*D + Wme*E + Wmg*G (guard bw = middle bw)
  1215. Wgg*G + Wgd*D == Wee*E + Wed*D (guard bw = exit bw)
  1216. Wed*D + Wmd*D + Wgd*D == D (aka: Wed+Wmd+Wdg = 1)
  1217. Wmg*G + Wgg*G == G (aka: Wgg = 1-Wmg)
  1218. Wme*E + Wee*E == E (aka: Wee = 1-Wme)
  1219. We are short 2 constraints with the above set. The remaining constraints
  1220. come from examining different cases of network load.
  1221. Case 1: E >= T/3 && G >= T/3 (Neither Exit nor Guard Scarce)
  1222. In this case, the additional two constraints are: Wme*E == Wmd*D and
  1223. Wgd == 0, which maximizes Exit-flagged bandwidth in the middle position.
  1224. This leads to the solution:
  1225. Wgg = (weight_scale*(D+E+G+M))/(3*G)
  1226. Wmd = (weight_scale*(2*D + 2*E - G - M))/(6*D)
  1227. Wme = (weight_scale*(2*D + 2*E - G - M))/(6*E)
  1228. Wee = (weight_scale*(-2*D + 4*E + G + M))/(6*E)
  1229. Wmg = weight_scale - Wgg
  1230. Wed = weight_scale - Wmd
  1231. Wgd = 0
  1232. Case 2: E < T/3 && G < T/3 (Both are scarce)
  1233. Let R denote the more scarce class (Rare) between Guard vs Exit.
  1234. Let S denote the less scarce class.
  1235. Subcase a: R+D < S
  1236. In this subcase, we simply devote all of D bandwidth to the
  1237. scarce class.
  1238. Wgg = Wee = weight_scale
  1239. Wmg = Wme = Wmd = 0;
  1240. if E < G:
  1241. Wed = weight_scale
  1242. Wgd = 0
  1243. else:
  1244. Wed = 0
  1245. Wgd = weight_scale
  1246. Subcase b: R+D >= S
  1247. In this case, if M <= T/3, we have enough bandwidth to try to achieve
  1248. a balancing condition, and add the constraints Wgg == 1 and
  1249. Wme*E == Wmd*D:
  1250. Wgg = weight_scale
  1251. Wgd = (weight_scale*(D + E - 2*G + M))/(3*D) (T/3 >= G (Ok))
  1252. Wmd = (weight_scale*(D + E + G - 2*M))/(6*D) (T/3 >= M)
  1253. Wme = (weight_scale*(D + E + G - 2*M))/(6*E)
  1254. Wee = (weight_scale*(-D + 5*E - G + 2*M))/(6*E) (2E+M >= T/3)
  1255. Wmg = 0;
  1256. Wed = weight_scale - Wgd - Wmd
  1257. If M >= T/3, the above solution will not be valid (one of the weights
  1258. will be < 0 or > 1). In this case, we use:
  1259. Wgg = weight_scale
  1260. Wee = weight_scale
  1261. Wmg = Wme = Wmd = 0
  1262. Wgd = (weight_scale*(D+E-G))/(2*D)
  1263. Wed = weight_scale - Wgd
  1264. Case 3: One of E < T/3 or G < T/3
  1265. Let S be the scarce class (of E or G).
  1266. Subcase a: (S+D) < T/3:
  1267. if G=S:
  1268. Wgg = Wgd = weight_scale;
  1269. Wmd = Wed = Wmg = 0;
  1270. Wme = (weight_scale*(E-M))/(2*E);
  1271. Wee = weight_scale-Wme;
  1272. if E=S:
  1273. Wee = Wed = weight_scale;
  1274. Wmd = Wgd = Wmg = 0;
  1275. Wmg = (weight_scale*(G-M))/(2*G);
  1276. Wgg = weight_scale-Wmg;
  1277. Subcase b: (S+D) >= T/3
  1278. if G=S:
  1279. Add constraints Wmg = 0, Wme*E == Wmd*D to maximize exit bandwidth
  1280. in the middle position:
  1281. Wgd = (weight_scale*(D + E - 2*G + M))/(3*D);
  1282. Wmd = (weight_scale*(D + E + G - 2*M))/(6*D);
  1283. Wme = (weight_scale*(D + E + G - 2*M))/(6*E);
  1284. Wee = (weight_scale*(-D + 5*E - G + 2*M))/(6*E);
  1285. Wgg = weight_scale;
  1286. Wmg = 0;
  1287. Wed = weight_scale - Wgd - Wmd;
  1288. if E=S:
  1289. Add constraints Wgd = 0, Wme*E == Wmd*D:
  1290. Wgg = (weight_scale*(D + E + G + M))/(3*G);
  1291. Wmd = (weight_scale*(2*D + 2*E - G - M))/(6*D);
  1292. Wme = (weight_scale*(2*D + 2*E - G - M))/(6*E);
  1293. Wee = (weight_scale*(-2*D + 4*E + G + M))/(6*E);
  1294. Wgd = 0;
  1295. Wmg = weight_scale - Wgg;
  1296. Wed = weight_scale - Wmd;
  1297. To ensure consensus, all calculations are performed using integer math
  1298. with a fixed precision determined by the bwweightscale consensus
  1299. parameter (defaults at 10000).
  1300. For future balancing improvements, Tor clients support 11 additional weights
  1301. for directory requests and middle weighting. These weights are currently
  1302. set at weight_scale, with the exception of the following groups of
  1303. assignments:
  1304. Directory requests use middle weights:
  1305. Wbd=Wmd, Wbg=Wmg, Wbe=Wme, Wbm=Wmm
  1306. Handle bridges and strange exit policies:
  1307. Wgm=Wgg, Wem=Wee, Weg=Wed
  1308. 3.5. Detached signatures
  1309. Assuming full connectivity, every authority should compute and sign the
  1310. same consensus directory in each period. Therefore, it isn't necessary to
  1311. download the consensus computed by each authority; instead, the
  1312. authorities only push/fetch each others' signatures. A "detached
  1313. signature" document contains items as follows:
  1314. "consensus-digest" SP Digest NL
  1315. [At start, at most once.]
  1316. The digest of the consensus being signed.
  1317. "valid-after" SP YYYY-MM-DD SP HH:MM:SS NL
  1318. "fresh-until" SP YYYY-MM-DD SP HH:MM:SS NL
  1319. "valid-until" SP YYYY-MM-DD SP HH:MM:SS NL
  1320. [As in the consensus]
  1321. "directory-signature"
  1322. [As in the consensus; the signature object is the same as in the
  1323. consensus document.]
  1324. 4. Directory server operation
  1325. All directory authorities and directory caches ("directory servers")
  1326. implement this section, except as noted.
  1327. 4.1. Accepting uploads (authorities only)
  1328. When a router posts a signed descriptor to a directory authority, the
  1329. authority first checks whether it is well-formed and correctly
  1330. self-signed. If it is, the authority next verifies that the nickname
  1331. in question is not already assigned to a router with a different
  1332. public key.
  1333. Finally, the authority MAY check that the router is not blacklisted
  1334. because of its key, IP, or another reason.
  1335. If the descriptor passes these tests, and the authority does not already
  1336. have a descriptor for a router with this public key, it accepts the
  1337. descriptor and remembers it.
  1338. If the authority _does_ have a descriptor with the same public key, the
  1339. newly uploaded descriptor is remembered if its publication time is more
  1340. recent than the most recent old descriptor for that router, and either:
  1341. - There are non-cosmetic differences between the old descriptor and the
  1342. new one.
  1343. - Enough time has passed between the descriptors' publication times.
  1344. (Currently, 12 hours.)
  1345. Differences between router descriptors are "non-cosmetic" if they would be
  1346. sufficient to force an upload as described in section 2 above.
  1347. Note that the "cosmetic difference" test only applies to uploaded
  1348. descriptors, not to descriptors that the authority downloads from other
  1349. authorities.
  1350. When a router posts a signed extra-info document to a directory authority,
  1351. the authority again checks it for well-formedness and correct signature,
  1352. and checks that its matches the extra-info-digest in some router
  1353. descriptor that it believes is currently useful. If so, it accepts it and
  1354. stores it and serves it as requested. If not, it drops it.
  1355. 4.2. Voting (authorities only)
  1356. Authorities divide time into Intervals. Authority administrators SHOULD
  1357. try to all pick the same interval length, and SHOULD pick intervals that
  1358. are commonly used divisions of time (e.g., 5 minutes, 15 minutes, 30
  1359. minutes, 60 minutes, 90 minutes). Voting intervals SHOULD be chosen to
  1360. divide evenly into a 24-hour day.
  1361. Authorities SHOULD act according to interval and delays in the
  1362. latest consensus. Lacking a latest consensus, they SHOULD default to a
  1363. 30-minute Interval, a 5 minute VotingDelay, and a 5 minute DistDelay.
  1364. Authorities MUST take pains to ensure that their clocks remain accurate
  1365. within a few seconds. (Running NTP is usually sufficient.)
  1366. The first voting period of each day begins at 00:00 (midnight) GMT. If
  1367. the last period of the day would be truncated by one-half or more, it is
  1368. merged with the second-to-last period.
  1369. An authority SHOULD publish its vote immediately at the start of each voting
  1370. period (minus VoteSeconds+DistSeconds). It does this by making it
  1371. available at
  1372. http://<hostname>/tor/status-vote/next/authority.z
  1373. and sending it in an HTTP POST request to each other authority at the URL
  1374. http://<hostname>/tor/post/vote
  1375. If, at the start of the voting period, minus DistSeconds, an authority
  1376. does not have a current statement from another authority, the first
  1377. authority downloads the other's statement.
  1378. Once an authority has a vote from another authority, it makes it available
  1379. at
  1380. http://<hostname>/tor/status-vote/next/<fp>.z
  1381. where <fp> is the fingerprint of the other authority's identity key.
  1382. And at
  1383. http://<hostname>/tor/status-vote/next/d/<d>.z
  1384. where <d> is the digest of the vote document.
  1385. The consensus status, along with as many signatures as the server
  1386. currently knows, should be available at
  1387. http://<hostname>/tor/status-vote/next/consensus.z
  1388. All of the detached signatures it knows for consensus status should be
  1389. available at:
  1390. http://<hostname>/tor/status-vote/next/consensus-signatures.z
  1391. Once there are enough signatures, or once the voting period starts,
  1392. these documents are available at
  1393. http://<hostname>/tor/status-vote/current/consensus.z
  1394. and
  1395. http://<hostname>/tor/status-vote/current/consensus-signatures.z
  1396. [XXX current/consensus-signatures is not currently implemented, as it
  1397. is not used in the voting protocol.]
  1398. The other vote documents are analogously made available under
  1399. http://<hostname>/tor/status-vote/current/authority.z
  1400. http://<hostname>/tor/status-vote/current/<fp>.z
  1401. http://<hostname>/tor/status-vote/current/d/<d>.z
  1402. once the consensus is complete.
  1403. Once an authority has computed and signed a consensus network status, it
  1404. should send its detached signature to each other authority in an HTTP POST
  1405. request to the URL:
  1406. http://<hostname>/tor/post/consensus-signature
  1407. [XXX Note why we support push-and-then-pull.]
  1408. [XXX possible future features include support for downloading old
  1409. consensuses.]
  1410. 4.3. Downloading consensus status documents (caches only)
  1411. All directory servers (authorities and caches) try to keep a recent
  1412. network-status consensus document to serve to clients. A cache ALWAYS
  1413. downloads a network-status consensus if any of the following are true:
  1414. - The cache has no consensus document.
  1415. - The cache's consensus document is no longer valid.
  1416. Otherwise, the cache downloads a new consensus document at a randomly
  1417. chosen time in the first half-interval after its current consensus
  1418. stops being fresh. (This time is chosen at random to avoid swarming
  1419. the authorities at the start of each period. The interval size is
  1420. inferred from the difference between the valid-after time and the
  1421. fresh-until time on the consensus.)
  1422. [For example, if a cache has a consensus that became valid at 1:00,
  1423. and is fresh until 2:00, that cache will fetch a new consensus at
  1424. a random time between 2:00 and 2:30.]
  1425. 4.4. Downloading and storing router descriptors (authorities and caches)
  1426. Periodically (currently, every 10 seconds), directory servers check
  1427. whether there are any specific descriptors that they do not have and that
  1428. they are not currently trying to download. Caches identify these
  1429. descriptors by hash in the recent network-status consensus documents;
  1430. authorities identify them by hash in vote (if publication date is more
  1431. recent than the descriptor we currently have).
  1432. [XXXX need a way to fetch descriptors ahead of the vote? v2 status docs can
  1433. do that for now.]
  1434. If so, the directory server launches requests to the authorities for these
  1435. descriptors, such that each authority is only asked for descriptors listed
  1436. in its most recent vote (if the requester is an authority) or in the
  1437. consensus (if the requester is a cache). If we're an authority, and more
  1438. than one authority lists the descriptor, we choose which to ask at random.
  1439. If one of these downloads fails, we do not try to download that descriptor
  1440. from the authority that failed to serve it again unless we receive a newer
  1441. network-status (consensus or vote) from that authority that lists the same
  1442. descriptor.
  1443. Directory servers must potentially cache multiple descriptors for each
  1444. router. Servers must not discard any descriptor listed by any recent
  1445. consensus. If there is enough space to store additional descriptors,
  1446. servers SHOULD try to hold those which clients are likely to download the
  1447. most. (Currently, this is judged based on the interval for which each
  1448. descriptor seemed newest.)
  1449. [XXXX define recent]
  1450. Authorities SHOULD NOT download descriptors for routers that they would
  1451. immediately reject for reasons listed in 3.1.
  1452. 4.5. Downloading and storing extra-info documents
  1453. All authorities, and any cache that chooses to cache extra-info documents,
  1454. and any client that uses extra-info documents, should implement this
  1455. section.
  1456. Note that generally, clients don't need extra-info documents.
  1457. Periodically, the Tor instance checks whether it is missing any extra-info
  1458. documents: in other words, if it has any router descriptors with an
  1459. extra-info-digest field that does not match any of the extra-info
  1460. documents currently held. If so, it downloads whatever extra-info
  1461. documents are missing. Caches download from authorities; non-caches try
  1462. to download from caches. We follow the same splitting and back-off rules
  1463. as in 4.4 (if a cache) or 5.3 (if a client).
  1464. 4.6. General-use HTTP URLs
  1465. "Fingerprints" in these URLs are base-16-encoded SHA1 hashes.
  1466. The most recent v3 consensus should be available at:
  1467. http://<hostname>/tor/status-vote/current/consensus.z
  1468. Starting with Tor version 0.2.1.1-alpha is also available at:
  1469. http://<hostname>/tor/status-vote/current/consensus/<F1>+<F2>+<F3>.z
  1470. Where F1, F2, etc. are authority identity fingerprints the client trusts.
  1471. Servers will only return a consensus if more than half of the requested
  1472. authorities have signed the document, otherwise a 404 error will be sent
  1473. back. The fingerprints can be shortened to a length of any multiple of
  1474. two, using only the leftmost part of the encoded fingerprint. Tor uses
  1475. 3 bytes (6 hex characters) of the fingerprint.
  1476. Clients SHOULD sort the fingerprints in ascending order. Server MUST
  1477. accept any order.
  1478. Clients SHOULD use this format when requesting consensus documents from
  1479. directory authority servers and from caches running a version of Tor
  1480. that is known to support this URL format.
  1481. A concatenated set of all the current key certificates should be available
  1482. at:
  1483. http://<hostname>/tor/keys/all.z
  1484. The key certificate for this server (if it is an authority) should be
  1485. available at:
  1486. http://<hostname>/tor/keys/authority.z
  1487. The key certificate for an authority whose authority identity fingerprint
  1488. is <F> should be available at:
  1489. http://<hostname>/tor/keys/fp/<F>.z
  1490. The key certificate whose signing key fingerprint is <F> should be
  1491. available at:
  1492. http://<hostname>/tor/keys/sk/<F>.z
  1493. The key certificate whose identity key fingerprint is <F> and whose signing
  1494. key fingerprint is <S> should be available at:
  1495. http://<hostname>/tor/keys/fp-sk/<F>-<S>.z
  1496. (As usual, clients may request multiple certificates using:
  1497. http://<hostname>/tor/keys/fp-sk/<F1>-<S1>+<F2>-<S2>.z )
  1498. [The above fp-sk format was not supported before Tor 0.2.1.9-alpha.]
  1499. The most recent descriptor for a server whose identity key has a
  1500. fingerprint of <F> should be available at:
  1501. http://<hostname>/tor/server/fp/<F>.z
  1502. The most recent descriptors for servers with identity fingerprints
  1503. <F1>,<F2>,<F3> should be available at:
  1504. http://<hostname>/tor/server/fp/<F1>+<F2>+<F3>.z
  1505. (NOTE: Implementations SHOULD NOT download descriptors by identity key
  1506. fingerprint. This allows a corrupted server (in collusion with a cache) to
  1507. provide a unique descriptor to a client, and thereby partition that client
  1508. from the rest of the network.)
  1509. The server descriptor with (descriptor) digest <D> (in hex) should be
  1510. available at:
  1511. http://<hostname>/tor/server/d/<D>.z
  1512. The most recent descriptors with digests <D1>,<D2>,<D3> should be
  1513. available at:
  1514. http://<hostname>/tor/server/d/<D1>+<D2>+<D3>.z
  1515. The most recent descriptor for this server should be at:
  1516. http://<hostname>/tor/server/authority.z
  1517. [Nothing in the Tor protocol uses this resource yet, but it is useful
  1518. for debugging purposes. Also, the official Tor implementations
  1519. (starting at 0.1.1.x) use this resource to test whether a server's
  1520. own DirPort is reachable.]
  1521. A concatenated set of the most recent descriptors for all known servers
  1522. should be available at:
  1523. http://<hostname>/tor/server/all.z
  1524. Extra-info documents are available at the URLS
  1525. http://<hostname>/tor/extra/d/...
  1526. http://<hostname>/tor/extra/fp/...
  1527. http://<hostname>/tor/extra/all[.z]
  1528. http://<hostname>/tor/extra/authority[.z]
  1529. (As for /tor/server/ URLs: supports fetching extra-info
  1530. documents by their digest, by the fingerprint of their servers,
  1531. or all at once. When serving by fingerprint, we serve the
  1532. extra-info that corresponds to the descriptor we would serve by
  1533. that fingerprint. Only directory authorities of version
  1534. 0.2.0.1-alpha or later are guaranteed to support the first
  1535. three classes of URLs. Caches may support them, and MUST
  1536. support them if they have advertised "caches-extra-info".)
  1537. For debugging, directories SHOULD expose non-compressed objects at URLs like
  1538. the above, but without the final ".z".
  1539. Clients MUST handle compressed concatenated information in two forms:
  1540. - A concatenated list of zlib-compressed objects.
  1541. - A zlib-compressed concatenated list of objects.
  1542. Directory servers MAY generate either format: the former requires less
  1543. CPU, but the latter requires less bandwidth.
  1544. Clients SHOULD use upper case letters (A-F) when base16-encoding
  1545. fingerprints. Servers MUST accept both upper and lower case fingerprints
  1546. in requests.
  1547. 5. Client operation: downloading information
  1548. Every Tor that is not a directory server (that is, those that do
  1549. not have a DirPort set) implements this section.
  1550. 5.1. Downloading network-status documents
  1551. Each client maintains a list of directory authorities. Insofar as
  1552. possible, clients SHOULD all use the same list.
  1553. Clients try to have a live consensus network-status document at all times.
  1554. A network-status document is "live" if the time in its valid-until field
  1555. has not passed.
  1556. If a client is missing a live network-status document, it tries to fetch
  1557. it from a directory cache (or from an authority if it knows no caches).
  1558. On failure, the client waits briefly, then tries that network-status
  1559. document again from another cache. The client does not build circuits
  1560. until it has a live network-status consensus document, and it has
  1561. descriptors for more than 1/4 of the routers that it believes are running.
  1562. (Note: clients can and should pick caches based on the network-status
  1563. information they have: once they have first fetched network-status info
  1564. from an authority, they should not need to go to the authority directly
  1565. again.)
  1566. To avoid swarming the caches whenever a consensus expires, the
  1567. clients download new consensuses at a randomly chosen time after the
  1568. caches are expected to have a fresh consensus, but before their
  1569. consensus will expire. (This time is chosen uniformly at random from
  1570. the interval between the time 3/4 into the first interval after the
  1571. consensus is no longer fresh, and 7/8 of the time remaining after
  1572. that before the consensus is invalid.)
  1573. [For example, if a cache has a consensus that became valid at 1:00,
  1574. and is fresh until 2:00, and expires at 4:00, that cache will fetch
  1575. a new consensus at a random time between 2:45 and 3:50, since 3/4
  1576. of the one-hour interval is 45 minutes, and 7/8 of the remaining 75
  1577. minutes is 65 minutes.]
  1578. 5.2. Downloading and storing router descriptors
  1579. Clients try to have the best descriptor for each router. A descriptor is
  1580. "best" if:
  1581. * It is listed in the consensus network-status document.
  1582. Periodically (currently every 10 seconds) clients check whether there are
  1583. any "downloadable" descriptors. A descriptor is downloadable if:
  1584. - It is the "best" descriptor for some router.
  1585. - The descriptor was published at least 10 minutes in the past.
  1586. (This prevents clients from trying to fetch descriptors that the
  1587. mirrors have probably not yet retrieved and cached.)
  1588. - The client does not currently have it.
  1589. - The client is not currently trying to download it.
  1590. - The client would not discard it immediately upon receiving it.
  1591. - The client thinks it is running and valid (see 6.1 below).
  1592. If at least 16 known routers have downloadable descriptors, or if
  1593. enough time (currently 10 minutes) has passed since the last time the
  1594. client tried to download descriptors, it launches requests for all
  1595. downloadable descriptors, as described in 5.3 below.
  1596. When a descriptor download fails, the client notes it, and does not
  1597. consider the descriptor downloadable again until a certain amount of time
  1598. has passed. (Currently 0 seconds for the first failure, 60 seconds for the
  1599. second, 5 minutes for the third, 10 minutes for the fourth, and 1 day
  1600. thereafter.) Periodically (currently once an hour) clients reset the
  1601. failure count.
  1602. Clients retain the most recent descriptor they have downloaded for each
  1603. router so long as it is not too old (currently, 48 hours), OR so long as
  1604. no better descriptor has been downloaded for the same router.
  1605. [Versions of Tor before 0.1.2.3-alpha would discard descriptors simply for
  1606. being published too far in the past.] [The code seems to discard
  1607. descriptors in all cases after they're 5 days old. True? -RD]
  1608. 5.3. Managing downloads
  1609. When a client has no consensus network-status document, it downloads it
  1610. from a randomly chosen authority. In all other cases, the client
  1611. downloads from caches randomly chosen from among those believed to be V2
  1612. directory servers. (This information comes from the network-status
  1613. documents; see 6 below.)
  1614. When downloading multiple router descriptors, the client chooses multiple
  1615. mirrors so that:
  1616. - At least 3 different mirrors are used, except when this would result
  1617. in more than one request for under 4 descriptors.
  1618. - No more than 128 descriptors are requested from a single mirror.
  1619. - Otherwise, as few mirrors as possible are used.
  1620. After choosing mirrors, the client divides the descriptors among them
  1621. randomly.
  1622. After receiving any response client MUST discard any network-status
  1623. documents and descriptors that it did not request.
  1624. 6. Using directory information
  1625. Everyone besides directory authorities uses the approaches in this section
  1626. to decide which servers to use and what their keys are likely to be.
  1627. (Directory authorities just believe their own opinions, as in 3.1 above.)
  1628. 6.1. Choosing routers for circuits.
  1629. Circuits SHOULD NOT be built until the client has enough directory
  1630. information: a live consensus network status [XXXX fallback?] and
  1631. descriptors for at least 1/4 of the servers believed to be running.
  1632. A server is "listed" if it is included by the consensus network-status
  1633. document. Clients SHOULD NOT use unlisted servers.
  1634. These flags are used as follows:
  1635. - Clients SHOULD NOT use non-'Valid' or non-'Running' routers unless
  1636. requested to do so.
  1637. - Clients SHOULD NOT use non-'Fast' routers for any purpose other than
  1638. very-low-bandwidth circuits (such as introduction circuits).
  1639. - Clients SHOULD NOT use non-'Stable' routers for circuits that are
  1640. likely to need to be open for a very long time (such as those used for
  1641. IRC or SSH connections).
  1642. - Clients SHOULD NOT choose non-'Guard' nodes when picking entry guard
  1643. nodes.
  1644. - Clients SHOULD NOT download directory information from non-'V2Dir'
  1645. caches.
  1646. See the "path-spec.txt" document for more details.
  1647. 6.2. Managing naming
  1648. In order to provide human-memorable names for individual server
  1649. identities, some directory servers bind names to IDs. Clients handle
  1650. names in two ways:
  1651. When a client encounters a name it has not mapped before:
  1652. If the consensus lists any router with that name as "Named", or if
  1653. consensus-method 2 or later is in use and the consensus lists any
  1654. router with that name as having the "Unnamed" flag, then the name is
  1655. bound. (It's bound to the ID listed in the entry with the Named,
  1656. or to an unknown ID if no name is found.)
  1657. When the user refers to a bound name, the implementation SHOULD provide
  1658. only the router with ID bound to that name, and no other router, even
  1659. if the router with the right ID can't be found.
  1660. When a user tries to refer to a non-bound name, the implementation SHOULD
  1661. warn the user. After warning the user, the implementation MAY use any
  1662. router that advertises the name.
  1663. Not every router needs a nickname. When a router doesn't configure a
  1664. nickname, it publishes with the default nickname "Unnamed". Authorities
  1665. SHOULD NOT ever mark a router with this nickname as Named; client software
  1666. SHOULD NOT ever use a router in response to a user request for a router
  1667. called "Unnamed".
  1668. 6.3. Software versions
  1669. An implementation of Tor SHOULD warn when it has fetched a consensus
  1670. network-status, and it is running a software version not listed.
  1671. 6.4. Warning about a router's status.
  1672. If a router tries to publish its descriptor to a Naming authority
  1673. that has its nickname mapped to another key, the router SHOULD
  1674. warn the operator that it is either using the wrong key or is using
  1675. an already claimed nickname.
  1676. If a router has fetched a consensus document,, and the
  1677. authorities do not publish a binding for the router's nickname, the
  1678. router MAY remind the operator that the chosen nickname is not
  1679. bound to this key at the authorities, and suggest contacting the
  1680. authority operators.
  1681. ...
  1682. 6.5. Router protocol versions
  1683. A client should believe that a router supports a given feature if that
  1684. feature is supported by the router or protocol versions in more than half
  1685. of the live networkstatuses' "v" entries for that router. In other words,
  1686. if the "v" entries for some router are:
  1687. v Tor 0.0.8pre1 (from authority 1)
  1688. v Tor 0.1.2.11 (from authority 2)
  1689. v FutureProtocolDescription 99 (from authority 3)
  1690. then the client should believe that the router supports any feature
  1691. supported by 0.1.2.11.
  1692. This is currently equivalent to believing the median declared version for
  1693. a router in all live networkstatuses.
  1694. 7. Standards compliance
  1695. All clients and servers MUST support HTTP 1.0. Clients and servers MAY
  1696. support later versions of HTTP as well.
  1697. 7.1. HTTP headers
  1698. Servers MAY set the Content-Length: header. Servers SHOULD set
  1699. Content-Encoding to "deflate" or "identity".
  1700. Servers MAY include an X-Your-Address-Is: header, whose value is the
  1701. apparent IP address of the client connecting to them (as a dotted quad).
  1702. For directory connections tunneled over a BEGIN_DIR stream, servers SHOULD
  1703. report the IP from which the circuit carrying the BEGIN_DIR stream reached
  1704. them. [Servers before version 0.1.2.5-alpha reported 127.0.0.1 for all
  1705. BEGIN_DIR-tunneled connections.]
  1706. Servers SHOULD disable caching of multiple network statuses or multiple
  1707. router descriptors. Servers MAY enable caching of single descriptors,
  1708. single network statuses, the list of all router descriptors, a v1
  1709. directory, or a v1 running routers document. XXX mention times.
  1710. 7.2. HTTP status codes
  1711. Tor delivers the following status codes. Some were chosen without much
  1712. thought; other code SHOULD NOT rely on specific status codes yet.
  1713. 200 -- the operation completed successfully
  1714. -- the user requested statuses or serverdescs, and none of the ones we
  1715. requested were found (0.2.0.4-alpha and earlier).
  1716. 304 -- the client specified an if-modified-since time, and none of the
  1717. requested resources have changed since that time.
  1718. 400 -- the request is malformed, or
  1719. -- the URL is for a malformed variation of one of the URLs we support,
  1720. or
  1721. -- the client tried to post to a non-authority, or
  1722. -- the authority rejected a malformed posted document, or
  1723. 404 -- the requested document was not found.
  1724. -- the user requested statuses or serverdescs, and none of the ones
  1725. requested were found (0.2.0.5-alpha and later).
  1726. 503 -- we are declining the request in order to save bandwidth
  1727. -- user requested some items that we ordinarily generate or store,
  1728. but we do not have any available.
  1729. 9. Backward compatibility and migration plans
  1730. Until Tor versions before 0.1.1.x are completely obsolete, directory
  1731. authorities should generate, and mirrors should download and cache, v1
  1732. directories and running-routers lists, and allow old clients to download
  1733. them. These documents and the rules for retrieving, serving, and caching
  1734. them are described in dir-spec-v1.txt.
  1735. Until Tor versions before 0.2.0.x are completely obsolete, directory
  1736. authorities should generate, mirrors should download and cache, v2
  1737. network-status documents, and allow old clients to download them.
  1738. Additionally, all directory servers and caches should download, store, and
  1739. serve any router descriptor that is required because of v2 network-status
  1740. documents. These documents and the rules for retrieving, serving, and
  1741. caching them are described in dir-spec-v1.txt.
  1742. A. Consensus-negotiation timeline.
  1743. Period begins: this is the Published time.
  1744. Everybody sends votes
  1745. Reconciliation: everybody tries to fetch missing votes.
  1746. consensus may exist at this point.
  1747. End of voting period:
  1748. everyone swaps signatures.
  1749. Now it's okay for caches to download
  1750. Now it's okay for clients to download.
  1751. Valid-after/valid-until switchover