dir-spec.txt 99 KB

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