@torrent-tv/proxy 2.96.0 → 2.96.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -617,9 +617,6 @@ try {
617
617
  onSignal(sessionId, signal) {
618
618
  webRtcManager?.handleSignal(sessionId, signal);
619
619
  },
620
- // Asked by a server that still polls; the same description the proxy
621
- // sends on its own when it changes.
622
- onHealthRequest: () => describeSelf(),
623
620
  // Whether this host could sustain a file it has only been told about. The
624
621
  // same arithmetic the first offer uses, against this host's own startup
625
622
  // benchmarks — no torrent, no bytes, no ffmpeg — so the browser can ask
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.96.0",
3
+ "version": "2.96.1",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -20,7 +20,6 @@
20
20
 
21
21
  import { WebSocket } from "ws";
22
22
 
23
- /** @import { HealthMetrics } from './health-collector.js' */
24
23
 
25
24
  /**
26
25
  * Configuration for the tunnel client.
@@ -52,9 +51,6 @@ import { WebSocket } from "ws";
52
51
  * Answered from this host's startup benchmarks alone: no torrent is added, no
53
52
  * bytes are fetched and ffmpeg is not run, so it costs milliseconds and can
54
53
  * be asked of every proxy in the pool at once.
55
- * @property {() => HealthMetrics} [onHealthRequest]
56
- * Called when the server sends a `health-request` message. The return value is
57
- * sent back as `health-response` and used by the server to score this proxy.
58
54
  * @property {(message: string) => void} [onLog]
59
55
  * Optional structured log sink.
60
56
  */
@@ -136,7 +132,6 @@ export function createTunnelClient({
136
132
  baseUrl = "",
137
133
  onSignal,
138
134
  onConnect,
139
- onHealthRequest,
140
135
  onCanServeRequest,
141
136
  onLog,
142
137
  connectionLifetimeMs = CONNECTION_LIFETIME_MS
@@ -278,6 +273,14 @@ export function createTunnelClient({
278
273
  return;
279
274
  }
280
275
 
276
+ // The server's answer to this proxy's keepalive, echoed at once on the
277
+ // same connection: the server measures the tunnel round trip from it on
278
+ // its own clock, and chooses proxies partly by that.
279
+ if (message.type === "rtt-probe") {
280
+ send({ type: "rtt-echo", sentAt: message.sentAt }, connection);
281
+ return;
282
+ }
283
+
281
284
  // Could this host serve a file it is only told ABOUT? Asked when the
282
285
  // proxy a viewer landed on has refused the file, so the browser can be
283
286
  // sent somewhere that will work instead of being shown an error. The
@@ -297,29 +300,6 @@ export function createTunnelClient({
297
300
  send({ type: "can-serve-response", requestId: message.requestId, offer }, connection);
298
301
  return;
299
302
  }
300
-
301
- // Health check: server requests current metrics for proxy scoring.
302
- if (message.type === "health-request") {
303
- // Awaited: the answer now carries which films this proxy holds, and the
304
- // truthful list of those lives on the torrent thread.
305
- void (async () => {
306
- let answer = {};
307
- try {
308
- answer = typeof onHealthRequest === "function" ? await onHealthRequest() : {};
309
- } catch {
310
- // silent-ok: a proxy that cannot describe itself is scored on
311
- // nothing rather than not answered at all, which would drop it out
312
- // of every selection until the next poll.
313
- }
314
- send({
315
- type: "health-response",
316
- requestId: message.requestId,
317
- metrics: answer?.metrics ?? answer ?? {},
318
- holds: Array.isArray(answer?.holds) ? answer.holds : []
319
- }, connection);
320
- })();
321
- return;
322
- }
323
303
  });
324
304
 
325
305
  connection.addEventListener("close", (event) => {