aboutsummaryrefslogtreecommitdiff
path: root/spec/control-spec
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2023-10-13 18:00:42 -0400
committerNick Mathewson <nickm@torproject.org>2023-10-13 18:00:42 -0400
commitf79272ef1f774b3788b74a3fe4fef75095dfae06 (patch)
tree8f47bebaa06c444f632bf8c4afbd793c4972a27d /spec/control-spec
parentfa014ec90411fd754dd257d04afa1a953e15bf31 (diff)
downloadtorspec-f79272ef1f774b3788b74a3fe4fef75095dfae06.tar.gz
torspec-f79272ef1f774b3788b74a3fe4fef75095dfae06.zip
Run markdownlint --fix on spec.
Diffstat (limited to 'spec/control-spec')
-rw-r--r--spec/control-spec/commands.md38
-rw-r--r--spec/control-spec/implementation-notes.md27
-rw-r--r--spec/control-spec/message-format.md7
-rw-r--r--spec/control-spec/protocol-outline.md3
-rw-r--r--spec/control-spec/replies.md32
-rw-r--r--spec/control-spec/scope.md2
6 files changed, 95 insertions, 14 deletions
diff --git a/spec/control-spec/commands.md b/spec/control-spec/commands.md
index 254633e..f59a548 100644
--- a/spec/control-spec/commands.md
+++ b/spec/control-spec/commands.md
@@ -1,9 +1,11 @@
<a id="control-spec.txt-3"></a>
+
# Commands
All commands are case-insensitive, but most keywords are case-sensitive.
<a id="control-spec.txt-3.1"></a>
+
## SETCONF
Change the value of one or more configuration variables. The syntax is:
@@ -42,6 +44,7 @@ options with a single SETCONF command (e.g. SETCONF ORPort=443
ORListenAddress=9001).
<a id="control-spec.txt-3.2"></a>
+
## RESETCONF
Remove all settings for a given configuration option entirely, assign
@@ -54,6 +57,7 @@ its default. The syntax is:
Otherwise it behaves like SETCONF above.
<a id="control-spec.txt-3.3"></a>
+
## GETCONF
Request the value of zero or more configuration variable(s).
@@ -91,6 +95,7 @@ virtual keyword to get all HiddenServiceDir, HiddenServicePort,
HiddenServiceVersion, and HiddenserviceAuthorizeClient option settings.
<a id="control-spec.txt-3.4"></a>
+
## SETEVENTS
Request the server to inform the client about interesting events. The
@@ -100,7 +105,7 @@ syntax is:
EventCode = 1*(ALPHA / "_") (see section 4.1.x for event types)
-Any events *not* listed in the SETEVENTS line are turned off; thus, sending
+Any events _not_ listed in the SETEVENTS line are turned off; thus, sending
SETEVENTS with an empty body turns off all event reporting.
The server responds with a "250 OK" reply on success, and a "552
@@ -117,6 +122,7 @@ always-on in Tor 0.2.2.1-alpha and later.
Each event is described in more detail in Section 4.1.
<a id="control-spec.txt-3.5"></a>
+
## AUTHENTICATE
Sent from the client to the server. The syntax is:
@@ -163,6 +169,7 @@ case, the controller should just send "AUTHENTICATE" CRLF.
connection after an authentication failure.)
<a id="control-spec.txt-3.6"></a>
+
## SAVECONF
Sent from the client to the server. The syntax is:
@@ -185,6 +192,7 @@ See also the "getinfo config-can-saveconf" command, to tell if the FORCE
flag will be required. (Also introduced in 0.3.1.1-alpha.)
<a id="control-spec.txt-3.7"></a>
+
## SIGNAL
Sent from the client to the server. The syntax is:
@@ -239,6 +247,7 @@ signal that have them.
```
<a id="control-spec.txt-3.8"></a>
+
## MAPADDRESS
Sent from the client to the server. The syntax is:
@@ -325,6 +334,7 @@ Example:
```
<a id="control-spec.txt-3.9"></a>
+
## GETINFO
Sent from the client to the server. The syntax is as for GETCONF:
@@ -963,6 +973,7 @@ ReplyLine. If a value fits on a single line, the format is:
```
<a id="control-spec.txt-3.10"></a>
+
## EXTENDCIRCUIT
Sent from the client to the server. The format is:
@@ -993,6 +1004,7 @@ message body consisting of the CircuitID of the (maybe newly created)
circuit. The syntax is "250" SP "EXTENDED" SP CircuitID CRLF.
<a id="control-spec.txt-3.11"></a>
+
## SETCIRCUITPURPOSE
Sent from the client to the server. The format is:
@@ -1002,6 +1014,7 @@ Sent from the client to the server. The format is:
This changes the circuit's purpose. See EXTENDCIRCUIT above for details.
<a id="control-spec.txt-3.12"></a>
+
## SETROUTERPURPOSE
Sent from the client to the server. The format is:
@@ -1016,6 +1029,7 @@ NOTE: This command was disabled and made obsolete as of Tor
historical interest.
<a id="control-spec.txt-3.13"></a>
+
## ATTACHSTREAM
Sent from the client to the server. The syntax is:
@@ -1057,6 +1071,7 @@ yet, in which case Tor will detach the stream from its current circuit
before proceeding with the new attach request.}
<a id="control-spec.txt-3.14"></a>
+
## POSTDESCRIPTOR
Sent from the client to the server. The syntax is:
@@ -1085,6 +1100,7 @@ whose body explains why the server was not added. If the descriptor
is added, Tor replies with "250 OK".
<a id="control-spec.txt-3.15"></a>
+
## REDIRECTSTREAM
Sent from the client to the server. The syntax is:
@@ -1102,6 +1118,7 @@ a circuit.
Tor replies with "250 OK" on success.
<a id="control-spec.txt-3.16"></a>
+
## CLOSESTREAM
Sent from the client to the server. The syntax is:
@@ -1117,6 +1134,7 @@ Tor replies with "250 OK" on success, or a 512 if there aren't enough
arguments, or a 552 if it doesn't recognize the StreamID or reason.
<a id="control-spec.txt-3.17"></a>
+
## CLOSECIRCUIT
The syntax is:
@@ -1136,12 +1154,14 @@ Tor replies with "250 OK" on success, or a 512 if there aren't enough
arguments, or a 552 if it doesn't recognize the CircuitID.
<a id="control-spec.txt-3.18"></a>
+
## QUIT
Tells the server to hang up on this controller connection. This command
can be used before authenticating.
<a id="control-spec.txt-3.19"></a>
+
## USEFEATURE
Adding additional features to the control protocol sometimes will break
@@ -1191,6 +1211,7 @@ EXTENDED_EVENTS
```
<a id="control-spec.txt-3.20"></a>
+
## RESOLVE
The syntax is
@@ -1209,6 +1230,7 @@ need to listen for ADDRMAP events; see 4.1.7 below.
[Added in Tor 0.2.0.3-alpha]
<a id="control-spec.txt-3.21"></a>
+
## PROTOCOLINFO
The syntax is:
@@ -1285,6 +1307,7 @@ only once!) before AUTHENTICATE.]
[PROTOCOLINFO was not supported before Tor 0.2.0.5-alpha.]
<a id="control-spec.txt-3.22"></a>
+
## LOADCONF
The syntax is:
@@ -1298,6 +1321,7 @@ it had been read from disk.
[LOADCONF was added in Tor 0.2.1.1-alpha.]
<a id="control-spec.txt-3.23"></a>
+
## TAKEOWNERSHIP
The syntax is:
@@ -1347,6 +1371,7 @@ should 'own' that Tor process:
```
<a id="control-spec.txt-3.24"></a>
+
## AUTHCHALLENGE
The syntax is:
@@ -1403,6 +1428,7 @@ used (but only once!) before AUTHENTICATE.]
[AUTHCHALLENGE was added in Tor 0.2.3.13-alpha.]
<a id="control-spec.txt-3.25"></a>
+
## DROPGUARDS
The syntax is:
@@ -1417,6 +1443,7 @@ Tor replies with "250 OK" on success.
[DROPGUARDS was added in Tor 0.2.5.2-alpha.]
<a id="control-spec.txt-3.26"></a>
+
## HSFETCH
The syntax is:
@@ -1473,6 +1500,7 @@ Examples are:
[HS v3 support added 0.4.1.1-alpha]
<a id="control-spec.txt-3.27"></a>
+
## ADD_ONION
The syntax is:
@@ -1655,6 +1683,7 @@ Examples:
[ClientV3Auth support added 0.4.6.1-alpha]
<a id="control-spec.txt-3.28"></a>
+
## DEL_ONION
The syntax is:
@@ -1686,6 +1715,7 @@ number of arguments, or a 552 if it doesn't recognize the ServiceID.
[HS v3 support added 0.3.3.1-alpha]
<a id="control-spec.txt-3.29"></a>
+
## HSPOST
The syntax is:
@@ -1728,6 +1758,7 @@ Examples are:
```
<a id="control-spec.txt-3.30"></a>
+
## ONION_CLIENT_AUTH_ADD
The syntax is:
@@ -1778,6 +1809,7 @@ On success, "250 OK" is returned. Otherwise, the following error codes exist:
```
<a id="control-spec.txt-3.31"></a>
+
## ONION_CLIENT_AUTH_REMOVE
The syntax is:
@@ -1799,6 +1831,7 @@ On success "250 OK" is returned. Otherwise, the following error codes exist:
```
<a id="control-spec.txt-3.32"></a>
+
## ONION_CLIENT_AUTH_VIEW
The syntax is:
@@ -1839,6 +1872,7 @@ On success "250 OK" is returned. Otherwise, the following error codes exist:
[ONION_CLIENT_AUTH_VIEW was added in Tor 0.4.3.1-alpha]
<a id="control-spec.txt-3.33"></a>
+
## DROPOWNERSHIP
The syntax is:
@@ -1859,6 +1893,7 @@ ownership.
[DROPOWNERSHIP was added in Tor 0.4.0.0-alpha]
<a id="control-spec.txt-3.34"></a>
+
## DROPTIMEOUTS
```text
@@ -1873,4 +1908,3 @@ Tor replies with "250 OK" on success. Tor also emits the BUILDTIMEOUT_SET
RESET event right after this "250 OK".
[DROPTIMEOUTS was added in Tor 0.4.5.0-alpha.]
-
diff --git a/spec/control-spec/implementation-notes.md b/spec/control-spec/implementation-notes.md
index 8340a94..b93f5d6 100644
--- a/spec/control-spec/implementation-notes.md
+++ b/spec/control-spec/implementation-notes.md
@@ -1,7 +1,9 @@
<a id="control-spec.txt-5"></a>
+
# Implementation notes
<a id="control-spec.txt-5.1"></a>
+
## Authentication
If the control port is open and no authentication operation is enabled, Tor
@@ -50,6 +52,7 @@ This is then encoded in hexadecimal, prefixed by the indicator sequence
```
You can generate the salt of a password by calling
+
```
'tor --hash-password <password>'
```
@@ -60,7 +63,8 @@ secret that was used to generate the password, either as a quoted string
or encoded in hexadecimal.
<a id="control-spec.txt-5.2"></a>
-## Don't let the buffer get too big.
+
+## Don't let the buffer get too big
With old versions of Tor (before 0.2.0.16-alpha), if you ask for
lots of events, and 16MB of them queue up on the buffer, the Tor
@@ -71,7 +75,8 @@ if you leave huge numbers of events unread, Tor may still run out
of memory, so you should still be careful about buffer size.
<a id="control-spec.txt-5.3"></a>
-## Backward compatibility with v0 control protocol.
+
+## Backward compatibility with v0 control protocol
The 'version 0' control protocol was replaced in Tor 0.1.1.x. Support
was removed in Tor 0.2.0.x. Every non-obsolete version of Tor now
@@ -84,6 +89,7 @@ Tor used to check whether the third octet of the first command is zero.
This compatibility was removed in Tor 0.1.2.16 and 0.2.0.4-alpha.
<a id="control-spec.txt-5.4"></a>
+
## Tor config options for use by controllers
Tor provides a few special configuration options for use by controllers.
@@ -181,7 +187,8 @@ __AllDirActionsPrivate
```
<a id="control-spec.txt-5.5"></a>
-## Phases from the Bootstrap status event.
+
+## Phases from the Bootstrap status event
```text
[For the bootstrap phases reported by Tor prior to 0.4.0.x, see
@@ -201,7 +208,8 @@ Future Tors MAY revisit earlier phases, for example, if the network
fails.
<a id="control-spec.txt-5.5.1"></a>
-### Overview of Bootstrap reporting.
+
+### Overview of Bootstrap reporting
Bootstrap phases can be viewed as belonging to one of three stages:
@@ -235,7 +243,8 @@ connections to relays or bridges that it did not connect to in Stage
1.
<a id="control-spec.txt-5.5.2"></a>
-### Phases in Bootstrap Stage 1.
+
+### Phases in Bootstrap Stage 1
Phase 0:
tag=starting summary="Starting"
@@ -311,7 +320,8 @@ established.
```
<a id="control-spec.txt-5.5.3"></a>
-### Phases in Bootstrap Stage 2.
+
+### Phases in Bootstrap Stage 2
```text
Phase 20:
@@ -397,7 +407,8 @@ indicate partial steps.
```
<a id="control-spec.txt-5.5.4"></a>
-### Phases in Bootstrap Stage 3.
+
+### Phases in Bootstrap Stage 3
```text
Phase 76:
@@ -509,6 +520,7 @@ application connections now.
```
<a id="control-spec.txt-5.6"></a>
+
## Bootstrap phases reported by older versions of Tor
These phases were reported by Tor older than 0.4.0.x. For newer
@@ -707,4 +719,3 @@ application requesting an internal circuit to hidden services at ".onion"
addresses.
If a future consensus contains Exits, exit circuits may become available.]
-
diff --git a/spec/control-spec/message-format.md b/spec/control-spec/message-format.md
index 182f8cc..2e3115b 100644
--- a/spec/control-spec/message-format.md
+++ b/spec/control-spec/message-format.md
@@ -1,7 +1,9 @@
<a id="control-spec.txt-2"></a>
+
# Message format
<a id="control-spec.txt-2.1"></a>
+
## Description format
The message formats listed below use ABNF as described in RFC 2234.
@@ -23,6 +25,7 @@ accept LF. Tor, however, MUST NOT generate LF instead of CRLF.
Controllers SHOULD always send CRLF.
<a id="control-spec.txt-2.1.1"></a>
+
### Notes on an escaping bug
CString = DQUOTE *qcontent DQUOTE
@@ -60,6 +63,7 @@ Tor controller; Tor should parse input QuotedStrings from the
controller correctly.
<a id="control-spec.txt-2.2"></a>
+
## Commands from controller to Tor
```text
@@ -76,6 +80,7 @@ multi-line commands that it does not recognize.) Specific commands and
their arguments are described below in section 3.
<a id="control-spec.txt-2.3"></a>
+
## Replies from Tor to the controller
```text
@@ -103,6 +108,7 @@ versions of Tor should be prepared to get multi-line AsyncReplies with
the final line (usually "650 OK") omitted.]
<a id="control-spec.txt-2.4"></a>
+
## General-use tokens
; CRLF means, "the ASCII Carriage Return character (decimal value 13)
@@ -177,4 +183,3 @@ ISOTime2Frac = IsoTime2 [ "." 1*DIGIT ]
; Numbers
LeadingDigit = "1" - "9"
UInt = LeadingDigit *Digit
-
diff --git a/spec/control-spec/protocol-outline.md b/spec/control-spec/protocol-outline.md
index b0dd9a9..feeef1b 100644
--- a/spec/control-spec/protocol-outline.md
+++ b/spec/control-spec/protocol-outline.md
@@ -1,4 +1,5 @@
<a id="control-spec.txt-1"></a>
+
# Protocol outline
TC is a bidirectional message-based protocol. It assumes an underlying
@@ -20,6 +21,7 @@ messages to the client indefinitely far into the future. Such
Servers respond to messages in the order messages are received.
<a id="control-spec.txt-1.1"></a>
+
## Forward-compatibility
This is an evolving protocol; new client and server behavior will be
@@ -67,4 +69,3 @@ elements in these places. There are two ways that we do this:
must tolerate unexpected values. The only exception would be if there
were an explicit statement that no future values will ever be added.)
```
-
diff --git a/spec/control-spec/replies.md b/spec/control-spec/replies.md
index 5fb71e7..c55635c 100644
--- a/spec/control-spec/replies.md
+++ b/spec/control-spec/replies.md
@@ -1,4 +1,5 @@
<a id="control-spec.txt-4"></a>
+
# Replies
Reply codes follow the same 3-character format as used by SMTP, with the
@@ -74,6 +75,7 @@ Unless specified to have specific contents, the human-readable messages
in error replies should not be relied upon to match those in this document.
<a id="control-spec.txt-4.1"></a>
+
## Asynchronous events
These replies can be sent after a corresponding SETEVENTS command has been
@@ -138,6 +140,7 @@ controllers have been fixed. At some point this "SHOULD NOT" might
become a "MUST NOT".
<a id="control-spec.txt-4.1.1"></a>
+
### Circuit status changed
The syntax is:
@@ -297,6 +300,7 @@ The syntax is:
```
<a id="control-spec.txt-4.1.2"></a>
+
### Stream status changed
The syntax is:
@@ -452,6 +456,7 @@ to talk to itself.
```
<a id="control-spec.txt-4.1.3"></a>
+
### OR Connection status changed
The syntax is:
@@ -524,6 +529,7 @@ events.
```
<a id="control-spec.txt-4.1.4"></a>
+
### Bandwidth used in the last second
The syntax is:
@@ -541,6 +547,7 @@ we may also include a breakdown of the connection types that used
bandwidth this second (not implemented yet).]
<a id="control-spec.txt-4.1.5"></a>
+
### Log messages
The syntax is:
@@ -562,6 +569,7 @@ Control port message trace debug logs are never sent as control port log
events, to avoid modifying control output when debugging.
<a id="control-spec.txt-4.1.6"></a>
+
### New descriptors available
This event is generated when new router descriptors (not microdescs or
@@ -578,6 +586,7 @@ Syntax:
```
<a id="control-spec.txt-4.1.7"></a>
+
### New Address mapping
These events are generated when a new address mapping is entered in
@@ -620,6 +629,7 @@ StreamId is the global stream identifier of the stream or circuit from which
the address was resolved.
<a id="control-spec.txt-4.1.8"></a>
+
### Descriptors uploaded to us in our role as authoritative dirserver
[NOTE: This feature was removed in Tor 0.3.2.1-alpha.]
@@ -645,6 +655,7 @@ complaining. The Message field is a human-readable string
explaining why we chose the Action. (It doesn't contain newlines.)
<a id="control-spec.txt-4.1.9"></a>
+
### Our descriptor changed
Syntax:
@@ -654,6 +665,7 @@ Syntax:
[First added in 0.1.2.2-alpha.]
<a id="control-spec.txt-4.1.10"></a>
+
### Status events
Status events (STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER) are sent
@@ -1098,6 +1110,7 @@ Actions for STATUS_GENERAL events can be as follows:
```
<a id="control-spec.txt-4.1.11"></a>
+
### Our set of guard nodes has changed
Syntax:
@@ -1133,6 +1146,7 @@ The Status values are:
```
<a id="control-spec.txt-4.1.12"></a>
+
### Network status has changed
Syntax:
@@ -1148,6 +1162,7 @@ down in our local status, for example based on connection attempts.
[First added in 0.1.2.3-alpha]
<a id="control-spec.txt-4.1.13"></a>
+
### Bandwidth used on an application stream
The syntax is:
@@ -1176,6 +1191,7 @@ apply only to streams entering Tor (such as on a SOCKSPort, TransPort,
or so on). They are not generated for exiting streams.
<a id="control-spec.txt-4.1.14"></a>
+
### Per-country client stats
The syntax is:
@@ -1212,6 +1228,7 @@ algorithm is specified in the description of "geoip-client-origins"
in dir-spec.txt.
<a id="control-spec.txt-4.1.15"></a>
+
### New consensus networkstatus has arrived
The syntax is:
@@ -1229,6 +1246,7 @@ relay *not* mentioned in this list is implicitly no longer recommended.
[First added in 0.2.1.13-alpha]
<a id="control-spec.txt-4.1.16"></a>
+
### New circuit buildtime has been set
The syntax is:
@@ -1270,6 +1288,7 @@ this value to the nearest second before using it.
[First added in 0.2.2.7-alpha]
<a id="control-spec.txt-4.1.17"></a>
+
### Signal received
The syntax is:
@@ -1293,6 +1312,7 @@ generate any event.
[First added in 0.2.3.1-alpha]
<a id="control-spec.txt-4.1.18"></a>
+
### Configuration changed
The syntax is:
@@ -1310,6 +1330,7 @@ signal). KEYWORD and VALUE specify the configuration option that was changed.
Undefined configuration options contain only the KEYWORD.
<a id="control-spec.txt-4.1.19"></a>
+
### Circuit status changed slightly
The syntax is:
@@ -1338,6 +1359,7 @@ Other fields are as specified in section 4.1.1 above.
[First added in 0.2.3.11-alpha]
<a id="control-spec.txt-4.1.20"></a>
+
### Pluggable transport launched
The syntax is:
@@ -1355,6 +1377,7 @@ The syntax is:
```
<a id="control-spec.txt-4.1.21"></a>
+
### Bandwidth used on an OR or DIR or EXIT connection
The syntax is:
@@ -1387,6 +1410,7 @@ These events are only generated if TestingTorNetwork is set.
[First added in 0.2.5.2-alpha]
<a id="control-spec.txt-4.1.22"></a>
+
### Bandwidth used by all streams attached to a circuit
The syntax is:
@@ -1461,6 +1485,7 @@ were added in Tor 0.3.4.0-alpha]
[SS, CWND, RTT, and MIN_RTT were added in Tor 0.4.7.5-alpha]
<a id="control-spec.txt-4.1.23"></a>
+
### Per-circuit cell stats
The syntax is:
@@ -1532,6 +1557,7 @@ cell. These events are only generated if TestingTorNetwork is set.
[First added in 0.2.5.2-alpha]
<a id="control-spec.txt-4.1.24"></a>
+
### Token buckets refilled
The syntax is:
@@ -1580,6 +1606,7 @@ These events are only generated if TestingTorNetwork is set.
[First added in 0.2.5.2-alpha]
<a id="control-spec.txt-4.1.25"></a>
+
### HiddenService descriptors
The syntax is:
@@ -1653,6 +1680,7 @@ The syntax is:
```
<a id="control-spec.txt-4.1.26"></a>
+
### HiddenService descriptors content
The syntax is:
@@ -1690,6 +1718,7 @@ this event will reply either the descriptor's content or an empty one.
[HS v3 support added 0.3.3.1-alpha]
<a id="control-spec.txt-4.1.27"></a>
+
### Network liveness has changed
Syntax:
@@ -1705,6 +1734,7 @@ Syntax:
```
<a id="control-spec.txt-4.1.28"></a>
+
### Pluggable Transport Logs
Syntax:
@@ -1733,6 +1763,7 @@ Syntax:
```
<a id="control-spec.txt-4.1.29"></a>
+
### Pluggable Transport Status
Syntax:
@@ -1761,4 +1792,3 @@ Syntax:
[PT_STATUS was added in Tor 0.4.0.1-alpha]
```
-
diff --git a/spec/control-spec/scope.md b/spec/control-spec/scope.md
index 8684e3e..9d5b3d3 100644
--- a/spec/control-spec/scope.md
+++ b/spec/control-spec/scope.md
@@ -1,4 +1,5 @@
<a id="control-spec.txt-0"></a>
+
# Scope
This document describes an implementation-specific protocol that is used
@@ -19,4 +20,3 @@ versions in the 0.1.1.x series and later.)
"OPTIONAL" in this document are to be interpreted as described in
RFC 2119.
```
-