@norskvideo/moq-net 0.1.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 +70 -0
- package/announced.d.ts +45 -0
- package/announced.d.ts.map +1 -0
- package/announced.js +70 -0
- package/announced.js.map +1 -0
- package/bandwidth.d.ts +11 -0
- package/bandwidth.d.ts.map +1 -0
- package/bandwidth.js +7 -0
- package/bandwidth.js.map +1 -0
- package/broadcast.d.ts +39 -0
- package/broadcast.d.ts.map +1 -0
- package/broadcast.js +76 -0
- package/broadcast.js.map +1 -0
- package/connection/accept.d.ts +15 -0
- package/connection/accept.d.ts.map +1 -0
- package/connection/accept.js +137 -0
- package/connection/accept.js.map +1 -0
- package/connection/cert.test.d.ts +2 -0
- package/connection/cert.test.d.ts.map +1 -0
- package/connection/cert.test.js +26 -0
- package/connection/cert.test.js.map +1 -0
- package/connection/connect.d.ts +37 -0
- package/connection/connect.d.ts.map +1 -0
- package/connection/connect.js +348 -0
- package/connection/connect.js.map +1 -0
- package/connection/established.d.ts +30 -0
- package/connection/established.d.ts.map +1 -0
- package/connection/established.js +3 -0
- package/connection/established.js.map +1 -0
- package/connection/handshake.d.ts +10 -0
- package/connection/handshake.d.ts.map +1 -0
- package/connection/handshake.js +48 -0
- package/connection/handshake.js.map +1 -0
- package/connection/index.d.ts +5 -0
- package/connection/index.d.ts.map +1 -0
- package/connection/index.js +6 -0
- package/connection/index.js.map +1 -0
- package/connection/reload.d.ts +47 -0
- package/connection/reload.d.ts.map +1 -0
- package/connection/reload.js +137 -0
- package/connection/reload.js.map +1 -0
- package/group.d.ts +66 -0
- package/group.d.ts.map +1 -0
- package/group.js +135 -0
- package/group.js.map +1 -0
- package/group.test.d.ts +2 -0
- package/group.test.d.ts.map +1 -0
- package/group.test.js +66 -0
- package/group.test.js.map +1 -0
- package/ietf/adapter.d.ts +65 -0
- package/ietf/adapter.d.ts.map +1 -0
- package/ietf/adapter.js +626 -0
- package/ietf/adapter.js.map +1 -0
- package/ietf/connection.d.ts +65 -0
- package/ietf/connection.d.ts.map +1 -0
- package/ietf/connection.js +248 -0
- package/ietf/connection.js.map +1 -0
- package/ietf/control.d.ts +135 -0
- package/ietf/control.d.ts.map +1 -0
- package/ietf/control.js +242 -0
- package/ietf/control.js.map +1 -0
- package/ietf/fetch.d.ts +64 -0
- package/ietf/fetch.d.ts.map +1 -0
- package/ietf/fetch.js +100 -0
- package/ietf/fetch.js.map +1 -0
- package/ietf/goaway.d.ts +15 -0
- package/ietf/goaway.d.ts.map +1 -0
- package/ietf/goaway.js +34 -0
- package/ietf/goaway.js.map +1 -0
- package/ietf/ietf.test.d.ts +2 -0
- package/ietf/ietf.test.d.ts.map +1 -0
- package/ietf/ietf.test.js +873 -0
- package/ietf/ietf.test.js.map +1 -0
- package/ietf/index.d.ts +18 -0
- package/ietf/index.d.ts.map +1 -0
- package/ietf/index.js +19 -0
- package/ietf/index.js.map +1 -0
- package/ietf/message.d.ts +4 -0
- package/ietf/message.d.ts.map +1 -0
- package/ietf/message.js +54 -0
- package/ietf/message.js.map +1 -0
- package/ietf/namespace.d.ts +5 -0
- package/ietf/namespace.d.ts.map +1 -0
- package/ietf/namespace.js +27 -0
- package/ietf/namespace.js.map +1 -0
- package/ietf/object.d.ts +40 -0
- package/ietf/object.d.ts.map +1 -0
- package/ietf/object.js +160 -0
- package/ietf/object.js.map +1 -0
- package/ietf/parameters.d.ts +56 -0
- package/ietf/parameters.d.ts.map +1 -0
- package/ietf/parameters.js +337 -0
- package/ietf/parameters.js.map +1 -0
- package/ietf/properties.d.ts +4 -0
- package/ietf/properties.d.ts.map +1 -0
- package/ietf/properties.js +33 -0
- package/ietf/properties.js.map +1 -0
- package/ietf/publish.d.ts +68 -0
- package/ietf/publish.d.ts.map +1 -0
- package/ietf/publish.js +192 -0
- package/ietf/publish.js.map +1 -0
- package/ietf/publish_namespace.d.ts +68 -0
- package/ietf/publish_namespace.d.ts.map +1 -0
- package/ietf/publish_namespace.js +176 -0
- package/ietf/publish_namespace.js.map +1 -0
- package/ietf/publisher.d.ts +50 -0
- package/ietf/publisher.d.ts.map +1 -0
- package/ietf/publisher.js +330 -0
- package/ietf/publisher.js.map +1 -0
- package/ietf/request.d.ts +52 -0
- package/ietf/request.d.ts.map +1 -0
- package/ietf/request.js +119 -0
- package/ietf/request.js.map +1 -0
- package/ietf/setup.d.ts +38 -0
- package/ietf/setup.d.ts.map +1 -0
- package/ietf/setup.js +129 -0
- package/ietf/setup.js.map +1 -0
- package/ietf/subscribe.d.ts +66 -0
- package/ietf/subscribe.d.ts.map +1 -0
- package/ietf/subscribe.js +276 -0
- package/ietf/subscribe.js.map +1 -0
- package/ietf/subscribe_namespace.d.ts +101 -0
- package/ietf/subscribe_namespace.d.ts.map +1 -0
- package/ietf/subscribe_namespace.js +256 -0
- package/ietf/subscribe_namespace.js.map +1 -0
- package/ietf/subscriber.d.ts +53 -0
- package/ietf/subscriber.d.ts.map +1 -0
- package/ietf/subscriber.js +404 -0
- package/ietf/subscriber.js.map +1 -0
- package/ietf/track.d.ts +40 -0
- package/ietf/track.d.ts.map +1 -0
- package/ietf/track.js +108 -0
- package/ietf/track.js.map +1 -0
- package/ietf/version.d.ts +56 -0
- package/ietf/version.d.ts.map +1 -0
- package/ietf/version.js +63 -0
- package/ietf/version.js.map +1 -0
- package/index.d.ts +22 -0
- package/index.d.ts.map +1 -0
- package/index.js +23 -0
- package/index.js.map +1 -0
- package/integration.test.d.ts +2 -0
- package/integration.test.d.ts.map +1 -0
- package/integration.test.js +90 -0
- package/integration.test.js.map +1 -0
- package/lite/announce.d.ts +35 -0
- package/lite/announce.d.ts.map +1 -0
- package/lite/announce.js +166 -0
- package/lite/announce.js.map +1 -0
- package/lite/connection.d.ts +47 -0
- package/lite/connection.d.ts.map +1 -0
- package/lite/connection.js +247 -0
- package/lite/connection.js.map +1 -0
- package/lite/fetch.d.ts +14 -0
- package/lite/fetch.d.ts.map +1 -0
- package/lite/fetch.js +47 -0
- package/lite/fetch.js.map +1 -0
- package/lite/goaway.d.ts +10 -0
- package/lite/goaway.d.ts.map +1 -0
- package/lite/goaway.js +37 -0
- package/lite/goaway.js.map +1 -0
- package/lite/group.d.ts +18 -0
- package/lite/group.d.ts.map +1 -0
- package/lite/group.js +46 -0
- package/lite/group.js.map +1 -0
- package/lite/index.d.ts +11 -0
- package/lite/index.d.ts.map +1 -0
- package/lite/index.js +12 -0
- package/lite/index.js.map +1 -0
- package/lite/message.d.ts +5 -0
- package/lite/message.d.ts.map +1 -0
- package/lite/message.js +51 -0
- package/lite/message.js.map +1 -0
- package/lite/origin.d.ts +25 -0
- package/lite/origin.d.ts.map +1 -0
- package/lite/origin.js +35 -0
- package/lite/origin.js.map +1 -0
- package/lite/probe.d.ts +12 -0
- package/lite/probe.d.ts.map +1 -0
- package/lite/probe.js +60 -0
- package/lite/probe.js.map +1 -0
- package/lite/publisher.d.ts +63 -0
- package/lite/publisher.d.ts.map +1 -0
- package/lite/publisher.js +350 -0
- package/lite/publisher.js.map +1 -0
- package/lite/session.d.ts +36 -0
- package/lite/session.d.ts.map +1 -0
- package/lite/session.js +130 -0
- package/lite/session.js.map +1 -0
- package/lite/setup.d.ts +18 -0
- package/lite/setup.d.ts.map +1 -0
- package/lite/setup.js +55 -0
- package/lite/setup.js.map +1 -0
- package/lite/stream.d.ts +23 -0
- package/lite/stream.d.ts.map +1 -0
- package/lite/stream.js +20 -0
- package/lite/stream.js.map +1 -0
- package/lite/subscribe.d.ts +111 -0
- package/lite/subscribe.d.ts.map +1 -0
- package/lite/subscribe.js +341 -0
- package/lite/subscribe.js.map +1 -0
- package/lite/subscriber.d.ts +80 -0
- package/lite/subscriber.d.ts.map +1 -0
- package/lite/subscriber.js +316 -0
- package/lite/subscriber.js.map +1 -0
- package/lite/track.d.ts +38 -0
- package/lite/track.d.ts.map +1 -0
- package/lite/track.js +81 -0
- package/lite/track.js.map +1 -0
- package/lite/track.test.d.ts +2 -0
- package/lite/track.test.d.ts.map +1 -0
- package/lite/track.test.js +53 -0
- package/lite/track.test.js.map +1 -0
- package/lite/version.d.ts +16 -0
- package/lite/version.d.ts.map +1 -0
- package/lite/version.js +41 -0
- package/lite/version.js.map +1 -0
- package/mock.d.ts +16 -0
- package/mock.d.ts.map +1 -0
- package/mock.js +154 -0
- package/mock.js.map +1 -0
- package/package.json +27 -0
- package/path.d.ts +111 -0
- package/path.d.ts.map +1 -0
- package/path.js +133 -0
- package/path.js.map +1 -0
- package/path.test.d.ts +2 -0
- package/path.test.d.ts.map +1 -0
- package/path.test.js +169 -0
- package/path.test.js.map +1 -0
- package/stream.d.ts +57 -0
- package/stream.d.ts.map +1 -0
- package/stream.js +326 -0
- package/stream.js.map +1 -0
- package/stream.test.d.ts +2 -0
- package/stream.test.d.ts.map +1 -0
- package/stream.test.js +210 -0
- package/stream.test.js.map +1 -0
- package/time.d.ts +109 -0
- package/time.d.ts.map +1 -0
- package/time.js +94 -0
- package/time.js.map +1 -0
- package/track.d.ts +85 -0
- package/track.d.ts.map +1 -0
- package/track.js +227 -0
- package/track.js.map +1 -0
- package/track.test.d.ts +2 -0
- package/track.test.d.ts.map +1 -0
- package/track.test.js +56 -0
- package/track.test.js.map +1 -0
- package/util/error.d.ts +3 -0
- package/util/error.d.ts.map +1 -0
- package/util/error.js +9 -0
- package/util/error.js.map +1 -0
- package/util/hex.d.ts +3 -0
- package/util/hex.d.ts.map +1 -0
- package/util/hex.js +16 -0
- package/util/hex.js.map +1 -0
- package/util/index.d.ts +2 -0
- package/util/index.d.ts.map +1 -0
- package/util/index.js +3 -0
- package/util/index.js.map +1 -0
- package/varint.d.ts +36 -0
- package/varint.d.ts.map +1 -0
- package/varint.js +288 -0
- package/varint.js.map +1 -0
- package/varint.test.d.ts +2 -0
- package/varint.test.d.ts.map +1 -0
- package/varint.test.js +106 -0
- package/varint.test.js.map +1 -0
- package/zod.d.ts +13 -0
- package/zod.d.ts.map +1 -0
- package/zod.js +19 -0
- package/zod.js.map +1 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/* @ts-self-types="./connection.d.ts" */
|
|
2
|
+
import { Signal } from "@norskvideo/moq-signals";
|
|
3
|
+
import { createBandwidth } from "../bandwidth.js";
|
|
4
|
+
import * as Path from "../path.js";
|
|
5
|
+
import { Readers, Stream, Writer } from "../stream.js";
|
|
6
|
+
import { AnnounceInterest } from "./announce.js";
|
|
7
|
+
import { Goaway } from "./goaway.js";
|
|
8
|
+
import { Group } from "./group.js";
|
|
9
|
+
import { randomOrigin } from "./origin.js";
|
|
10
|
+
import { Publisher } from "./publisher.js";
|
|
11
|
+
import { SessionInfo } from "./session.js";
|
|
12
|
+
import { Setup } from "./setup.js";
|
|
13
|
+
import { DataId, StreamId } from "./stream.js";
|
|
14
|
+
import { Subscribe } from "./subscribe.js";
|
|
15
|
+
import { Subscriber } from "./subscriber.js";
|
|
16
|
+
import { Track } from "./track.js";
|
|
17
|
+
import { hasSetupStream, Version, versionName } from "./version.js";
|
|
18
|
+
const SEND_BW_POLL_INTERVAL = 100; // ms
|
|
19
|
+
/**
|
|
20
|
+
* Represents a connection to a MoQ server.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export class Connection {
|
|
25
|
+
// The URL of the connection.
|
|
26
|
+
url;
|
|
27
|
+
// The version of the connection as a human-readable string.
|
|
28
|
+
version;
|
|
29
|
+
// The version used for encoding/decoding.
|
|
30
|
+
#version;
|
|
31
|
+
// The established WebTransport session.
|
|
32
|
+
#quic;
|
|
33
|
+
// Use to receive/send session messages.
|
|
34
|
+
#session;
|
|
35
|
+
// Module for contributing tracks.
|
|
36
|
+
#publisher;
|
|
37
|
+
// Module for distributing tracks.
|
|
38
|
+
#subscriber;
|
|
39
|
+
/** Estimated send bitrate from the congestion controller. */
|
|
40
|
+
sendBandwidth;
|
|
41
|
+
/** Estimated receive bitrate from PROBE (moq-lite-03+ only). */
|
|
42
|
+
recvBandwidth;
|
|
43
|
+
/** RTT in milliseconds from PROBE (moq-lite-04+ only). */
|
|
44
|
+
rtt;
|
|
45
|
+
/** Random per-connection origin id. Shared by Publisher (for outbound hop
|
|
46
|
+
* chains) and Subscriber (available for optional self-filtering on announces). */
|
|
47
|
+
origin;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new Connection instance.
|
|
50
|
+
* @param url - The URL of the connection
|
|
51
|
+
* @param quic - The WebTransport session
|
|
52
|
+
* @param session - The session stream
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
constructor(url, quic, version, session) {
|
|
57
|
+
this.url = url;
|
|
58
|
+
this.#quic = quic;
|
|
59
|
+
this.#session = session;
|
|
60
|
+
this.version = versionName(version);
|
|
61
|
+
this.#version = version;
|
|
62
|
+
// Send bandwidth is version-agnostic: depends on browser/QUIC support.
|
|
63
|
+
const hasGetStats = typeof quic.getStats === "function";
|
|
64
|
+
if (hasGetStats) {
|
|
65
|
+
this.sendBandwidth = createBandwidth();
|
|
66
|
+
}
|
|
67
|
+
// Recv bandwidth requires PROBE support (Lite03+).
|
|
68
|
+
if (version !== Version.DRAFT_01 && version !== Version.DRAFT_02) {
|
|
69
|
+
this.recvBandwidth = createBandwidth();
|
|
70
|
+
}
|
|
71
|
+
// RTT can be populated by PROBE (Lite04+) or getStats() (when supported).
|
|
72
|
+
// TODO prefer getStats() when both are available.
|
|
73
|
+
this.rtt = new Signal(undefined);
|
|
74
|
+
this.origin = randomOrigin();
|
|
75
|
+
this.#publisher = new Publisher(this.#quic, this.#version, this.origin);
|
|
76
|
+
this.#subscriber = new Subscriber(this.#quic, this.#version, this.origin, this.recvBandwidth, this.rtt);
|
|
77
|
+
void this.#run();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Closes the connection.
|
|
81
|
+
*/
|
|
82
|
+
close() {
|
|
83
|
+
this.#publisher.close();
|
|
84
|
+
this.#subscriber.close();
|
|
85
|
+
try {
|
|
86
|
+
// TODO: For whatever reason, this try/catch doesn't seem to work..?
|
|
87
|
+
this.#quic.close();
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// ignore
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async #run() {
|
|
94
|
+
const tasks = [this.#runSession(), this.#runBidis(), this.#runUnis()];
|
|
95
|
+
// moq-lite-05+: each endpoint opens a Setup stream and sends a single SETUP message.
|
|
96
|
+
if (hasSetupStream(this.#version)) {
|
|
97
|
+
tasks.push(this.#runSetup());
|
|
98
|
+
}
|
|
99
|
+
if (this.sendBandwidth) {
|
|
100
|
+
tasks.push(this.#runSendBandwidth(this.sendBandwidth));
|
|
101
|
+
}
|
|
102
|
+
if (this.recvBandwidth) {
|
|
103
|
+
tasks.push(this.#subscriber.runProbe());
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
await Promise.all(tasks);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
console.error("fatal error running connection", err);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
this.close();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
publish(path, broadcast) {
|
|
116
|
+
this.#publisher.publish(path, broadcast);
|
|
117
|
+
}
|
|
118
|
+
announced(prefix = Path.empty()) {
|
|
119
|
+
return this.#subscriber.announced(prefix);
|
|
120
|
+
}
|
|
121
|
+
consume(broadcast) {
|
|
122
|
+
return this.#subscriber.consume(broadcast);
|
|
123
|
+
}
|
|
124
|
+
async #runSession() {
|
|
125
|
+
if (!this.#session) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
for (;;) {
|
|
130
|
+
const msg = await SessionInfo.decodeMaybe(this.#session.reader, this.#version);
|
|
131
|
+
if (!msg)
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
console.debug("session stream closed");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async #runBidis() {
|
|
140
|
+
for (;;) {
|
|
141
|
+
const stream = await Stream.accept(this.#quic);
|
|
142
|
+
if (!stream)
|
|
143
|
+
break;
|
|
144
|
+
this.#runBidi(stream)
|
|
145
|
+
.catch((err) => {
|
|
146
|
+
stream.writer.reset(err);
|
|
147
|
+
})
|
|
148
|
+
.finally(() => {
|
|
149
|
+
stream.writer.close();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async #runBidi(stream) {
|
|
154
|
+
const typ = await stream.reader.u53();
|
|
155
|
+
if (typ === StreamId.Session) {
|
|
156
|
+
throw new Error("duplicate session stream");
|
|
157
|
+
}
|
|
158
|
+
else if (typ === StreamId.Announce) {
|
|
159
|
+
const msg = await AnnounceInterest.decode(stream.reader, this.#version);
|
|
160
|
+
await this.#publisher.runAnnounce(msg, stream);
|
|
161
|
+
}
|
|
162
|
+
else if (typ === StreamId.Subscribe) {
|
|
163
|
+
const msg = await Subscribe.decode(stream.reader, this.#version);
|
|
164
|
+
await this.#publisher.runSubscribe(msg, stream);
|
|
165
|
+
}
|
|
166
|
+
else if (typ === StreamId.Track) {
|
|
167
|
+
const msg = await Track.decode(stream.reader, this.#version);
|
|
168
|
+
await this.#publisher.runTrackInfo(msg, stream);
|
|
169
|
+
}
|
|
170
|
+
else if (typ === StreamId.Probe) {
|
|
171
|
+
await this.#publisher.runProbe(stream);
|
|
172
|
+
}
|
|
173
|
+
else if (typ === StreamId.Goaway) {
|
|
174
|
+
const msg = await Goaway.decode(stream.reader, this.#version);
|
|
175
|
+
console.info("received goaway:", msg.uri);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
throw new Error(`unknown stream type: ${typ.toString()}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async #runUnis() {
|
|
182
|
+
const readers = new Readers(this.#quic);
|
|
183
|
+
for (;;) {
|
|
184
|
+
const stream = await readers.next();
|
|
185
|
+
if (!stream)
|
|
186
|
+
break;
|
|
187
|
+
this.#runUni(stream)
|
|
188
|
+
.then(() => {
|
|
189
|
+
stream.stop(new Error("cancel"));
|
|
190
|
+
})
|
|
191
|
+
.catch((err) => {
|
|
192
|
+
stream.stop(err);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async #runUni(stream) {
|
|
197
|
+
const typ = await stream.u8();
|
|
198
|
+
if (typ === DataId.Group) {
|
|
199
|
+
const msg = await Group.decode(stream);
|
|
200
|
+
await this.#subscriber.runGroup(msg, stream);
|
|
201
|
+
}
|
|
202
|
+
else if (typ === DataId.Setup) {
|
|
203
|
+
// moq-lite-05+: read the peer's SETUP and discard it (the path, if any,
|
|
204
|
+
// is handled at accept time by the server's transport binding).
|
|
205
|
+
await Setup.decode(stream, this.#version);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
throw new Error(`unknown stream type: ${typ.toString()}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// moq-lite-05+: open a unidirectional Setup stream, send a single SETUP, and FIN.
|
|
212
|
+
// The browser conveys its path via the WebTransport URL, so the SETUP is empty.
|
|
213
|
+
async #runSetup() {
|
|
214
|
+
const writer = await Writer.open(this.#quic);
|
|
215
|
+
try {
|
|
216
|
+
await writer.u8(DataId.Setup);
|
|
217
|
+
await new Setup().encode(writer, this.#version);
|
|
218
|
+
writer.close();
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
writer.reset(err);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async #runSendBandwidth(bandwidth) {
|
|
225
|
+
const quic = this.#quic;
|
|
226
|
+
return new Promise((resolve) => {
|
|
227
|
+
const id = setInterval(async () => {
|
|
228
|
+
try {
|
|
229
|
+
const stats = await quic.getStats();
|
|
230
|
+
bandwidth.set(stats.estimatedSendRate ?? undefined);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
clearInterval(id);
|
|
234
|
+
resolve();
|
|
235
|
+
}
|
|
236
|
+
}, SEND_BW_POLL_INTERVAL);
|
|
237
|
+
void this.closed.then(() => {
|
|
238
|
+
clearInterval(id);
|
|
239
|
+
resolve();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
get closed() {
|
|
244
|
+
return this.#quic.closed.then(() => undefined);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/lite/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAkB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAe,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,qBAAqB,GAAG,GAAG,CAAC,CAAC,KAAK;AAExC;;;;GAIG;AACH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AAE,CAAC;gBACX,CAAC;YACF,CAAC,EAAE,qBAAqB,CAAC,CAAC;YAE1B,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC1B,aAAa,CAAC,EAAE,CAAC,CAAC;gBAClB,OAAO,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CACD","sourcesContent":["import { Signal } from \"@moq/signals\";\nimport type { Announced } from \"../announced.ts\";\nimport { type Bandwidth, createBandwidth } from \"../bandwidth.ts\";\nimport type { Broadcast } from \"../broadcast.ts\";\nimport type { Established } from \"../connection/established.ts\";\nimport * as Path from \"../path.ts\";\nimport { type Reader, Readers, Stream, Writer } from \"../stream.ts\";\nimport type * as Time from \"../time.ts\";\nimport { AnnounceInterest } from \"./announce.ts\";\nimport { Goaway } from \"./goaway.ts\";\nimport { Group } from \"./group.ts\";\nimport { type Origin, randomOrigin } from \"./origin.ts\";\nimport { Publisher } from \"./publisher.ts\";\nimport { SessionInfo } from \"./session.ts\";\nimport { Setup } from \"./setup.ts\";\nimport { DataId, StreamId } from \"./stream.ts\";\nimport { Subscribe } from \"./subscribe.ts\";\nimport { Subscriber } from \"./subscriber.ts\";\nimport { Track } from \"./track.ts\";\nimport { hasSetupStream, Version, versionName } from \"./version.ts\";\n\nconst SEND_BW_POLL_INTERVAL = 100; // ms\n\n/**\n * Represents a connection to a MoQ server.\n *\n * @public\n */\nexport class Connection implements Established {\n\t// The URL of the connection.\n\treadonly url: URL;\n\n\t// The version of the connection as a human-readable string.\n\treadonly version: string;\n\n\t// The version used for encoding/decoding.\n\t#version: Version;\n\n\t// The established WebTransport session.\n\t#quic: WebTransport;\n\n\t// Use to receive/send session messages.\n\t#session?: Stream;\n\n\t// Module for contributing tracks.\n\t#publisher: Publisher;\n\n\t// Module for distributing tracks.\n\t#subscriber: Subscriber;\n\n\t/** Estimated send bitrate from the congestion controller. */\n\treadonly sendBandwidth?: Bandwidth;\n\n\t/** Estimated receive bitrate from PROBE (moq-lite-03+ only). */\n\treadonly recvBandwidth?: Bandwidth;\n\n\t/** RTT in milliseconds from PROBE (moq-lite-04+ only). */\n\treadonly rtt?: Signal<Time.Milli | undefined>;\n\n\t/** Random per-connection origin id. Shared by Publisher (for outbound hop\n\t * chains) and Subscriber (available for optional self-filtering on announces). */\n\treadonly origin: Origin;\n\n\t/**\n\t * Creates a new Connection instance.\n\t * @param url - The URL of the connection\n\t * @param quic - The WebTransport session\n\t * @param session - The session stream\n\t *\n\t * @internal\n\t */\n\tconstructor(url: URL, quic: WebTransport, version: Version, session?: Stream) {\n\t\tthis.url = url;\n\t\tthis.#quic = quic;\n\t\tthis.#session = session;\n\t\tthis.version = versionName(version);\n\t\tthis.#version = version;\n\n\t\t// Send bandwidth is version-agnostic: depends on browser/QUIC support.\n\t\tconst hasGetStats = typeof (quic as unknown as { getStats?: unknown }).getStats === \"function\";\n\t\tif (hasGetStats) {\n\t\t\tthis.sendBandwidth = createBandwidth();\n\t\t}\n\n\t\t// Recv bandwidth requires PROBE support (Lite03+).\n\t\tif (version !== Version.DRAFT_01 && version !== Version.DRAFT_02) {\n\t\t\tthis.recvBandwidth = createBandwidth();\n\t\t}\n\n\t\t// RTT can be populated by PROBE (Lite04+) or getStats() (when supported).\n\t\t// TODO prefer getStats() when both are available.\n\t\tthis.rtt = new Signal<Time.Milli | undefined>(undefined);\n\n\t\tthis.origin = randomOrigin();\n\t\tthis.#publisher = new Publisher(this.#quic, this.#version, this.origin);\n\t\tthis.#subscriber = new Subscriber(this.#quic, this.#version, this.origin, this.recvBandwidth, this.rtt);\n\n\t\tvoid this.#run();\n\t}\n\n\t/**\n\t * Closes the connection.\n\t */\n\tclose() {\n\t\tthis.#publisher.close();\n\t\tthis.#subscriber.close();\n\n\t\ttry {\n\t\t\t// TODO: For whatever reason, this try/catch doesn't seem to work..?\n\t\t\tthis.#quic.close();\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t}\n\n\tasync #run(): Promise<void> {\n\t\tconst tasks: Promise<void>[] = [this.#runSession(), this.#runBidis(), this.#runUnis()];\n\n\t\t// moq-lite-05+: each endpoint opens a Setup stream and sends a single SETUP message.\n\t\tif (hasSetupStream(this.#version)) {\n\t\t\ttasks.push(this.#runSetup());\n\t\t}\n\n\t\tif (this.sendBandwidth) {\n\t\t\ttasks.push(this.#runSendBandwidth(this.sendBandwidth));\n\t\t}\n\n\t\tif (this.recvBandwidth) {\n\t\t\ttasks.push(this.#subscriber.runProbe());\n\t\t}\n\n\t\ttry {\n\t\t\tawait Promise.all(tasks);\n\t\t} catch (err) {\n\t\t\tconsole.error(\"fatal error running connection\", err);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tpublish(path: Path.Valid, broadcast: Broadcast) {\n\t\tthis.#publisher.publish(path, broadcast);\n\t}\n\n\tannounced(prefix = Path.empty()): Announced {\n\t\treturn this.#subscriber.announced(prefix);\n\t}\n\n\tconsume(broadcast: Path.Valid): Broadcast {\n\t\treturn this.#subscriber.consume(broadcast);\n\t}\n\n\tasync #runSession() {\n\t\tif (!this.#session) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst msg = await SessionInfo.decodeMaybe(this.#session.reader, this.#version);\n\t\t\t\tif (!msg) break;\n\t\t\t}\n\t\t} finally {\n\t\t\tconsole.debug(\"session stream closed\");\n\t\t}\n\t}\n\n\tasync #runBidis() {\n\t\tfor (;;) {\n\t\t\tconst stream = await Stream.accept(this.#quic);\n\t\t\tif (!stream) break;\n\n\t\t\tthis.#runBidi(stream)\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tstream.writer.reset(err);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tstream.writer.close();\n\t\t\t\t});\n\t\t}\n\t}\n\n\tasync #runBidi(stream: Stream) {\n\t\tconst typ = await stream.reader.u53();\n\n\t\tif (typ === StreamId.Session) {\n\t\t\tthrow new Error(\"duplicate session stream\");\n\t\t} else if (typ === StreamId.Announce) {\n\t\t\tconst msg = await AnnounceInterest.decode(stream.reader, this.#version);\n\t\t\tawait this.#publisher.runAnnounce(msg, stream);\n\t\t} else if (typ === StreamId.Subscribe) {\n\t\t\tconst msg = await Subscribe.decode(stream.reader, this.#version);\n\t\t\tawait this.#publisher.runSubscribe(msg, stream);\n\t\t} else if (typ === StreamId.Track) {\n\t\t\tconst msg = await Track.decode(stream.reader, this.#version);\n\t\t\tawait this.#publisher.runTrackInfo(msg, stream);\n\t\t} else if (typ === StreamId.Probe) {\n\t\t\tawait this.#publisher.runProbe(stream);\n\t\t} else if (typ === StreamId.Goaway) {\n\t\t\tconst msg = await Goaway.decode(stream.reader, this.#version);\n\t\t\tconsole.info(\"received goaway:\", msg.uri);\n\t\t} else {\n\t\t\tthrow new Error(`unknown stream type: ${typ.toString()}`);\n\t\t}\n\t}\n\n\tasync #runUnis() {\n\t\tconst readers = new Readers(this.#quic);\n\n\t\tfor (;;) {\n\t\t\tconst stream = await readers.next();\n\t\t\tif (!stream) break;\n\n\t\t\tthis.#runUni(stream)\n\t\t\t\t.then(() => {\n\t\t\t\t\tstream.stop(new Error(\"cancel\"));\n\t\t\t\t})\n\t\t\t\t.catch((err: unknown) => {\n\t\t\t\t\tstream.stop(err);\n\t\t\t\t});\n\t\t}\n\t}\n\n\tasync #runUni(stream: Reader) {\n\t\tconst typ = await stream.u8();\n\t\tif (typ === DataId.Group) {\n\t\t\tconst msg = await Group.decode(stream);\n\t\t\tawait this.#subscriber.runGroup(msg, stream);\n\t\t} else if (typ === DataId.Setup) {\n\t\t\t// moq-lite-05+: read the peer's SETUP and discard it (the path, if any,\n\t\t\t// is handled at accept time by the server's transport binding).\n\t\t\tawait Setup.decode(stream, this.#version);\n\t\t} else {\n\t\t\tthrow new Error(`unknown stream type: ${typ.toString()}`);\n\t\t}\n\t}\n\n\t// moq-lite-05+: open a unidirectional Setup stream, send a single SETUP, and FIN.\n\t// The browser conveys its path via the WebTransport URL, so the SETUP is empty.\n\tasync #runSetup(): Promise<void> {\n\t\tconst writer = await Writer.open(this.#quic);\n\t\ttry {\n\t\t\tawait writer.u8(DataId.Setup);\n\t\t\tawait new Setup().encode(writer, this.#version);\n\t\t\twriter.close();\n\t\t} catch (err: unknown) {\n\t\t\twriter.reset(err);\n\t\t}\n\t}\n\n\tasync #runSendBandwidth(bandwidth: Bandwidth): Promise<void> {\n\t\tconst quic = this.#quic as unknown as {\n\t\t\tgetStats: () => Promise<{ estimatedSendRate: number | null }>;\n\t\t};\n\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tconst id = setInterval(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await quic.getStats();\n\t\t\t\t\tbandwidth.set(stats.estimatedSendRate ?? undefined);\n\t\t\t\t} catch {\n\t\t\t\t\tclearInterval(id);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t}, SEND_BW_POLL_INTERVAL);\n\n\t\t\tvoid this.closed.then(() => {\n\t\t\t\tclearInterval(id);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t}\n\n\tget closed(): Promise<void> {\n\t\treturn this.#quic.closed.then(() => undefined);\n\t}\n}\n"]}
|
package/lite/fetch.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import { Version } from "./version";
|
|
4
|
+
export declare class Fetch {
|
|
5
|
+
#private;
|
|
6
|
+
broadcast: Path.Valid;
|
|
7
|
+
track: string;
|
|
8
|
+
priority: number;
|
|
9
|
+
group: number;
|
|
10
|
+
constructor(broadcast: Path.Valid, track: string, priority: number, group: number);
|
|
11
|
+
encode(w: Writer, version: Version): Promise<void>;
|
|
12
|
+
static decode(r: Reader, version: Version): Promise<Fetch>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/lite/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAYvC,qBAAa,KAAK;;IACjB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,YAAY,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAKhF;IAiBK,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAG/D;CACD"}
|
package/lite/fetch.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* @ts-self-types="./fetch.d.ts" */
|
|
2
|
+
import * as Path from "../path.js";
|
|
3
|
+
import * as Message from "./message.js";
|
|
4
|
+
import { Version } from "./version.js";
|
|
5
|
+
function guardFetch(version) {
|
|
6
|
+
switch (version) {
|
|
7
|
+
case Version.DRAFT_01:
|
|
8
|
+
case Version.DRAFT_02:
|
|
9
|
+
throw new Error("fetch not supported for this version");
|
|
10
|
+
default:
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class Fetch {
|
|
15
|
+
broadcast;
|
|
16
|
+
track;
|
|
17
|
+
priority;
|
|
18
|
+
group;
|
|
19
|
+
constructor(broadcast, track, priority, group) {
|
|
20
|
+
this.broadcast = broadcast;
|
|
21
|
+
this.track = track;
|
|
22
|
+
this.priority = priority;
|
|
23
|
+
this.group = group;
|
|
24
|
+
}
|
|
25
|
+
async #encode(w) {
|
|
26
|
+
await w.string(Path.encode(this.broadcast));
|
|
27
|
+
await w.string(this.track);
|
|
28
|
+
await w.u8(this.priority);
|
|
29
|
+
await w.u53(this.group);
|
|
30
|
+
}
|
|
31
|
+
static async #decode(r) {
|
|
32
|
+
const broadcast = Path.decode(await r.string());
|
|
33
|
+
const track = await r.string();
|
|
34
|
+
const priority = await r.u8();
|
|
35
|
+
const group = await r.u53();
|
|
36
|
+
return new Fetch(broadcast, track, priority, group);
|
|
37
|
+
}
|
|
38
|
+
async encode(w, version) {
|
|
39
|
+
guardFetch(version);
|
|
40
|
+
return Message.encode(w, this.#encode.bind(this));
|
|
41
|
+
}
|
|
42
|
+
static async decode(r, version) {
|
|
43
|
+
guardFetch(version);
|
|
44
|
+
return Message.decode(r, Fetch.#decode);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/lite/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,SAAS,UAAU,CAAC,OAAgB;IACnC,QAAQ,OAAO,EAAE,CAAC;QACjB,KAAK,OAAO,CAAC,QAAQ,CAAC;QACtB,KAAK,OAAO,CAAC,QAAQ;YACpB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACzD;YACC,MAAM;IACR,CAAC;AACF,CAAC;AAED,MAAM,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AAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAS,EAAE,OAAgB;QAC9C,UAAU,CAAC,OAAO,CAAC,CAAC;QACpB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACD","sourcesContent":["import * as Path from \"../path.ts\";\nimport type { Reader, Writer } from \"../stream.ts\";\nimport * as Message from \"./message.ts\";\nimport { Version } from \"./version.ts\";\n\nfunction guardFetch(version: Version) {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\t\tthrow new Error(\"fetch not supported for this version\");\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n\nexport class Fetch {\n\tbroadcast: Path.Valid;\n\ttrack: string;\n\tpriority: number;\n\tgroup: number;\n\n\tconstructor(broadcast: Path.Valid, track: string, priority: number, group: number) {\n\t\tthis.broadcast = broadcast;\n\t\tthis.track = track;\n\t\tthis.priority = priority;\n\t\tthis.group = group;\n\t}\n\n\tasync #encode(w: Writer) {\n\t\tawait w.string(Path.encode(this.broadcast));\n\t\tawait w.string(this.track);\n\t\tawait w.u8(this.priority);\n\t\tawait w.u53(this.group);\n\t}\n\n\tstatic async #decode(r: Reader): Promise<Fetch> {\n\t\tconst broadcast = Path.decode(await r.string());\n\t\tconst track = await r.string();\n\t\tconst priority = await r.u8();\n\t\tconst group = await r.u53();\n\t\treturn new Fetch(broadcast, track, priority, group);\n\t}\n\n\tasync encode(w: Writer, version: Version): Promise<void> {\n\t\tguardFetch(version);\n\t\treturn Message.encode(w, this.#encode.bind(this));\n\t}\n\n\tstatic async decode(r: Reader, version: Version): Promise<Fetch> {\n\t\tguardFetch(version);\n\t\treturn Message.decode(r, Fetch.#decode);\n\t}\n}\n"]}
|
package/lite/goaway.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
import { Version } from "./version";
|
|
3
|
+
export declare class Goaway {
|
|
4
|
+
#private;
|
|
5
|
+
uri: string;
|
|
6
|
+
constructor(uri: string);
|
|
7
|
+
encode(w: Writer, version: Version): Promise<void>;
|
|
8
|
+
static decode(r: Reader, version: Version): Promise<Goaway>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=goaway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goaway.d.ts","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAgBvC,qBAAa,MAAM;;IAClB,GAAG,EAAE,MAAM,CAAC;IAEZ,YAAY,GAAG,EAAE,MAAM,EAEtB;IAUK,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAGhE;CACD"}
|
package/lite/goaway.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* @ts-self-types="./goaway.d.ts" */
|
|
2
|
+
import * as Message from "./message.js";
|
|
3
|
+
import { Version } from "./version.js";
|
|
4
|
+
function guardGoaway(version) {
|
|
5
|
+
switch (version) {
|
|
6
|
+
case Version.DRAFT_01:
|
|
7
|
+
case Version.DRAFT_02:
|
|
8
|
+
case Version.DRAFT_03:
|
|
9
|
+
throw new Error("goaway not supported for this version");
|
|
10
|
+
default:
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/// Sent to gracefully shut down a session and optionally redirect to a new URI.
|
|
15
|
+
///
|
|
16
|
+
/// Lite04+ only.
|
|
17
|
+
export class Goaway {
|
|
18
|
+
uri;
|
|
19
|
+
constructor(uri) {
|
|
20
|
+
this.uri = uri;
|
|
21
|
+
}
|
|
22
|
+
async #encode(w) {
|
|
23
|
+
await w.string(this.uri);
|
|
24
|
+
}
|
|
25
|
+
static async #decode(r) {
|
|
26
|
+
return new Goaway(await r.string());
|
|
27
|
+
}
|
|
28
|
+
async encode(w, version) {
|
|
29
|
+
guardGoaway(version);
|
|
30
|
+
return Message.encode(w, this.#encode.bind(this));
|
|
31
|
+
}
|
|
32
|
+
static async decode(r, version) {
|
|
33
|
+
guardGoaway(version);
|
|
34
|
+
return Message.decode(r, Goaway.#decode);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=goaway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goaway.js","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,SAAS,WAAW,CAAC,OAAgB;IACpC,QAAQ,OAAO,EAAE,CAAC;QACjB,KAAK,OAAO,CAAC,QAAQ,CAAC;QACtB,KAAK,OAAO,CAAC,QAAQ,CAAC;QACtB,KAAK,OAAO,CAAC,QAAQ;YACpB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1D;YACC,MAAM;IACR,CAAC;AACF,CAAC;AAED,gFAAgF;AAChF,GAAG;AACH,iBAAiB;AACjB,MAAM,OAAO,MAAM;IAClB,GAAG,CAAS;IAEZ,YAAY,GAAW;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,CAAS;QACtB,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAS;QAC7B,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,CAAS,EAAE,OAAgB;QACvC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAS,EAAE,OAAgB;QAC9C,WAAW,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Reader, Writer } from \"../stream.ts\";\nimport * as Message from \"./message.ts\";\nimport { Version } from \"./version.ts\";\n\nfunction guardGoaway(version: Version) {\n\tswitch (version) {\n\t\tcase Version.DRAFT_01:\n\t\tcase Version.DRAFT_02:\n\t\tcase Version.DRAFT_03:\n\t\t\tthrow new Error(\"goaway not supported for this version\");\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}\n\n/// Sent to gracefully shut down a session and optionally redirect to a new URI.\n///\n/// Lite04+ only.\nexport class Goaway {\n\turi: string;\n\n\tconstructor(uri: string) {\n\t\tthis.uri = uri;\n\t}\n\n\tasync #encode(w: Writer) {\n\t\tawait w.string(this.uri);\n\t}\n\n\tstatic async #decode(r: Reader): Promise<Goaway> {\n\t\treturn new Goaway(await r.string());\n\t}\n\n\tasync encode(w: Writer, version: Version): Promise<void> {\n\t\tguardGoaway(version);\n\t\treturn Message.encode(w, this.#encode.bind(this));\n\t}\n\n\tstatic async decode(r: Reader, version: Version): Promise<Goaway> {\n\t\tguardGoaway(version);\n\t\treturn Message.decode(r, Goaway.#decode);\n\t}\n}\n"]}
|
package/lite/group.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
export declare class Group {
|
|
3
|
+
#private;
|
|
4
|
+
subscribe: bigint;
|
|
5
|
+
sequence: number;
|
|
6
|
+
constructor(subscribe: bigint, sequence: number);
|
|
7
|
+
encode(w: Writer): Promise<void>;
|
|
8
|
+
static decode(r: Reader): Promise<Group>;
|
|
9
|
+
static decodeMaybe(r: Reader): Promise<Group | undefined>;
|
|
10
|
+
}
|
|
11
|
+
export declare class Frame {
|
|
12
|
+
#private;
|
|
13
|
+
payload: Uint8Array;
|
|
14
|
+
constructor(payload: Uint8Array);
|
|
15
|
+
encode(w: Writer): Promise<void>;
|
|
16
|
+
static decode(r: Reader): Promise<Frame>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/lite/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGnD,qBAAa,KAAK;;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAG9C;IAWK,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErC;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAE7C;IAED,OAAa,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAE9D;CACD;AAED,qBAAa,KAAK;;IACjB,OAAO,EAAE,UAAU,CAAC;IAEpB,YAAY,OAAO,EAAE,UAAU,EAE9B;IAWK,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErC;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAE7C;CACD"}
|
package/lite/group.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* @ts-self-types="./group.d.ts" */
|
|
2
|
+
import * as Message from "./message.js";
|
|
3
|
+
export class Group {
|
|
4
|
+
subscribe;
|
|
5
|
+
sequence;
|
|
6
|
+
constructor(subscribe, sequence) {
|
|
7
|
+
this.subscribe = subscribe;
|
|
8
|
+
this.sequence = sequence;
|
|
9
|
+
}
|
|
10
|
+
async #encode(w) {
|
|
11
|
+
await w.u62(this.subscribe);
|
|
12
|
+
await w.u53(this.sequence);
|
|
13
|
+
}
|
|
14
|
+
static async #decode(r) {
|
|
15
|
+
return new Group(await r.u62(), await r.u53());
|
|
16
|
+
}
|
|
17
|
+
async encode(w) {
|
|
18
|
+
return Message.encode(w, this.#encode.bind(this));
|
|
19
|
+
}
|
|
20
|
+
static async decode(r) {
|
|
21
|
+
return Message.decode(r, Group.#decode);
|
|
22
|
+
}
|
|
23
|
+
static async decodeMaybe(r) {
|
|
24
|
+
return Message.decodeMaybe(r, Group.#decode);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class Frame {
|
|
28
|
+
payload;
|
|
29
|
+
constructor(payload) {
|
|
30
|
+
this.payload = payload;
|
|
31
|
+
}
|
|
32
|
+
async #encode(w) {
|
|
33
|
+
await w.write(this.payload);
|
|
34
|
+
}
|
|
35
|
+
static async #decode(r) {
|
|
36
|
+
const payload = await r.readAll();
|
|
37
|
+
return new Frame(payload);
|
|
38
|
+
}
|
|
39
|
+
async encode(w) {
|
|
40
|
+
return Message.encode(w, this.#encode.bind(this));
|
|
41
|
+
}
|
|
42
|
+
static async decode(r) {
|
|
43
|
+
return Message.decode(r, Frame.#decode);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAS;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAClC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,CAAS;QACrB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAS;QAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACD","sourcesContent":["import type { Reader, Writer } from \"../stream.ts\";\nimport * as Message from \"./message.ts\";\n\nexport class Group {\n\tsubscribe: bigint;\n\tsequence: number;\n\n\tconstructor(subscribe: bigint, sequence: number) {\n\t\tthis.subscribe = subscribe;\n\t\tthis.sequence = sequence;\n\t}\n\n\tasync #encode(w: Writer) {\n\t\tawait w.u62(this.subscribe);\n\t\tawait w.u53(this.sequence);\n\t}\n\n\tstatic async #decode(r: Reader): Promise<Group> {\n\t\treturn new Group(await r.u62(), await r.u53());\n\t}\n\n\tasync encode(w: Writer): Promise<void> {\n\t\treturn Message.encode(w, this.#encode.bind(this));\n\t}\n\n\tstatic async decode(r: Reader): Promise<Group> {\n\t\treturn Message.decode(r, Group.#decode);\n\t}\n\n\tstatic async decodeMaybe(r: Reader): Promise<Group | undefined> {\n\t\treturn Message.decodeMaybe(r, Group.#decode);\n\t}\n}\n\nexport class Frame {\n\tpayload: Uint8Array;\n\n\tconstructor(payload: Uint8Array) {\n\t\tthis.payload = payload;\n\t}\n\n\tasync #encode(w: Writer) {\n\t\tawait w.write(this.payload);\n\t}\n\n\tstatic async #decode(r: Reader): Promise<Frame> {\n\t\tconst payload = await r.readAll();\n\t\treturn new Frame(payload);\n\t}\n\n\tasync encode(w: Writer): Promise<void> {\n\t\treturn Message.encode(w, this.#encode.bind(this));\n\t}\n\n\tstatic async decode(r: Reader): Promise<Frame> {\n\t\treturn Message.decode(r, Frame.#decode);\n\t}\n}\n"]}
|
package/lite/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./announce";
|
|
2
|
+
export * from "./connection";
|
|
3
|
+
export * from "./fetch";
|
|
4
|
+
export * from "./goaway";
|
|
5
|
+
export * from "./group";
|
|
6
|
+
export * from "./probe";
|
|
7
|
+
export * from "./session";
|
|
8
|
+
export * from "./stream";
|
|
9
|
+
export * from "./subscribe";
|
|
10
|
+
export * from "./version";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lite/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
package/lite/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* @ts-self-types="./index.d.ts" */
|
|
2
|
+
export * from "./announce.js";
|
|
3
|
+
export * from "./connection.js";
|
|
4
|
+
export * from "./fetch.js";
|
|
5
|
+
export * from "./goaway.js";
|
|
6
|
+
export * from "./group.js";
|
|
7
|
+
export * from "./probe.js";
|
|
8
|
+
export * from "./session.js";
|
|
9
|
+
export * from "./stream.js";
|
|
10
|
+
export * from "./subscribe.js";
|
|
11
|
+
export * from "./version.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lite/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC","sourcesContent":["export * from \"./announce.ts\";\nexport * from \"./connection.ts\";\nexport * from \"./fetch.ts\";\nexport * from \"./goaway.ts\";\nexport * from \"./group.ts\";\nexport * from \"./probe.ts\";\nexport * from \"./session.ts\";\nexport * from \"./stream.ts\";\nexport * from \"./subscribe.ts\";\nexport * from \"./version.ts\";\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Reader, Writer } from "../stream";
|
|
2
|
+
export declare function encode(writer: Writer, f: (w: Writer) => Promise<void>): Promise<void>;
|
|
3
|
+
export declare function decode<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T>;
|
|
4
|
+
export declare function decodeMaybe<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T | undefined>;
|
|
5
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/lite/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,iBAqC3E;AAGD,wBAAsB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAaxF;AAED,wBAAsB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAGzG"}
|
package/lite/message.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* @ts-self-types="./message.d.ts" */
|
|
2
|
+
import { Reader, Writer } from "../stream.js";
|
|
3
|
+
export async function encode(writer, f) {
|
|
4
|
+
let scratch = new Uint8Array();
|
|
5
|
+
const temp = new Writer(new WritableStream({
|
|
6
|
+
write(chunk) {
|
|
7
|
+
const needed = scratch.byteLength + chunk.byteLength;
|
|
8
|
+
if (needed > scratch.buffer.byteLength) {
|
|
9
|
+
// Resize the buffer to the needed size.
|
|
10
|
+
const capacity = Math.max(needed, scratch.buffer.byteLength * 2);
|
|
11
|
+
const newBuffer = new ArrayBuffer(capacity);
|
|
12
|
+
const newScratch = new Uint8Array(newBuffer, 0, needed);
|
|
13
|
+
// Copy the old data into the new buffer.
|
|
14
|
+
newScratch.set(scratch);
|
|
15
|
+
// Copy the new chunk into the new buffer.
|
|
16
|
+
newScratch.set(chunk, scratch.byteLength);
|
|
17
|
+
scratch = newScratch;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// Copy chunk data into buffer
|
|
21
|
+
scratch = new Uint8Array(scratch.buffer, 0, needed);
|
|
22
|
+
scratch.set(chunk, needed - chunk.byteLength);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
await f(temp);
|
|
27
|
+
temp.close();
|
|
28
|
+
await temp.closed;
|
|
29
|
+
await writer.u53(scratch.byteLength);
|
|
30
|
+
if (scratch.byteLength > 0) {
|
|
31
|
+
await writer.write(scratch);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Reads a message with a varint size prefix.
|
|
35
|
+
export async function decode(reader, f) {
|
|
36
|
+
const size = await reader.u53();
|
|
37
|
+
const data = await reader.read(size);
|
|
38
|
+
const limit = new Reader(undefined, data);
|
|
39
|
+
const msg = await f(limit);
|
|
40
|
+
// Check that we consumed exactly the right number of bytes
|
|
41
|
+
if (!(await limit.done())) {
|
|
42
|
+
throw new Error("Message decoding consumed too few bytes");
|
|
43
|
+
}
|
|
44
|
+
return msg;
|
|
45
|
+
}
|
|
46
|
+
export async function decodeMaybe(reader, f) {
|
|
47
|
+
if (await reader.done())
|
|
48
|
+
return;
|
|
49
|
+
return await decode(reader, f);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/lite/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,MAAc,EAAE,CAA+B;IAC3E,IAAI,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;IAE/B,MAAM,IAAI,GAAG,IAAI,MAAM,CACtB,IAAI,cAAc,CAAC;QAClB,KAAK,CAAC,KAAiB;YACtB,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YACrD,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;gBACxC,wCAAwC;gBACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;gBACjE,MAAM,SAAS,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC,EA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AI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAI,MAAc,EAAE,CAA4B;IAChF,IAAI,MAAM,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO;IAChC,OAAO,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { Reader, Writer } from \"../stream.ts\";\n\nexport async function encode(writer: Writer, f: (w: Writer) => Promise<void>) {\n\tlet scratch = new Uint8Array();\n\n\tconst temp = new Writer(\n\t\tnew WritableStream({\n\t\t\twrite(chunk: Uint8Array) {\n\t\t\t\tconst needed = scratch.byteLength + chunk.byteLength;\n\t\t\t\tif (needed > scratch.buffer.byteLength) {\n\t\t\t\t\t// Resize the buffer to the needed size.\n\t\t\t\t\tconst capacity = Math.max(needed, scratch.buffer.byteLength * 2);\n\t\t\t\t\tconst newBuffer = new ArrayBuffer(capacity);\n\t\t\t\t\tconst newScratch = new Uint8Array(newBuffer, 0, needed);\n\n\t\t\t\t\t// Copy the old data into the new buffer.\n\t\t\t\t\tnewScratch.set(scratch);\n\n\t\t\t\t\t// Copy the new chunk into the new buffer.\n\t\t\t\t\tnewScratch.set(chunk, scratch.byteLength);\n\n\t\t\t\t\tscratch = newScratch;\n\t\t\t\t} else {\n\t\t\t\t\t// Copy chunk data into buffer\n\t\t\t\t\tscratch = new Uint8Array(scratch.buffer, 0, needed);\n\t\t\t\t\tscratch.set(chunk, needed - chunk.byteLength);\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t);\n\n\tawait f(temp);\n\ttemp.close();\n\tawait temp.closed;\n\n\tawait writer.u53(scratch.byteLength);\n\tif (scratch.byteLength > 0) {\n\t\tawait writer.write(scratch);\n\t}\n}\n\n// Reads a message with a varint size prefix.\nexport async function decode<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T> {\n\tconst size = await reader.u53();\n\tconst data = await reader.read(size);\n\n\tconst limit = new Reader(undefined, data);\n\tconst msg = await f(limit);\n\n\t// Check that we consumed exactly the right number of bytes\n\tif (!(await limit.done())) {\n\t\tthrow new Error(\"Message decoding consumed too few bytes\");\n\t}\n\n\treturn msg;\n}\n\nexport async function decodeMaybe<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T | undefined> {\n\tif (await reader.done()) return;\n\treturn await decode(reader, f);\n}\n"]}
|
package/lite/origin.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
/**
|
|
3
|
+
* A relay origin id, encoded as a 62-bit varint on the wire.
|
|
4
|
+
*
|
|
5
|
+
* The {@link OriginSchema} validates any incoming value and brands it so the
|
|
6
|
+
* type system enforces "only validated origins flow into hop lists." Internal
|
|
7
|
+
* code that synthesizes an id (e.g. {@link randomOrigin}) uses
|
|
8
|
+
* `OriginSchema.parse(...)` to produce a branded value from the raw bigint.
|
|
9
|
+
*/
|
|
10
|
+
export declare const OriginSchema: z.core.$ZodBranded<z.ZodMiniBigInt<bigint>, "Origin", "out">;
|
|
11
|
+
export type Origin = z.infer<typeof OriginSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a fresh origin with a random non-zero id.
|
|
14
|
+
*
|
|
15
|
+
* `crypto.getRandomValues` is overkill for best-effort loop detection, but
|
|
16
|
+
* used for slightly better distribution than `Math.random` at negligible cost.
|
|
17
|
+
*
|
|
18
|
+
* TEMPORARY: the wire format allows 62 bits, but older `@moq/lite` JS clients
|
|
19
|
+
* decode `AnnounceInterest.exclude_hop` as a u53 (number) and throw on anything
|
|
20
|
+
* > 2^53-1. To keep those clients alive against fresh peers, we cap the random
|
|
21
|
+
* id at 53 bits. Restore to 62 bits once the u62 fix has propagated to deployed
|
|
22
|
+
* bundles. Mirrors `Origin::random` in rs/moq-net.
|
|
23
|
+
*/
|
|
24
|
+
export declare function randomOrigin(): Origin;
|
|
25
|
+
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../src/lite/origin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,8DAGR,CAAC;AAElB,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAOrC"}
|