@dmarket/p2p-tracker-headless 1.4.1-SNAPSHOT-development.271 → 1.5.0-beta
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/dmarket-p2p-tracker-core-domain.mjs +5816 -5250
- package/dmarket-p2p-tracker-core-domain.mjs.map +1 -1
- package/index.d.ts +91 -5
- package/kotlin-kotlin-stdlib.mjs +1537 -1825
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlinx-atomicfu.mjs +13 -13
- package/kotlinx-coroutines-core.mjs +2307 -2307
- package/kotlinx-coroutines-core.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-bytestring.mjs +32 -32
- package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-core.mjs +451 -451
- package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +1895 -1895
- package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1580 -1580
- package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/ktor-ktor-client-core.mjs +1962 -1962
- package/ktor-ktor-events.mjs +6 -6
- package/ktor-ktor-http-cio.mjs +320 -320
- package/ktor-ktor-http.mjs +794 -1742
- package/ktor-ktor-http.mjs.map +1 -1
- package/ktor-ktor-io.mjs +628 -628
- package/ktor-ktor-utils.mjs +722 -725
- package/ktor-ktor-websockets.mjs +391 -391
- package/p2p-tracker-core.mjs +11831 -11061
- package/p2p-tracker-core.mjs.map +1 -1
- package/p2p-tracker-headless.mjs +2282 -1226
- package/p2p-tracker-headless.mjs.map +1 -1
- package/package.json +2 -1
package/index.d.ts
CHANGED
|
@@ -61,6 +61,20 @@ export interface HeadlessTrackerOptions {
|
|
|
61
61
|
onProverLine?: (stream: ProverLineStream, line: string) => void;
|
|
62
62
|
/** The clock, in epoch milliseconds; the system clock by default. */
|
|
63
63
|
nowMs?: () => number;
|
|
64
|
+
/**
|
|
65
|
+
* `true` to fail closed without a Steam proxy from the start: for a host that knows this account uses one, as
|
|
66
|
+
* after a restart (the proxy is held in memory only; the host remembers the fact and sets this). No token is held
|
|
67
|
+
* without a proxy: a push that would leave none held (none named and none held, or `proxy: null`) rejects with an
|
|
68
|
+
* `Error` coded `steamProxyRequiredCode()` and changes nothing. With no token held the tracker sends no heartbeat
|
|
69
|
+
* and makes no Steam call and no proof, so nothing reaches Steam, directly or otherwise. (The Steam transport and the
|
|
70
|
+
* prover refuse to go direct as well, a backstop a host does not see in practice.) The host hears `SteamProxyMissing`
|
|
71
|
+
* (ended by `SteamProxyRecovered`), and the state says `steamProxy: "none"`, `steamProxyRequired: true` meanwhile.
|
|
72
|
+
* Needs `prover.mode` `mpc`.
|
|
73
|
+
*
|
|
74
|
+
* `false` by default: the proxy is optional, but the tracker pins itself to one the first time it holds one
|
|
75
|
+
* (`proxy: null` then rejects coded `steamProxyLockedCode()`), for as long as it runs.
|
|
76
|
+
*/
|
|
77
|
+
requireSteamProxy?: boolean;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
/** What became of a pushed key compared with the one held before it. */
|
|
@@ -100,10 +114,41 @@ export interface TrackerState {
|
|
|
100
114
|
readonly updateDueTimeMs: number | null;
|
|
101
115
|
/** Each tracked deal's deadline, by deal id. */
|
|
102
116
|
readonly dealDeadlines: Readonly<Record<string, number>>;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the last attempt through the Steam proxy pushed with the token failed. While it is, nothing reaches
|
|
119
|
+
* Steam — nothing falls back to a direct connection — and no create or cancel is sent or reported failed. Cleared
|
|
120
|
+
* when a connection gets through it, or another proxy (or none) is pushed. The proxy itself is never readable back.
|
|
121
|
+
*/
|
|
122
|
+
readonly steamProxyUnreachable: boolean;
|
|
123
|
+
/** Since when, while `steamProxyUnreachable`. */
|
|
124
|
+
readonly steamProxyUnreachableSinceMs: number | null;
|
|
125
|
+
/** Whether a Steam proxy is held with the token: `set` or `none`, never which one. */
|
|
126
|
+
readonly steamProxy: "set" | "none";
|
|
127
|
+
/**
|
|
128
|
+
* Whether no Steam traffic may go direct: `requireSteamProxy`, or a proxy held once (the tracker is pinned). With
|
|
129
|
+
* `steamProxy: "none"` nothing reaches Steam until a token is pushed with a proxy.
|
|
130
|
+
*/
|
|
131
|
+
readonly steamProxyRequired: boolean;
|
|
103
132
|
}
|
|
104
133
|
|
|
105
|
-
/**
|
|
106
|
-
export
|
|
134
|
+
/** The options of a Steam token push. */
|
|
135
|
+
export interface SteamTokenPushOptions {
|
|
136
|
+
/**
|
|
137
|
+
* The HTTP proxy this Steam account's traffic goes through, `http://user:pass@host:port` (HTTP CONNECT; no
|
|
138
|
+
* SOCKS), held with the token. Absent (or `undefined`): a renewal, the proxy held before stays — a push that names
|
|
139
|
+
* none never moves the account back to this host's address. A URL: that proxy from now on, replacing the one held.
|
|
140
|
+
* `null`: no proxy from now on, Steam reached directly — only while none has ever been held (else rejected coded
|
|
141
|
+
* `steamProxyLockedCode()`) and without `requireSteamProxy` (else `steamProxyRequiredCode()`). A token that is not
|
|
142
|
+
* held changes neither. Write-only.
|
|
143
|
+
*/
|
|
144
|
+
proxy?: string | null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Why a prover process ended before its proof did. `proxy_pinned`: cut because the account's first Steam proxy was
|
|
149
|
+
* pushed mid-proof; the proof runs again through it.
|
|
150
|
+
*/
|
|
151
|
+
export type KillCause = "out_of_memory" | "connect_deadline" | "session_deadline" | "exited" | "proxy_pinned";
|
|
107
152
|
|
|
108
153
|
/** Why a proof produced nothing. Every text in it, `summary` included, is redacted. */
|
|
109
154
|
export type ProofFailure =
|
|
@@ -112,6 +157,7 @@ export type ProofFailure =
|
|
|
112
157
|
| { readonly type: "notary_unreachable"; readonly detail: string; readonly summary: string }
|
|
113
158
|
| { readonly type: "version_mismatch"; readonly detail: string; readonly summary: string }
|
|
114
159
|
| { readonly type: "steam_failed"; readonly status: number | null; readonly detail: string; readonly summary: string }
|
|
160
|
+
| { readonly type: "proxy_unreachable"; readonly detail: string; readonly summary: string }
|
|
115
161
|
| { readonly type: "limits_exceeded"; readonly detail: string; readonly summary: string }
|
|
116
162
|
| { readonly type: "prover_killed"; readonly cause: KillCause; readonly detail: string | null; readonly summary: string }
|
|
117
163
|
| { readonly type: "not_started"; readonly reason: string; readonly summary: string }
|
|
@@ -136,7 +182,10 @@ export declare function start(handle: TrackerHandle): void;
|
|
|
136
182
|
/** Runs one cycle now, behind the cycle in flight. */
|
|
137
183
|
export declare function cycle(handle: TrackerHandle): Promise<void>;
|
|
138
184
|
|
|
139
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Stops the tracker; kills every prover process and every tunnel through its Steam proxy at once. Every later call with
|
|
187
|
+
* the handle is refused.
|
|
188
|
+
*/
|
|
140
189
|
export declare function stop(handle: TrackerHandle): Promise<void>;
|
|
141
190
|
|
|
142
191
|
/** Pushes the DMarket Trading API key pair (hex). */
|
|
@@ -146,8 +195,25 @@ export declare function pushTradingApiKey(
|
|
|
146
195
|
secretKey: string,
|
|
147
196
|
): Promise<TradingApiKeyPushResult>;
|
|
148
197
|
|
|
149
|
-
/**
|
|
150
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Pushes a Steam access token, and what becomes of the proxy its Steam traffic goes through (`options.proxy`: kept
|
|
200
|
+
* when absent, replaced by a URL, dropped by `null`). Every Steam call and
|
|
201
|
+
* every proof's Steam leg then tunnels through that proxy and fails rather than go direct: a failure is reported as
|
|
202
|
+
* the `SteamProxyUnreachable` event (`SteamProxyRecovered` ends it), `steamProxyUnreachable` in the state, a create
|
|
203
|
+
* or a cancel deferred (`SteamWriteDeferred`) with `reasons().steamProxyUnreachable` — never sent, read or reported
|
|
204
|
+
* failed — and a proof's `proxy_unreachable`. Rejects a `proxy` that is neither `null` nor an `http://` URL with a host
|
|
205
|
+
* and a port with an `Error` whose `code` is `steamProxyInvalidCode()`, naming the rule and never the value; resolves
|
|
206
|
+
* `invalid` where the host cannot route Steam through a proxy.
|
|
207
|
+
*
|
|
208
|
+
* The proxy is optional, but sticky once set: from the first push held with one, `proxy: null` rejects with an `Error`
|
|
209
|
+
* coded `steamProxyLockedCode()`; with `requireSteamProxy`, a push that would leave none held rejects coded
|
|
210
|
+
* `steamProxyRequiredCode()`. Either way nothing changed, and the caller asked for something refused (a 400).
|
|
211
|
+
*/
|
|
212
|
+
export declare function pushSteamToken(
|
|
213
|
+
handle: TrackerHandle,
|
|
214
|
+
accessToken: string,
|
|
215
|
+
options?: SteamTokenPushOptions,
|
|
216
|
+
): Promise<SteamTokenPushResult>;
|
|
151
217
|
|
|
152
218
|
/** What the tracker holds right now. */
|
|
153
219
|
export declare function trackerState(handle: TrackerHandle): TrackerState;
|
|
@@ -159,6 +225,8 @@ export declare function reasons(): Readonly<{
|
|
|
159
225
|
tokenExpiringDefer: "the Steam token expires before a create could be confirmed";
|
|
160
226
|
proofTokenExpiring: "the Steam token is too close to its expiry to start a proof";
|
|
161
227
|
noProver: "no notary prover is configured on this host";
|
|
228
|
+
steamProxyUnreachable: "not sent: the Steam proxy could not be reached";
|
|
229
|
+
steamProxyMissing: "no Steam proxy is held, and this tracker requires one";
|
|
162
230
|
}>;
|
|
163
231
|
|
|
164
232
|
/** The `kind` of a failed-cancel check, by name. The same frozen object each call. */
|
|
@@ -180,6 +248,24 @@ export declare function directiveActions(): Readonly<{
|
|
|
180
248
|
/** The gateway's error code for a heartbeat refused because the DMarket account links no Steam account. */
|
|
181
249
|
export declare function steamNotLinkedCode(): "P2P_STEAM_NOT_LINKED";
|
|
182
250
|
|
|
251
|
+
/**
|
|
252
|
+
* The `code` of the `Error` `pushSteamToken` rejects with when `options.proxy` is neither `null` nor an `http://` URL
|
|
253
|
+
* with a host and a port. Its message names the rule broken, never the value. No other rejection carries it.
|
|
254
|
+
*/
|
|
255
|
+
export declare function steamProxyInvalidCode(): "STEAM_PROXY_INVALID";
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The `code` of the `Error` `pushSteamToken` rejects with for `proxy: null` once a proxy has been held: the tracker is
|
|
259
|
+
* pinned to a proxy; another may replace it, none may not. Nothing changed.
|
|
260
|
+
*/
|
|
261
|
+
export declare function steamProxyLockedCode(): "STEAM_PROXY_LOCKED";
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The `code` of the `Error` `pushSteamToken` rejects with, on a tracker made with `requireSteamProxy`, for a push that
|
|
265
|
+
* would leave no proxy held: none named with none held, or `proxy: null`. Nothing changed.
|
|
266
|
+
*/
|
|
267
|
+
export declare function steamProxyRequiredCode(): "STEAM_PROXY_REQUIRED";
|
|
268
|
+
|
|
183
269
|
/** Under this much token life no create or proof starts. */
|
|
184
270
|
export declare function minWriteTokenLifetimeMs(): number;
|
|
185
271
|
|