@mertushka/webrtc-node 0.1.0-alpha.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/CMakeLists.txt +143 -0
- package/LICENSE +373 -0
- package/README.md +166 -0
- package/docs/README.md +14 -0
- package/docs/architecture.md +38 -0
- package/docs/conformance.md +53 -0
- package/docs/development.md +161 -0
- package/docs/divergences.md +230 -0
- package/examples/datachannel.js +57 -0
- package/index.d.ts +340 -0
- package/lib/index.js +4139 -0
- package/lib/load-native.js +42 -0
- package/package.json +94 -0
- package/scripts/check-api-surface.js +149 -0
- package/scripts/check-ci-evidence.js +124 -0
- package/scripts/check-native-integration.js +124 -0
- package/scripts/check-package-artifact.js +91 -0
- package/scripts/check-prebuilds.js +31 -0
- package/scripts/check-wpt-results.js +117 -0
- package/scripts/check-wpt-selection.js +72 -0
- package/scripts/ensure-wpt.js +118 -0
- package/scripts/install-native.js +116 -0
- package/scripts/package-prebuild.js +69 -0
- package/scripts/print-wpt-manifest.js +7 -0
- package/scripts/run-docker-linux-ci.ps1 +73 -0
- package/scripts/run-docker-linux-ci.sh +97 -0
- package/scripts/run-wpt-smoke.js +32 -0
- package/scripts/run-wpt-subset.js +1193 -0
- package/scripts/write-ci-evidence.js +118 -0
- package/scripts/write-wpt-report.js +143 -0
- package/src/native/addon.cc +1202 -0
- package/wpt-manifest.json +129 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
export type RTCDataChannelState = "connecting" | "open" | "closing" | "closed";
|
|
2
|
+
export type RTCSdpType = "offer" | "answer" | "pranswer" | "rollback";
|
|
3
|
+
export type RTCSctpTransportState = "connecting" | "connected" | "closed";
|
|
4
|
+
export type RTCDtlsTransportState = "new" | "connecting" | "connected" | "closed" | "failed";
|
|
5
|
+
export type RTCIceRole = "unknown" | "controlling" | "controlled";
|
|
6
|
+
export type RTCIceComponent = "rtp" | "rtcp";
|
|
7
|
+
export type RTCIceTransportState =
|
|
8
|
+
| "new"
|
|
9
|
+
| "checking"
|
|
10
|
+
| "connected"
|
|
11
|
+
| "completed"
|
|
12
|
+
| "disconnected"
|
|
13
|
+
| "failed"
|
|
14
|
+
| "closed";
|
|
15
|
+
export type RTCIceGathererState = "new" | "gathering" | "complete";
|
|
16
|
+
|
|
17
|
+
export interface EventInit {
|
|
18
|
+
bubbles?: boolean;
|
|
19
|
+
cancelable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class Event {
|
|
23
|
+
constructor(type: string, init?: EventInit);
|
|
24
|
+
readonly type: string;
|
|
25
|
+
readonly bubbles: boolean;
|
|
26
|
+
readonly cancelable: boolean;
|
|
27
|
+
readonly defaultPrevented: boolean;
|
|
28
|
+
readonly target: EventTarget | null;
|
|
29
|
+
readonly currentTarget: EventTarget | null;
|
|
30
|
+
preventDefault(): void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MessageEventInit<T = unknown> extends EventInit {
|
|
34
|
+
data?: T;
|
|
35
|
+
origin?: string;
|
|
36
|
+
lastEventId?: string;
|
|
37
|
+
source?: unknown;
|
|
38
|
+
ports?: unknown[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class MessageEvent<T = unknown> extends Event {
|
|
42
|
+
constructor(type: string, init?: MessageEventInit<T>);
|
|
43
|
+
readonly data: T;
|
|
44
|
+
readonly origin: string;
|
|
45
|
+
readonly lastEventId: string;
|
|
46
|
+
readonly source: unknown | null;
|
|
47
|
+
readonly ports: readonly unknown[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface EventListenerObject<E extends Event = Event> {
|
|
51
|
+
handleEvent(event: E): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type EventListener<E extends Event = Event> = ((event: E) => void) | EventListenerObject<E>;
|
|
55
|
+
|
|
56
|
+
export interface AddEventListenerOptions {
|
|
57
|
+
once?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class EventTarget {
|
|
61
|
+
addEventListener(
|
|
62
|
+
type: string,
|
|
63
|
+
callback: EventListener | null,
|
|
64
|
+
options?: AddEventListenerOptions | boolean,
|
|
65
|
+
): void;
|
|
66
|
+
removeEventListener(type: string, callback: EventListener | null): void;
|
|
67
|
+
dispatchEvent(event: Event): boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface RTCConfiguration {
|
|
71
|
+
iceServers?: RTCIceServer[];
|
|
72
|
+
iceTransportPolicy?: "all" | "relay";
|
|
73
|
+
bundlePolicy?: "balanced" | "max-compat" | "max-bundle";
|
|
74
|
+
rtcpMuxPolicy?: "require";
|
|
75
|
+
iceCandidatePoolSize?: number;
|
|
76
|
+
certificates?: RTCCertificate[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface RTCIceServer {
|
|
80
|
+
urls: string | string[];
|
|
81
|
+
username?: string;
|
|
82
|
+
credential?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface RTCDataChannelInit {
|
|
86
|
+
ordered?: boolean;
|
|
87
|
+
maxPacketLifeTime?: number;
|
|
88
|
+
maxRetransmits?: number;
|
|
89
|
+
protocol?: string;
|
|
90
|
+
negotiated?: boolean;
|
|
91
|
+
id?: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface RTCSessionDescriptionInit {
|
|
95
|
+
type: RTCSdpType;
|
|
96
|
+
sdp?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface RTCOfferOptions {
|
|
100
|
+
iceRestart?: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface RTCIceCandidateInit {
|
|
104
|
+
candidate?: string;
|
|
105
|
+
sdpMid?: string | null;
|
|
106
|
+
sdpMLineIndex?: number | null;
|
|
107
|
+
usernameFragment?: string | null;
|
|
108
|
+
relayProtocol?: string | null;
|
|
109
|
+
url?: string | null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface RTCIceParameters {
|
|
113
|
+
usernameFragment: string;
|
|
114
|
+
password: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export class RTCIceCandidatePair {
|
|
118
|
+
private constructor();
|
|
119
|
+
readonly local: RTCIceCandidate;
|
|
120
|
+
readonly remote: RTCIceCandidate;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface RTCCertificateKeygenAlgorithm {
|
|
124
|
+
name: string;
|
|
125
|
+
expires?: number;
|
|
126
|
+
hash?: string | { name: string };
|
|
127
|
+
modulusLength?: number;
|
|
128
|
+
publicExponent?: Uint8Array;
|
|
129
|
+
namedCurve?: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class RTCSessionDescription {
|
|
133
|
+
constructor(init: RTCSessionDescriptionInit);
|
|
134
|
+
readonly type: RTCSdpType;
|
|
135
|
+
readonly sdp: string;
|
|
136
|
+
toJSON(): RTCSessionDescriptionInit;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export class RTCIceCandidate {
|
|
140
|
+
constructor(init?: RTCIceCandidateInit);
|
|
141
|
+
readonly candidate: string;
|
|
142
|
+
readonly sdpMid: string | null;
|
|
143
|
+
readonly sdpMLineIndex: number | null;
|
|
144
|
+
readonly usernameFragment: string | null;
|
|
145
|
+
readonly foundation: string | null;
|
|
146
|
+
readonly component: "rtp" | "rtcp" | null;
|
|
147
|
+
readonly priority: number | null;
|
|
148
|
+
readonly address: string | null;
|
|
149
|
+
readonly protocol: string | null;
|
|
150
|
+
readonly port: number | null;
|
|
151
|
+
readonly type: string | null;
|
|
152
|
+
readonly tcpType: string | null;
|
|
153
|
+
readonly relatedAddress: string | null;
|
|
154
|
+
readonly relatedPort: number | null;
|
|
155
|
+
readonly relayProtocol: string | null;
|
|
156
|
+
readonly url: string | null;
|
|
157
|
+
toJSON(): RTCIceCandidateInit;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface RTCDtlsFingerprint {
|
|
161
|
+
algorithm: string;
|
|
162
|
+
value: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class RTCCertificate {
|
|
166
|
+
readonly expires: number;
|
|
167
|
+
getFingerprints(): RTCDtlsFingerprint[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export class RTCDataChannel extends EventTarget {
|
|
171
|
+
readonly label: string;
|
|
172
|
+
readonly ordered: boolean;
|
|
173
|
+
readonly maxPacketLifeTime: number | null;
|
|
174
|
+
readonly maxRetransmits: number | null;
|
|
175
|
+
readonly protocol: string;
|
|
176
|
+
readonly negotiated: boolean;
|
|
177
|
+
readonly id: number | null;
|
|
178
|
+
readonly readyState: RTCDataChannelState;
|
|
179
|
+
readonly bufferedAmount: number;
|
|
180
|
+
bufferedAmountLowThreshold: number;
|
|
181
|
+
binaryType: "arraybuffer" | "blob";
|
|
182
|
+
onopen: ((event: Event) => void) | null;
|
|
183
|
+
onmessage: ((event: MessageEvent) => void) | null;
|
|
184
|
+
onclose: ((event: Event) => void) | null;
|
|
185
|
+
onerror: ((event: RTCErrorEvent) => void) | null;
|
|
186
|
+
onclosing: ((event: Event) => void) | null;
|
|
187
|
+
onbufferedamountlow: ((event: Event) => void) | null;
|
|
188
|
+
send(data: string | ArrayBuffer | ArrayBufferView | Blob): void;
|
|
189
|
+
close(): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export class RTCDataChannelEvent extends Event {
|
|
193
|
+
constructor(type: string, init: EventInit & { channel: RTCDataChannel });
|
|
194
|
+
readonly channel: RTCDataChannel;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export class RTCPeerConnectionIceEvent extends Event {
|
|
198
|
+
constructor(
|
|
199
|
+
type: string,
|
|
200
|
+
init?: EventInit & { candidate?: RTCIceCandidate | null; url?: string | null },
|
|
201
|
+
);
|
|
202
|
+
readonly candidate: RTCIceCandidate | null;
|
|
203
|
+
readonly url: string | null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export class RTCPeerConnectionIceErrorEvent extends Event {
|
|
207
|
+
constructor(
|
|
208
|
+
type: string,
|
|
209
|
+
init?: EventInit & {
|
|
210
|
+
address?: string | null;
|
|
211
|
+
port?: number | null;
|
|
212
|
+
url?: string;
|
|
213
|
+
errorCode?: number;
|
|
214
|
+
errorText?: string;
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
readonly address: string | null;
|
|
218
|
+
readonly port: number | null;
|
|
219
|
+
readonly url: string;
|
|
220
|
+
readonly errorCode: number;
|
|
221
|
+
readonly errorText: string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export class RTCError extends Error {
|
|
225
|
+
constructor(
|
|
226
|
+
init: {
|
|
227
|
+
errorDetail: string;
|
|
228
|
+
sdpLineNumber?: number | null;
|
|
229
|
+
sctpCauseCode?: number | null;
|
|
230
|
+
receivedAlert?: number | null;
|
|
231
|
+
sentAlert?: number | null;
|
|
232
|
+
},
|
|
233
|
+
message?: string,
|
|
234
|
+
);
|
|
235
|
+
readonly code: 0;
|
|
236
|
+
readonly errorDetail: string;
|
|
237
|
+
readonly sdpLineNumber: number | null;
|
|
238
|
+
readonly sctpCauseCode: number | null;
|
|
239
|
+
readonly receivedAlert: number | null;
|
|
240
|
+
readonly sentAlert: number | null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export class RTCErrorEvent extends Event {
|
|
244
|
+
constructor(type: string, init?: EventInit & { error?: RTCError });
|
|
245
|
+
readonly error: RTCError | undefined;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export class RTCDtlsTransport extends EventTarget {
|
|
249
|
+
private constructor();
|
|
250
|
+
readonly state: RTCDtlsTransportState;
|
|
251
|
+
readonly iceTransport: RTCIceTransport;
|
|
252
|
+
onstatechange: ((event: Event) => void) | null;
|
|
253
|
+
onerror: ((event: Event) => void) | null;
|
|
254
|
+
getRemoteCertificates(): ArrayBuffer[];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export class RTCIceTransport extends EventTarget {
|
|
258
|
+
private constructor();
|
|
259
|
+
readonly role: RTCIceRole;
|
|
260
|
+
readonly component: RTCIceComponent;
|
|
261
|
+
readonly state: RTCIceTransportState;
|
|
262
|
+
readonly gatheringState: RTCIceGathererState;
|
|
263
|
+
onstatechange: ((event: Event) => void) | null;
|
|
264
|
+
ongatheringstatechange: ((event: Event) => void) | null;
|
|
265
|
+
onselectedcandidatepairchange: ((event: Event) => void) | null;
|
|
266
|
+
getLocalCandidates(): RTCIceCandidate[];
|
|
267
|
+
getRemoteCandidates(): RTCIceCandidate[];
|
|
268
|
+
getSelectedCandidatePair(): RTCIceCandidatePair | null;
|
|
269
|
+
getLocalParameters(): RTCIceParameters | null;
|
|
270
|
+
getRemoteParameters(): RTCIceParameters | null;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export class RTCSctpTransport extends EventTarget {
|
|
274
|
+
private constructor();
|
|
275
|
+
readonly transport: RTCDtlsTransport;
|
|
276
|
+
readonly state: RTCSctpTransportState;
|
|
277
|
+
readonly maxMessageSize: number | null;
|
|
278
|
+
readonly maxChannels: number | null;
|
|
279
|
+
onstatechange: ((event: Event) => void) | null;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export class RTCPeerConnection extends EventTarget {
|
|
283
|
+
static generateCertificate(
|
|
284
|
+
algorithm: string | RTCCertificateKeygenAlgorithm,
|
|
285
|
+
): Promise<RTCCertificate>;
|
|
286
|
+
constructor(configuration?: RTCConfiguration);
|
|
287
|
+
readonly localDescription: RTCSessionDescription | null;
|
|
288
|
+
readonly currentLocalDescription: RTCSessionDescription | null;
|
|
289
|
+
readonly pendingLocalDescription: RTCSessionDescription | null;
|
|
290
|
+
readonly remoteDescription: RTCSessionDescription | null;
|
|
291
|
+
readonly currentRemoteDescription: RTCSessionDescription | null;
|
|
292
|
+
readonly pendingRemoteDescription: RTCSessionDescription | null;
|
|
293
|
+
readonly signalingState:
|
|
294
|
+
| "stable"
|
|
295
|
+
| "have-local-offer"
|
|
296
|
+
| "have-remote-offer"
|
|
297
|
+
| "have-local-pranswer"
|
|
298
|
+
| "have-remote-pranswer"
|
|
299
|
+
| "closed";
|
|
300
|
+
readonly iceGatheringState: "new" | "gathering" | "complete";
|
|
301
|
+
readonly iceConnectionState:
|
|
302
|
+
| "new"
|
|
303
|
+
| "checking"
|
|
304
|
+
| "connected"
|
|
305
|
+
| "completed"
|
|
306
|
+
| "failed"
|
|
307
|
+
| "disconnected"
|
|
308
|
+
| "closed";
|
|
309
|
+
readonly connectionState:
|
|
310
|
+
| "new"
|
|
311
|
+
| "connecting"
|
|
312
|
+
| "connected"
|
|
313
|
+
| "disconnected"
|
|
314
|
+
| "failed"
|
|
315
|
+
| "closed";
|
|
316
|
+
readonly canTrickleIceCandidates: boolean | null;
|
|
317
|
+
readonly sctp: RTCSctpTransport | null;
|
|
318
|
+
ondatachannel: ((event: RTCDataChannelEvent) => void) | null;
|
|
319
|
+
onicecandidate: ((event: RTCPeerConnectionIceEvent) => void) | null;
|
|
320
|
+
onicecandidateerror: ((event: RTCPeerConnectionIceErrorEvent) => void) | null;
|
|
321
|
+
onicegatheringstatechange: ((event: Event) => void) | null;
|
|
322
|
+
oniceconnectionstatechange: ((event: Event) => void) | null;
|
|
323
|
+
onconnectionstatechange: ((event: Event) => void) | null;
|
|
324
|
+
onsignalingstatechange: ((event: Event) => void) | null;
|
|
325
|
+
onnegotiationneeded: ((event: Event) => void) | null;
|
|
326
|
+
createDataChannel(label: string, init?: RTCDataChannelInit): RTCDataChannel;
|
|
327
|
+
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
|
|
328
|
+
createAnswer(): Promise<RTCSessionDescriptionInit>;
|
|
329
|
+
setLocalDescription(description?: RTCSessionDescriptionInit): Promise<void>;
|
|
330
|
+
setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>;
|
|
331
|
+
addIceCandidate(candidate?: RTCIceCandidateInit | RTCIceCandidate | null): Promise<void>;
|
|
332
|
+
getConfiguration(): RTCConfiguration;
|
|
333
|
+
setConfiguration(configuration?: RTCConfiguration): void;
|
|
334
|
+
restartIce(): void;
|
|
335
|
+
close(): void;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export namespace nonstandard {
|
|
339
|
+
const native: unknown;
|
|
340
|
+
}
|