Skip to content

Latency Testing

v2rayroot edited this page Jun 14, 2026 · 1 revision

Latency Testing

TestLatency

char *TestLatency(char *configsJSON, char *testURL, int timeout);

configsJSON accepts a JSON array of configuration strings or one raw configuration/share URI.

[
  "vless://...",
  "trojan://..."
]

When testURL is empty, the default is:

https://www.gstatic.com/generate_204

timeout is measured in seconds.

Result

Results preserve input order:

["143","287","[ERROR]failed to load config: ..."]

Numeric strings are milliseconds. Treat ERROR, -1, and values beginning with [ERROR] as failures.

Runtime Behavior

Each configuration runs through a temporary local HTTP/SOCKS proxy. Tests run concurrently and may consume substantial sockets, memory, and CPU.

Limit user-facing batch sizes and execute this call away from the UI thread.

Clone this wiki locally