Skip to main content

Module delay

Module delay 

Source
Expand description

The typed wire semantics of the sing-box Clash API delay endpoint.

sing-box answers GET /proxies/{name}/delay?url={url}&timeout={ms} with one of its own typed answers. This module owns that classification, so the outbound adapter never reads a status code or a message on its own and never turns an answer the engine did not produce into a measurement.

The answers of sing-box 1.13 and 1.14 are:

StatusBodyMeaning
200{"delay": N}the engine measured a round trip through the outbound
400{"message": "Body invalid"}the engine refused the request
401 / 403{"message": ...}the controller refused the secret
404{"message": "Resource not found"}the engine does not know the outbound
503{"message": "An error occurred in the delay test"}the delay test failed
504{"message": "Timeout"}the engine’s own delay test exceeded its deadline

The endpoint parses the timeout as a signed 16-bit millisecond count and measures HTTPS targets only: a plain-HTTP target is replaced by the engine’s own URL test target. The driver therefore sends the requested target unchanged and reports the measurement the engine publishes, and it refuses a timeout the endpoint cannot carry before the request is sent.

Enums§

DelayAnswer
The typed answer of the sing-box delay endpoint.

Constants§

MAX_SINGBOX_DELAY_TIMEOUT_MS
The largest delay timeout the sing-box delay endpoint accepts, in milliseconds.

Functions§

classify
Classifies the engine’s answer to one delay request.
refusal_code
The neutral failure code one refused delay answer maps to.