- Timestamp:
- 12/29/09 21:00:57 (2 years ago)
- Branches:
- master
- Children:
- aa818c
- Parents:
- 1a26a9
- git-author:
- J. A. Bezemer <J.A.Bezemer@…> (12/29/09 21:00:57)
- git-committer:
- Erik Ekman <erik@…> (02/04/12 20:34:04)
- File:
-
- 1 moved
-
doc/proto_00000502.txt (moved) (moved from doc/proto_00000501.txt) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/proto_00000502.txt
r05e99c rb17790 1 Detailed specification of protocol in version 0000050 11 Detailed specification of protocol in version 00000502 2 2 ====================================================== 3 3 … … 7 7 1. DNS protocol 8 8 ====================================================== 9 10 Quick alphabetical index / register: 11 0-9 Data packet 12 A-F Data packet 13 I IP address 14 L Login 15 N Downstream fragsize (NS.topdomain A-type reply) 16 O Options 17 P Ping 18 R Downstream fragsize probe 19 S Switch upstream codec 20 V Version 21 W (WWW.topdomain A-type reply) 22 Y Downstream codec check 23 Z Upstream codec check 24 9 25 10 26 CMC = 2 byte Cache Miss Counter, increased every time it is used … … 39 55 First byte i or I 40 56 5 bits coded as Base32 char, meaning userid 41 CMC 57 CMC as 3 Base32 chars 42 58 Server replies 43 59 BADIP if bad userid, or 44 60 I and then 4 bytes network order external IP address of iodined server 45 61 46 Case check:62 Upstream codec check / bounce: 47 63 Client sends: 48 64 First byte z or Z 49 65 Lots of data that should not be decoded 50 66 Server replies: 51 The requested domain copied raw 67 The requested domain copied raw, in the lowest-grade downstream codec 68 available for the request type. 69 70 Downstream codec check: 71 Client sends: 72 First byte y or Y 73 1 char, meaning downstream codec to use 74 5 bits coded as Base32 char, meaning check variant 75 CMC as 3 Base32 chars 76 Possibly extra data, depending on check variant 77 Server sends: 78 Data encoded with requested downstream codec; data content depending 79 on check variant number. 80 BADCODEC if requested downstream codec not available. 81 BADLEN if check variant is not available, or problem with extra data. 82 83 Downstream codec chars are same as in 'O' Option request, below. 84 85 Check variants: 86 1: Send encoded DOWNCODECCHECK1 string as defined in encoding.h 87 88 (Other variants reserved; possibly variant that sends a decoded-encoded 89 copy of Base32-encoded extra data in the request) 52 90 53 91 Switch codec: … … 55 93 First byte s or S 56 94 5 bits coded as Base32 char, meaning userid 57 5 bits coded as Base32 char, with value 5 or 6, representing number of raw 58 bits per encoded byte 59 CMC 95 5 bits coded as Base32 char, representing number of raw bits per 96 encoded byte: 97 5: Base32 (a-z0-5) 98 6: Base64 (a-zA-Z0-9+-) 99 26: Base64u (a-zA-Z0-9_-) 100 7: Base128 (a-zA-Z0-9\274-\375) 101 CMC as 3 Base32 chars 60 102 Server sends: 61 103 Name of codec if accepted. After this all upstream data packets must 62 104 be encoded with the new codec. 63 BADCODEC if not accepted. Client must then revert to Base32105 BADCODEC if not accepted. Client must then revert to previous codec 64 106 BADLEN if length of query is too short 65 107 … … 69 111 5 bits coded as Base32 char, meaning userid 70 112 1 char, meaning option 113 CMC as 3 Base32 chars 71 114 Server sends: 72 115 Full name of option if accepted. After this, option immediately takes … … 78 121 t or T: Downstream encoding Base32, for TXT/CNAME/A/MX (default) 79 122 s or S: Downstream encoding Base64, for TXT/CNAME/A/MX 123 u or U: Downstream encoding Base64u, for TXT/CNAME/A/MX 124 v or V: Downstream encoding Base128, for TXT/CNAME/A/MX 80 125 r or R: Downstream encoding Raw, for TXT/NULL (default for NULL) 81 126 If codec unsupported for request type, server will use Base32; note … … 97 142 Then follows a long random query which contents does not matter 98 143 Server sends: 99 Requested number of bytes as a response. The first two bytes contains 100 the requested length. Rest of message can be any data. 144 Requested number of bytes as a response. The first two bytes contain 145 the requested length. The third byte is 107 (0x6B). The fourth byte 146 is a random value, and each following byte is incremented with 107. 147 This is checked by the client to determine corruption. 101 148 BADFRAG if requested length not accepted. 102 149 … … 115 162 Data: 116 163 Upstream data header: 117 3210 432 10 43 210 4321 0 118 +----+---+--+--+---+----+-+ 119 |UUUU|SSS|FF|FF|DDD|GGGG|L| 120 +----+---+--+--+---+----+-+ 164 3210 432 10 43 210 4321 0 43210 165 +----+---+--+--+---+----+-+-----+ 166 |UUUU|SSS|FF|FF|DDD|GGGG|L|UDCMC| 167 +----+---+--+--+---+----+-+-----+ 121 168 122 169 Downstream data header: … … 133 180 GGGG = Downstream fragment number 134 181 C = Compression enabled for downstream packet 135 136 Upstream data packet starts with 1 byte ASCII hex coded user byte, then 3 bytes 137 Base32 encoded header, then comes the payload data, encoded with chosen codec. 182 UDCMC = Upstream Data CMC, 36 steps a-z0-9, case-insensitive 183 184 Upstream data packet starts with 1 byte ASCII hex coded user byte; then 3 bytes 185 Base32 encoded header; then 1 char data-CMC; then comes the payload data, 186 encoded with the chosen upstream codec. 138 187 139 188 Downstream data starts with 2 byte header. Then payload data, which may be … … 148 197 t or T: Base32 encoded before chop, decoded after un-chop 149 198 s or S: Base64 encoded before chop, decoded after un-chop 199 u or U: Base64u encoded before chop, decoded after un-chop 200 v or V: Base128 encoded before chop, decoded after un-chop 150 201 r or R: Raw no encoding, only DNS-chop 151 CNAME/A/MX:202 SRV/MX/CNAME/A: 152 203 h or H: Hostname encoded with Base32 153 204 i or I: Hostname encoded with Base64 205 j or J: Hostname encoded with Base64u 206 k or K: Hostname encoded with Base128 207 SRV and MX may reply with multiple hostnames, each encoded separately. Each 208 has a 10-multiple priority, and encoding/decoding is done in strictly 209 increasing priority sequence 10, 20, 30, etc. without gaps. Note that some DNS 210 relays will shuffle the answer records in the response. 154 211 155 212 Ping: … … 163 220 CMC 164 221 165 The server response to Ping and Data packets is a DNS NULL type response: 166 If server has nothing to send, data length is 0 bytes. 167 If server has something to send, it will send a downstream data packet, 168 prefixed with 2 bytes header as shown above. 222 The server response to Ping and Data packets is a DNS NULL/TXT/.. type response, 223 always starting with the 2 bytes downstream data header as shown above. 224 If server has nothing to send, no data is added after the header. 225 If server has something to send, it will add the downstream data packet 226 (or some fragment of it) after the header. 169 227 170 228
Note: See TracChangeset
for help on using the changeset viewer.
