You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/protocol/errors.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,26 @@ For `incompatible-protocol-version` errors, additional fields are included:
28
28
}
29
29
```
30
30
31
+
A separate transport-control frame `connection_notice` carries advisory
32
+
close reasons that the responder wants the initiator to learn before the
33
+
socket goes away. It mirrors the error frame shape but adds `status` and
34
+
`details`:
35
+
36
+
```json
37
+
{
38
+
"type": "connection_notice",
39
+
"code": "observed-address-mismatch",
40
+
"status": "closing",
41
+
"error": "advertised address does not match observed remote address",
42
+
"details": { "observed_address": "203.0.113.50" }
43
+
}
44
+
```
45
+
46
+
The initiator should treat `connection_notice` as informational: record
47
+
the `details`, then expect the socket to close. Status codes surfaced
48
+
through `connection_notice` are listed under "Connection Notice Codes"
49
+
below.
50
+
31
51
## Error Code Reference
32
52
33
53
| Code | When Returned | HTTP Analogy | Details |
@@ -124,6 +144,17 @@ These errors indicate internal server issues:
124
144
-`encode-failed` - Response serialization failed
125
145
-`read` - Network I/O error
126
146
147
+
### Connection Notice Codes
148
+
149
+
Delivered through the `connection_notice` frame type rather than
150
+
`type="error"`. They are advisory — the responder is going to close the
151
+
connection and wants the initiator to learn a machine-readable reason
152
+
first.
153
+
154
+
| Code | When Sent | Details |
155
+
|------|-----------|---------|
156
+
|`observed-address-mismatch`| Inbound `hello` advertised a world-reachable IP that does not match the observed TCP source |`details.observed_address` holds the IP the responder sees for the initiator. Initiator records it as the trusted self-advertise IP so the next outbound hello self-corrects |
157
+
127
158
## Error Handling Guide
128
159
129
160
### Client Responsibilities
@@ -266,6 +297,26 @@ graph TB
266
297
}
267
298
```
268
299
300
+
Отдельный transport-control фрейм `connection_notice` передаёт
301
+
рекомендательные причины закрытия соединения, о которых ответчик хочет
302
+
сообщить инициатору до разрыва сокета. По форме совпадает с error, но
303
+
добавляет поля `status` и `details`:
304
+
305
+
```json
306
+
{
307
+
"type": "connection_notice",
308
+
"code": "observed-address-mismatch",
309
+
"status": "closing",
310
+
"error": "advertised address does not match observed remote address",
311
+
"details": { "observed_address": "203.0.113.50" }
312
+
}
313
+
```
314
+
315
+
Инициатор должен рассматривать `connection_notice` как информационный:
316
+
записать `details`, затем ожидать закрытия сокета. Коды статусов,
317
+
передаваемые через `connection_notice`, перечислены ниже в секции
318
+
«Коды connection_notice».
319
+
269
320
## Справочник кодов ошибок
270
321
271
322
| Код | Когда возвращается | Аналогия HTTP | Детали |
@@ -362,6 +413,17 @@ graph TB
362
413
-`encode-failed` - Сериализация ответа не удалась
363
414
-`read` - Ошибка ввода-вывода сети
364
415
416
+
### Коды connection_notice
417
+
418
+
Передаются через фрейм `connection_notice`, а не через `type="error"`.
419
+
Носят рекомендательный характер — ответчик собирается закрыть
420
+
соединение и хочет, чтобы инициатор узнал машинно-читаемую причину
421
+
заранее.
422
+
423
+
| Код | Когда отправляется | Детали |
424
+
|-----|---------------------|--------|
425
+
|`observed-address-mismatch`| Входящий `hello` объявил world-reachable IP, который не совпадает с наблюдаемым TCP-источником |`details.observed_address` содержит IP, который ответчик видит у инициатора. Инициатор сохраняет его как trusted-self-advertise-IP, чтобы следующий исходящий hello сам скорректировался |
0 commit comments