@pairlobby/server-core 0.23.0 → 0.24.0
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/README.md +1 -1
- package/dist/admission.d.ts +13 -7
- package/dist/admission.d.ts.map +1 -1
- package/dist/admission.js +15 -13
- package/dist/admission.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/ports.d.ts +34 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +48 -0
- package/dist/ports.js.map +1 -0
- package/dist/relay.d.ts +128 -0
- package/dist/relay.d.ts.map +1 -0
- package/dist/relay.js +459 -0
- package/dist/relay.js.map +1 -0
- package/dist/router.d.ts +4 -97
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +5 -376
- package/dist/router.js.map +1 -1
- package/dist/service.d.ts +2 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +4 -0
- package/dist/service.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @pairlobby/server-core
|
|
2
2
|
|
|
3
|
-
Part of [PairLobby](https://github.com/PairLobby/app), built from `packages/server-core` at version 0.
|
|
3
|
+
Part of [PairLobby](https://github.com/PairLobby/app), built from `packages/server-core` at version 0.24.0. See that repository for documentation.
|
|
4
4
|
|
|
5
5
|
Licensed under the [Elastic License 2.0](LICENSE): you may use, copy, modify and distribute it, but may not offer it to others as a hosted or managed service.
|
package/dist/admission.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RequestContext } from './ports.js';
|
|
1
2
|
/** The header that carries a relay's create token, the same one a hosted account token travels in. */
|
|
2
3
|
export declare const CREATE_TOKEN_HEADER = "x-pairlobby-account-token";
|
|
3
4
|
export declare const CREATE_TOKEN_REQUIRED = "this relay needs its create token to start a room; set PAIRLOBBY_CREATE_TOKEN";
|
|
@@ -33,10 +34,15 @@ export type AdmissionOptions = {
|
|
|
33
34
|
/** Absent means no rate limits. */
|
|
34
35
|
limiter?: RateLimiter;
|
|
35
36
|
limits?: Partial<AdmissionLimits>;
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The header a proxy in front of the relay puts the caller's address in, such as `x-forwarded-for`.
|
|
39
|
+
* Absent means no such header is read, whoever sends it: a caller could write it themselves.
|
|
40
|
+
*/
|
|
41
|
+
trustedProxyHeader?: string;
|
|
42
|
+
/** The caller's address; defaults to the proxy header when one is trusted, else the connection's address. Undefined makes every such caller share one count. */
|
|
43
|
+
clientAddress?: (request: Request, context: RequestContext) => string | undefined;
|
|
38
44
|
/** Callers the limits do not apply to, such as this device on a relay that is not behind a proxy. */
|
|
39
|
-
exempt?: (request: Request) => boolean;
|
|
45
|
+
exempt?: (request: Request, context: RequestContext) => boolean;
|
|
40
46
|
};
|
|
41
47
|
type MemoryRateLimiterOptions = {
|
|
42
48
|
now?: () => number;
|
|
@@ -50,17 +56,17 @@ export declare function createAdmission(options: AdmissionOptions): {
|
|
|
50
56
|
/** Creating a room needs the create token here. */
|
|
51
57
|
createTokenRequired: boolean;
|
|
52
58
|
/** Refuses a room creation without the create token, then counts it against the caller. */
|
|
53
|
-
beforeCreate(request: Request): Promise<void>;
|
|
59
|
+
beforeCreate(request: Request, context?: RequestContext): Promise<void>;
|
|
54
60
|
/**
|
|
55
61
|
* The team token check behind token-mode login: counted first, in its own bucket so
|
|
56
62
|
* guessing cannot spend the create budget, then refused the same way whether the
|
|
57
63
|
* token is missing or wrong.
|
|
58
64
|
*/
|
|
59
|
-
beforeAccountCheck(request: Request): Promise<void>;
|
|
65
|
+
beforeAccountCheck(request: Request, context?: RequestContext): Promise<void>;
|
|
60
66
|
/** Counts an invite redemption against the caller and the whole relay, before the code is looked up. */
|
|
61
|
-
beforeRedeem(request: Request): Promise<void>;
|
|
67
|
+
beforeRedeem(request: Request, context?: RequestContext): Promise<void>;
|
|
62
68
|
/** A code that matched nothing costs the caller once more, so guessing is slower than joining. */
|
|
63
|
-
afterUnknownInvite(request: Request): Promise<void>;
|
|
69
|
+
afterUnknownInvite(request: Request, context?: RequestContext): Promise<void>;
|
|
64
70
|
};
|
|
65
71
|
export type Admission = ReturnType<typeof createAdmission>;
|
|
66
72
|
/**
|
package/dist/admission.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admission.d.ts","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAMA,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,eAAO,MAAM,qBAAqB,kFAAkF,CAAC;AAErH,gGAAgG;AAChG,eAAO,MAAM,kBAAkB,8CAA8C,CAAC;AAE9E,MAAM,MAAM,SAAS,GAAG;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IAAC,EAAE,EAAE,IAAI,CAAA;CAAC,GAAG;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,CAAC;AAE1E,2HAA2H;AAC3H,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,6CAA6C;IAC7C,yBAAyB,EAAE,MAAM,CAAC;IAClC,iGAAiG;IACjG,yBAAyB,EAAE,MAAM,CAAC;IAClC,+EAA+E;IAC/E,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sHAAsH;IACtH,+BAA+B,EAAE,MAAM,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAAiJ,CAAC;AAEzL,MAAM,MAAM,gBAAgB,GAAG;IAC3B,gHAAgH;IAChH,WAAW,CAAC,EAA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_000 } = {}) {
|
|
|
38
38
|
export function createAdmission(options) {
|
|
39
39
|
const limits = { ...DEFAULT_ADMISSION_LIMITS, ...options.limits };
|
|
40
40
|
const tokenDigest = options.createToken ? hashCredential(options.createToken) : null;
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
const header = options.trustedProxyHeader;
|
|
42
|
+
const clientAddress = options.clientAddress ?? ((request, context) => (header ? proxiedAddress(request, header) : undefined) ?? context.peerAddress);
|
|
43
|
+
const address = (request, context) => clientAddress(request, context) ?? 'unknown';
|
|
44
|
+
const take = async (request, context, key, cost, limit) => {
|
|
45
|
+
if (!options.limiter || options.exempt?.(request, context)) {
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
const decision = await options.limiter.take(key, cost, limit);
|
|
@@ -58,34 +60,34 @@ export function createAdmission(options) {
|
|
|
58
60
|
/** Creating a room needs the create token here. */
|
|
59
61
|
createTokenRequired: tokenDigest !== null,
|
|
60
62
|
/** Refuses a room creation without the create token, then counts it against the caller. */
|
|
61
|
-
async beforeCreate(request) {
|
|
63
|
+
async beforeCreate(request, context = {}) {
|
|
62
64
|
if (tokenDigest && !(await tokenMatches(request))) {
|
|
63
65
|
throw new ProtocolError('unauthorized', CREATE_TOKEN_REQUIRED);
|
|
64
66
|
}
|
|
65
|
-
await take(request, `create:address:${address(request)}`, 1, { perMinute: limits.createPerMinutePerAddress });
|
|
67
|
+
await take(request, context, `create:address:${address(request, context)}`, 1, { perMinute: limits.createPerMinutePerAddress });
|
|
66
68
|
},
|
|
67
69
|
/**
|
|
68
70
|
* The team token check behind token-mode login: counted first, in its own bucket so
|
|
69
71
|
* guessing cannot spend the create budget, then refused the same way whether the
|
|
70
72
|
* token is missing or wrong.
|
|
71
73
|
*/
|
|
72
|
-
async beforeAccountCheck(request) {
|
|
73
|
-
await take(request, `account-check:address:${address(request)}`, 1, { perMinute: limits.accountCheckPerMinutePerAddress });
|
|
74
|
+
async beforeAccountCheck(request, context = {}) {
|
|
75
|
+
await take(request, context, `account-check:address:${address(request, context)}`, 1, { perMinute: limits.accountCheckPerMinutePerAddress });
|
|
74
76
|
if (!(await tokenMatches(request))) {
|
|
75
77
|
throw new ProtocolError('unauthorized', TEAM_TOKEN_REFUSED);
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
80
|
/** Counts an invite redemption against the caller and the whole relay, before the code is looked up. */
|
|
79
|
-
async beforeRedeem(request) {
|
|
80
|
-
await take(request, `redeem:address:${address(request)}`, 1, { perMinute: limits.redeemPerMinutePerAddress });
|
|
81
|
-
await take(request, 'redeem:global', 1, { perMinute: limits.redeemPerMinuteGlobal });
|
|
81
|
+
async beforeRedeem(request, context = {}) {
|
|
82
|
+
await take(request, context, `redeem:address:${address(request, context)}`, 1, { perMinute: limits.redeemPerMinutePerAddress });
|
|
83
|
+
await take(request, context, 'redeem:global', 1, { perMinute: limits.redeemPerMinuteGlobal });
|
|
82
84
|
},
|
|
83
85
|
/** A code that matched nothing costs the caller once more, so guessing is slower than joining. */
|
|
84
|
-
async afterUnknownInvite(request) {
|
|
85
|
-
if (!options.limiter || options.exempt?.(request)) {
|
|
86
|
+
async afterUnknownInvite(request, context = {}) {
|
|
87
|
+
if (!options.limiter || options.exempt?.(request, context)) {
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
|
-
await options.limiter.take(`redeem:address:${address(request)}`, 1, { perMinute: limits.redeemPerMinutePerAddress });
|
|
90
|
+
await options.limiter.take(`redeem:address:${address(request, context)}`, 1, { perMinute: limits.redeemPerMinutePerAddress });
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
93
|
}
|
package/dist/admission.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admission.js","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,mFAAmF;AACnF,8DAA8D;AAE9D,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;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E,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;gBACzD,OAAO;YACX,CAAC;YACD,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,EAAC,SAAS,EAAE,MAAM,CAAC,yBAAyB,EAAC,CAAC,CAAC;QAChI,CAAC;KACJ,CAAC;AACN,CAAC;AAID;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,MAAc;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,OAAO,IAAI,IAAI,SAAS,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC"}
|
package/dist/ports.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** What the transport knows about a request and no header can claim. */
|
|
2
|
+
export type RequestContext = {
|
|
3
|
+
/** The address of the connection the request arrived on; absent when the platform cannot see it. */
|
|
4
|
+
peerAddress?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Runs a room's work in order. `write` is false for a request that changes nothing, which may
|
|
8
|
+
* start once the writes queued before it are done but does not hold up the ones after it.
|
|
9
|
+
*/
|
|
10
|
+
export interface RoomExecutor {
|
|
11
|
+
run<T>(roomId: string | null, write: boolean, action: () => Promise<T>): Promise<T>;
|
|
12
|
+
/** Resolves once every write already queued has finished. */
|
|
13
|
+
idle(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/** Wakes the kernel's `tick` at a time; `null` cancels the wake-up. A later call replaces an earlier one. */
|
|
16
|
+
export interface Scheduler {
|
|
17
|
+
plan(at: number | null): void;
|
|
18
|
+
}
|
|
19
|
+
/** Runs everything as it comes, for a platform that already orders a room's work, such as a Durable Object. */
|
|
20
|
+
export declare function directExecutor(): RoomExecutor;
|
|
21
|
+
/**
|
|
22
|
+
* One queue for every room, for a relay with one process over one store: two writes never
|
|
23
|
+
* interleave, so two cannot both choose the same next event sequence.
|
|
24
|
+
*/
|
|
25
|
+
export declare function queueExecutor(): RoomExecutor;
|
|
26
|
+
type TimerSchedulerOptions = {
|
|
27
|
+
now?: () => number;
|
|
28
|
+
};
|
|
29
|
+
/** A `setTimeout` per wake-up that never keeps the process alive; `stop` cancels it for good. */
|
|
30
|
+
export declare function timerScheduler(wake: () => void, { now }?: TimerSchedulerOptions): Scheduler & {
|
|
31
|
+
stop(): void;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAIA,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG;IACzB,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpF,6DAA6D;IAC7D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,6GAA6G;AAC7G,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CACjC;AAED,+GAA+G;AAC/G,wBAAgB,cAAc,IAAI,YAAY,CAK7C;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,YAAY,CAY5C;AAED,KAAK,qBAAqB,GAAG;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAC,CAAC;AAElD,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,EAAC,GAAc,EAAC,GAAE,qBAA0B,GAAG,SAAS,GAAG;IAAC,IAAI,IAAI,IAAI,CAAA;CAAC,CAkBzH"}
|
package/dist/ports.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//! What a relay's platform supplies to the shared kernel (`relay.ts`): how room work is
|
|
2
|
+
//! ordered, when the kernel is woken again, and what the transport saw of the caller.
|
|
3
|
+
//! Each platform implements these once; no protocol rule lives on that side.
|
|
4
|
+
/** Runs everything as it comes, for a platform that already orders a room's work, such as a Durable Object. */
|
|
5
|
+
export function directExecutor() {
|
|
6
|
+
return {
|
|
7
|
+
run: (_roomId, _write, action) => action(),
|
|
8
|
+
idle: () => Promise.resolve()
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One queue for every room, for a relay with one process over one store: two writes never
|
|
13
|
+
* interleave, so two cannot both choose the same next event sequence.
|
|
14
|
+
*/
|
|
15
|
+
export function queueExecutor() {
|
|
16
|
+
let writes = Promise.resolve();
|
|
17
|
+
return {
|
|
18
|
+
run(_roomId, write, action) {
|
|
19
|
+
const result = writes.then(action);
|
|
20
|
+
if (write) {
|
|
21
|
+
writes = result.catch(() => { });
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
},
|
|
25
|
+
idle: () => writes.then(() => { })
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** A `setTimeout` per wake-up that never keeps the process alive; `stop` cancels it for good. */
|
|
29
|
+
export function timerScheduler(wake, { now = Date.now } = {}) {
|
|
30
|
+
let timer;
|
|
31
|
+
let stopped = false;
|
|
32
|
+
return {
|
|
33
|
+
plan(at) {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
timer = undefined;
|
|
36
|
+
if (stopped || at === null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
timer = setTimeout(wake, Math.min(Math.max(0, at - now()), 2 ** 31 - 1));
|
|
40
|
+
timer.unref?.();
|
|
41
|
+
},
|
|
42
|
+
stop() {
|
|
43
|
+
stopped = true;
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,sFAAsF;AACtF,6EAA6E;AAuB7E,+GAA+G;AAC/G,MAAM,UAAU,cAAc;IAC1B,OAAO;QACH,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE;QAC1C,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;KAChC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa;IACzB,IAAI,MAAM,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;IACjD,OAAO;QACH,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM;YACtB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,KAAK,EAAE,CAAC;gBACR,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;KACpC,CAAC;AACN,CAAC;AAID,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAAC,IAAgB,EAAE,EAAC,GAAG,GAAG,IAAI,CAAC,GAAG,KAA2B,EAAE;IACzF,IAAI,KAAgD,CAAC;IACrD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,OAAO;QACH,IAAI,CAAC,EAAE;YACH,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,SAAS,CAAC;YAClB,IAAI,OAAO,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;gBACzB,OAAO;YACX,CAAC;YACD,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;YACxE,KAA8B,CAAC,KAAK,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI;YACA,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/dist/relay.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { LiveTransport, LocalRoom, RelayLimits, ServerDescription } from '@pairlobby/protocol';
|
|
2
|
+
import type { Admission } from './admission.js';
|
|
3
|
+
import type { ChangeNotifier } from './changes.js';
|
|
4
|
+
import type { RequestContext, RoomExecutor, Scheduler } from './ports.js';
|
|
5
|
+
import type { RoomService } from './service.js';
|
|
6
|
+
export interface RelayOptions {
|
|
7
|
+
service: RoomService;
|
|
8
|
+
/** Orders each room's work; defaults to running it as it comes, for a platform that orders it already. */
|
|
9
|
+
executor?: RoomExecutor;
|
|
10
|
+
/** Wakes `tick` for the next auto-close. Absent means the platform runs `tick` itself, such as from a Durable Object alarm. */
|
|
11
|
+
scheduler?: Scheduler;
|
|
12
|
+
/**
|
|
13
|
+
* The room an invite code's digest belongs to, which `edge` needs before any room sees the code.
|
|
14
|
+
* Defaults to the service's own store; a relay with one store per room passes its directory.
|
|
15
|
+
*/
|
|
16
|
+
inviteRoom?: (digest: string) => Promise<string | null>;
|
|
17
|
+
/**
|
|
18
|
+
* True when the relay sits behind a proxy or a public address. Every caller then arrives from
|
|
19
|
+
* the proxy, so no connection proves a caller is local, and joining by name is refused.
|
|
20
|
+
*/
|
|
21
|
+
behindProxy?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Exact origins a browser may call from. A CLI sends no `Origin`, so an
|
|
24
|
+
* unexpected one means a web page is talking to us — including a malicious
|
|
25
|
+
* page reaching for loopback.
|
|
26
|
+
*/
|
|
27
|
+
allowedOrigins?: string[];
|
|
28
|
+
/** `Host` values to accept, defeating DNS rebinding against a local server. */
|
|
29
|
+
allowedHosts?: string[] | ((host: string) => boolean);
|
|
30
|
+
/** What only the adapter knows for `GET /v1/server`: its share addresses and its build. Every relay answers the path. */
|
|
31
|
+
serverInfo?: () => ServerInfo;
|
|
32
|
+
/**
|
|
33
|
+
* Wakes held reads. Present means the relay offers long-poll: `GET .../events?wait=` waits for a change
|
|
34
|
+
* instead of answering empty. Only a relay whose writes all pass through one process can offer it.
|
|
35
|
+
*/
|
|
36
|
+
changes?: ChangeNotifier;
|
|
37
|
+
/**
|
|
38
|
+
* How clients hear about new events, when the relay knows. Defaults to `long-poll` with `changes` and is
|
|
39
|
+
* otherwise left out, so a client keeps its own rule; a relay with a socket hub says `websocket`.
|
|
40
|
+
*/
|
|
41
|
+
transport?: LiveTransport;
|
|
42
|
+
/** Features beyond those the router can see for itself. */
|
|
43
|
+
features?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Answers `GET /v1/invites/probe?prefix=`: whether any invite this server issued
|
|
46
|
+
* has a digest starting with that prefix. Lets a client on the same network find
|
|
47
|
+
* the relay behind a bare code; absent means the path is unknown.
|
|
48
|
+
*/
|
|
49
|
+
inviteProbe?: (prefix: string) => Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Whether this request came from the relay's own device, its local network or its
|
|
52
|
+
* tailnet. Only a transport that sees the connection's real address can say; absent
|
|
53
|
+
* means never, so joining by name is refused.
|
|
54
|
+
*/
|
|
55
|
+
peerIsLocal?: (request: Request, context: RequestContext) => boolean;
|
|
56
|
+
/** Open rooms that allow local joins, matching a name or all of them; answers `GET /v1/rooms/local[?name=]`. */
|
|
57
|
+
localRooms?: (name?: string) => Promise<LocalRoom[]>;
|
|
58
|
+
/** The create token and rate limits; absent means anyone who reaches the relay may create rooms and try codes freely. */
|
|
59
|
+
admission?: Admission;
|
|
60
|
+
/** Answers `GET /.well-known/pairlobby.json`, which tells `pairlobby setup` who this relay is and how to log in. */
|
|
61
|
+
discovery?: () => DiscoveryDocument;
|
|
62
|
+
/**
|
|
63
|
+
* Token-mode login: answers `GET /api/online/account` for a caller holding the team
|
|
64
|
+
* token (the create token). Absent means the path is unknown. Needs `admission`.
|
|
65
|
+
*/
|
|
66
|
+
accountCheck?: (request: Request) => TeamAccount;
|
|
67
|
+
}
|
|
68
|
+
/** Where `edge` sends a request that needs a room: the room's id, and the request to run there. */
|
|
69
|
+
export type RoomRoute = {
|
|
70
|
+
roomId: string;
|
|
71
|
+
request: Request;
|
|
72
|
+
};
|
|
73
|
+
export interface Relay {
|
|
74
|
+
/** Both halves in one process. */
|
|
75
|
+
handle(request: Request, context?: RequestContext): Promise<Response>;
|
|
76
|
+
/** Admission and every route that needs no room. A request reaching `inRoom` must have come through here. */
|
|
77
|
+
edge(request: Request, context?: RequestContext): Promise<Response | RoomRoute>;
|
|
78
|
+
/** A request `edge` sent to `roomId`, run in that room's order. */
|
|
79
|
+
inRoom(request: Request, roomId: string, context?: RequestContext): Promise<Response>;
|
|
80
|
+
/** Closes rooms whose auto-close time has passed, then plans the next wake-up. */
|
|
81
|
+
tick(kind: 'auto-close'): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
/** What a deployment says about itself to `pairlobby setup`. */
|
|
84
|
+
export interface DiscoveryDocument {
|
|
85
|
+
version: 1;
|
|
86
|
+
name?: string;
|
|
87
|
+
login: {
|
|
88
|
+
mode: 'token' | 'none';
|
|
89
|
+
tokenHelp?: string;
|
|
90
|
+
verify?: string;
|
|
91
|
+
};
|
|
92
|
+
relays: string[];
|
|
93
|
+
features: string[];
|
|
94
|
+
support?: string;
|
|
95
|
+
}
|
|
96
|
+
/** The account a team token stands for: no person, just where its rooms go. */
|
|
97
|
+
export interface TeamAccount {
|
|
98
|
+
email: null;
|
|
99
|
+
userId: 'team';
|
|
100
|
+
name: string | null;
|
|
101
|
+
server: string;
|
|
102
|
+
handle: null;
|
|
103
|
+
}
|
|
104
|
+
export interface ServerInfo {
|
|
105
|
+
/** Addresses other devices can use to reach this server; empty when it only listens on this device. */
|
|
106
|
+
shareUrls: string[];
|
|
107
|
+
/** True when a device on the same network or tailnet can find this server from an invite code alone. */
|
|
108
|
+
discoverable?: boolean;
|
|
109
|
+
/** The relay's own version, so a client can tell when it runs an older build than the CLI. */
|
|
110
|
+
version?: string;
|
|
111
|
+
}
|
|
112
|
+
export declare function createRelay(options: RelayOptions): Relay;
|
|
113
|
+
/** The relay's own account of itself, from what this router was given: nothing is claimed that it was not. */
|
|
114
|
+
export declare function describe(options: RelayOptions): ServerDescription;
|
|
115
|
+
export type RelayDescriptionInput = {
|
|
116
|
+
limits: RelayLimits;
|
|
117
|
+
features: string[];
|
|
118
|
+
transport?: LiveTransport;
|
|
119
|
+
info?: ServerInfo;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* `GET /v1/server` for any relay, including one that answers it outside this router, such as
|
|
123
|
+
* a Worker in front of Durable Objects. Every relay speaking this protocol has message stages.
|
|
124
|
+
*/
|
|
125
|
+
export declare function describeRelay({ limits, features, transport, info }: RelayDescriptionInput): ServerDescription;
|
|
126
|
+
/** Refuses a request declaring another protocol version, before anything else looks at it. Null when it may go on. */
|
|
127
|
+
export declare function protocolVersionRefusal(request: Request): Response | null;
|
|
128
|
+
//# sourceMappingURL=relay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay.d.ts","sourceRoot":"","sources":["../src/relay.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAY,aAAa,EAAE,SAAS,EAAgB,WAAW,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAE3H,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,+HAA+H;IAC/H,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACtD,yHAAyH;IACzH,UAAU,CAAC,EAAE,MAAM,UAAU,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;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