werift 0.27.0 → 0.28.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 +119 -8
- package/lib/common/src/event.d.ts +26 -0
- package/lib/common/src/event.js +87 -2
- package/lib/common/src/event.js.map +1 -1
- package/lib/common/src/network.d.ts +6 -1
- package/lib/common/src/network.js +8 -2
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/transport.d.ts +12 -5
- package/lib/common/src/transport.js +3 -2
- package/lib/common/src/transport.js.map +1 -1
- package/lib/dtls/src/alert.d.ts +49 -0
- package/lib/dtls/src/alert.js +103 -0
- package/lib/dtls/src/alert.js.map +1 -0
- package/lib/dtls/src/client.js +15 -1
- package/lib/dtls/src/client.js.map +1 -1
- package/lib/dtls/src/context/dtls.d.ts +2 -0
- package/lib/dtls/src/context/dtls.js +7 -0
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +17 -1
- package/lib/dtls/src/context/transport.js +38 -2
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +4 -1
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +5 -0
- package/lib/dtls/src/flight/flight.js +10 -1
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +4 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/index.d.ts +3 -1
- package/lib/dtls/src/index.js +10 -1
- package/lib/dtls/src/index.js.map +1 -1
- package/lib/dtls/src/record/const.d.ts +9 -0
- package/lib/dtls/src/record/const.js +9 -1
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/receive.d.ts +6 -0
- package/lib/dtls/src/record/receive.js +50 -19
- package/lib/dtls/src/record/receive.js.map +1 -1
- package/lib/dtls/src/server.js +19 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.d.ts +134 -2
- package/lib/dtls/src/socket.js +322 -6
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidateError.d.ts +155 -0
- package/lib/ice/src/candidateError.js +246 -0
- package/lib/ice/src/candidateError.js.map +1 -0
- package/lib/ice/src/candidateGatherer.d.ts +127 -0
- package/lib/ice/src/candidateGatherer.js +745 -0
- package/lib/ice/src/candidateGatherer.js.map +1 -0
- package/lib/ice/src/consent.d.ts +49 -0
- package/lib/ice/src/consent.js +258 -0
- package/lib/ice/src/consent.js.map +1 -0
- package/lib/ice/src/ice.d.ts +223 -71
- package/lib/ice/src/ice.js +873 -975
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +207 -8
- package/lib/ice/src/iceBase.js +94 -31
- package/lib/ice/src/iceBase.js.map +1 -1
- package/lib/ice/src/index.d.ts +1 -0
- package/lib/ice/src/index.js +1 -0
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/internal/checkMessages.d.ts +41 -0
- package/lib/ice/src/internal/checkMessages.js +63 -0
- package/lib/ice/src/internal/checkMessages.js.map +1 -0
- package/lib/ice/src/internal/defaultRoute.d.ts +20 -0
- package/lib/ice/src/internal/defaultRoute.js +134 -0
- package/lib/ice/src/internal/defaultRoute.js.map +1 -0
- package/lib/ice/src/internal/hostInterfaces.d.ts +17 -0
- package/lib/ice/src/internal/hostInterfaces.js +77 -0
- package/lib/ice/src/internal/hostInterfaces.js.map +1 -0
- package/lib/ice/src/internal/hostPreference.d.ts +24 -0
- package/lib/ice/src/internal/hostPreference.js +38 -0
- package/lib/ice/src/internal/hostPreference.js.map +1 -0
- package/lib/ice/src/internal/resolveHostAddresses.d.ts +56 -8
- package/lib/ice/src/internal/resolveHostAddresses.js +127 -24
- package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -1
- package/lib/ice/src/internal/selectAddresses.d.ts +27 -0
- package/lib/ice/src/internal/selectAddresses.js +37 -18
- package/lib/ice/src/internal/selectAddresses.js.map +1 -1
- package/lib/ice/src/nomination/regularNomination.d.ts +200 -0
- package/lib/ice/src/nomination/regularNomination.js +311 -0
- package/lib/ice/src/nomination/regularNomination.js.map +1 -0
- package/lib/ice/src/nomination/selectionReplacement.d.ts +138 -0
- package/lib/ice/src/nomination/selectionReplacement.js +371 -0
- package/lib/ice/src/nomination/selectionReplacement.js.map +1 -0
- package/lib/ice/src/provisional.d.ts +139 -0
- package/lib/ice/src/provisional.js +468 -0
- package/lib/ice/src/provisional.js.map +1 -0
- package/lib/ice/src/stun/protocol.d.ts +9 -2
- package/lib/ice/src/stun/protocol.js +16 -17
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/tcpProtocol.d.ts +1 -1
- package/lib/ice/src/stun/tcpProtocol.js +7 -7
- package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.js +4 -2
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +2 -2
- package/lib/ice/src/turn/protocol.js +6 -3
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +16 -5
- package/lib/ice/src/types/model.js.map +1 -1
- package/lib/ice-server/src/stun/attributes.js +4 -0
- package/lib/ice-server/src/stun/attributes.js.map +1 -1
- package/lib/ice-server/src/stun/const.d.ts +20 -1
- package/lib/ice-server/src/stun/const.js +9 -1
- package/lib/ice-server/src/stun/const.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +28 -1
- package/lib/ice-server/src/stun/message.js +102 -15
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/index.mjs +13394 -7732
- package/lib/nonstandard/index.mjs +680 -286
- package/lib/polyfill/dom.mjs +19605 -14243
- package/lib/polyfill/index.mjs +19605 -14243
- package/lib/rtp/src/index.d.ts +1 -0
- package/lib/rtp/src/index.js +1 -0
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtp/continuity.d.ts +14 -1
- package/lib/rtp/src/rtp/continuity.js +24 -4
- package/lib/rtp/src/rtp/continuity.js.map +1 -1
- package/lib/rtp/src/rtp/timelineRewriter.d.ts +178 -0
- package/lib/rtp/src/rtp/timelineRewriter.js +417 -0
- package/lib/rtp/src/rtp/timelineRewriter.js.map +1 -0
- package/lib/sctp/src/sctp.d.ts +5 -0
- package/lib/sctp/src/sctp.js +81 -47
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/webrtc/src/api/compatibilityOptions.d.ts +33 -0
- package/lib/webrtc/src/api/compatibilityOptions.js +33 -0
- package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -0
- package/lib/webrtc/src/api/peerConfig.d.ts +348 -34
- package/lib/webrtc/src/api/peerConfig.js +90 -24
- package/lib/webrtc/src/api/peerConfig.js.map +1 -1
- package/lib/webrtc/src/api/peerConnectionEvents.d.ts +77 -1
- package/lib/webrtc/src/api/peerConnectionEvents.js +105 -1
- package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
- package/lib/webrtc/src/helper.d.ts +8 -0
- package/lib/webrtc/src/helper.js +40 -4
- package/lib/webrtc/src/helper.js.map +1 -1
- package/lib/webrtc/src/media/codecCompatibility.d.ts +87 -1
- package/lib/webrtc/src/media/codecCompatibility.js +338 -12
- package/lib/webrtc/src/media/codecCompatibility.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.d.ts +43 -10
- package/lib/webrtc/src/media/receiver/nack.js +245 -88
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +239 -51
- package/lib/webrtc/src/media/router.js +664 -237
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/routing/pendingRoutes.d.ts +26 -0
- package/lib/webrtc/src/media/routing/pendingRoutes.js +48 -0
- package/lib/webrtc/src/media/routing/pendingRoutes.js.map +1 -0
- package/lib/webrtc/src/media/routing/ridRouting.d.ts +37 -0
- package/lib/webrtc/src/media/routing/ridRouting.js +74 -0
- package/lib/webrtc/src/media/routing/ridRouting.js.map +1 -0
- package/lib/webrtc/src/media/routing/routeTable.d.ts +60 -0
- package/lib/webrtc/src/media/routing/routeTable.js +95 -0
- package/lib/webrtc/src/media/routing/routeTable.js.map +1 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.d.ts +34 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.js +165 -0
- package/lib/webrtc/src/media/routing/rtcpRouting.js.map +1 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.d.ts +55 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.js +117 -0
- package/lib/webrtc/src/media/routing/unknownSsrc.js.map +1 -0
- package/lib/webrtc/src/media/rtpReceiver.d.ts +222 -0
- package/lib/webrtc/src/media/rtpReceiver.js +668 -28
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +7 -0
- package/lib/webrtc/src/media/rtpSender.js +9 -3
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +18 -0
- package/lib/webrtc/src/media/rtpTransceiver.js +64 -2
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderReportHistory.d.ts +51 -0
- package/lib/webrtc/src/media/sender/senderReportHistory.js +111 -0
- package/lib/webrtc/src/media/sender/senderReportHistory.js.map +1 -0
- package/lib/webrtc/src/media/sender/senderStats.d.ts +6 -5
- package/lib/webrtc/src/media/sender/senderStats.js +14 -19
- package/lib/webrtc/src/media/sender/senderStats.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +9 -0
- package/lib/webrtc/src/media/track.js +9 -0
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +23 -6
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +46 -22
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -1
- package/lib/webrtc/src/negotiation/transceiverPairing.d.ts +1 -0
- package/lib/webrtc/src/negotiation/transceiverPairing.js +62 -0
- package/lib/webrtc/src/negotiation/transceiverPairing.js.map +1 -0
- package/lib/webrtc/src/negotiation/transportActivation.d.ts +8 -1
- package/lib/webrtc/src/negotiation/transportActivation.js +21 -0
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
- package/lib/webrtc/src/negotiationTransaction.d.ts +35 -4
- package/lib/webrtc/src/negotiationTransaction.js +111 -8
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +65 -6
- package/lib/webrtc/src/peerConnection.js +283 -28
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/polyfill/globals.d.ts +2 -1
- package/lib/webrtc/src/polyfill/globals.js.map +1 -1
- package/lib/webrtc/src/polyfill/install.js +2 -0
- package/lib/webrtc/src/polyfill/install.js.map +1 -1
- package/lib/webrtc/src/sctpManager.js +4 -0
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.d.ts +69 -0
- package/lib/webrtc/src/sdp.js +139 -14
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/sdpManager.d.ts +85 -4
- package/lib/webrtc/src/sdpManager.js +214 -14
- package/lib/webrtc/src/sdpManager.js.map +1 -1
- package/lib/webrtc/src/secureTransportManager.d.ts +38 -1
- package/lib/webrtc/src/secureTransportManager.js +82 -7
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +82 -4
- package/lib/webrtc/src/transceiverManager.js +231 -38
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +95 -1
- package/lib/webrtc/src/transport/dtls.js +324 -28
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +61 -4
- package/lib/webrtc/src/transport/ice.js +180 -11
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +23 -0
- package/lib/webrtc/src/transport/sctp.js +87 -2
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +33 -0
- package/lib/webrtc/src/utils.js +52 -3
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +2 -1
|
@@ -674,12 +674,29 @@ var Event2 = class {
|
|
|
674
674
|
onended;
|
|
675
675
|
onerror = (e) => {
|
|
676
676
|
};
|
|
677
|
+
onListenerError;
|
|
678
|
+
/**
|
|
679
|
+
* @param options.onListenerError When given, a throwing subscriber is
|
|
680
|
+
* reported to it and the remaining subscribers still run. Without it the
|
|
681
|
+
* first exception propagates out of `execute` (default).
|
|
682
|
+
*/
|
|
683
|
+
constructor(options = {}) {
|
|
684
|
+
this.onListenerError = options.onListenerError;
|
|
685
|
+
}
|
|
677
686
|
execute = (...args) => {
|
|
678
687
|
if (this.ended) {
|
|
679
688
|
return;
|
|
680
689
|
}
|
|
681
690
|
for (const item of this.event.stack) {
|
|
682
|
-
|
|
691
|
+
if (this.onListenerError) {
|
|
692
|
+
try {
|
|
693
|
+
item.execute(...args);
|
|
694
|
+
} catch (error) {
|
|
695
|
+
this.onListenerError(error);
|
|
696
|
+
}
|
|
697
|
+
} else {
|
|
698
|
+
item.execute(...args);
|
|
699
|
+
}
|
|
683
700
|
}
|
|
684
701
|
(async () => {
|
|
685
702
|
for (const item of this.event.promiseStack) {
|
|
@@ -689,6 +706,62 @@ var Event2 = class {
|
|
|
689
706
|
this.onerror(e);
|
|
690
707
|
});
|
|
691
708
|
};
|
|
709
|
+
/**
|
|
710
|
+
* Like {@link execute}, but every synchronous subscriber runs even if an
|
|
711
|
+
* earlier one throws: each exception is passed to `onError` instead of
|
|
712
|
+
* ending the iteration. For events whose later subscribers carry internal
|
|
713
|
+
* work (state propagation, cleanup) that an application subscriber
|
|
714
|
+
* registered before them must not be able to skip.
|
|
715
|
+
*/
|
|
716
|
+
/**
|
|
717
|
+
* Like {@link executeIsolated}, but `shouldStop` is checked before each
|
|
718
|
+
* subscriber: once it returns true, the remaining subscribers are not
|
|
719
|
+
* called (a DOM-like `stopImmediatePropagation`). A subscriber that
|
|
720
|
+
* throws is reported to `onError` and the next one still runs. One added
|
|
721
|
+
* during the call is not called; one removed during it is skipped. The
|
|
722
|
+
* promise subscribers (`asPromise` / `watch`) are not run when stopped.
|
|
723
|
+
*/
|
|
724
|
+
executeUntil(shouldStop, onError, ...args) {
|
|
725
|
+
if (this.ended) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
for (const item of [...this.event.stack]) {
|
|
729
|
+
if (shouldStop()) return;
|
|
730
|
+
if (!this.event.stack.includes(item)) continue;
|
|
731
|
+
try {
|
|
732
|
+
item.execute(...args);
|
|
733
|
+
} catch (error) {
|
|
734
|
+
onError(error);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
if (shouldStop()) return;
|
|
738
|
+
(async () => {
|
|
739
|
+
for (const item of this.event.promiseStack) {
|
|
740
|
+
await item.execute(...args);
|
|
741
|
+
}
|
|
742
|
+
})().catch((e) => {
|
|
743
|
+
this.onerror(e);
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
executeIsolated(onError, ...args) {
|
|
747
|
+
if (this.ended) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
for (const item of this.event.stack) {
|
|
751
|
+
try {
|
|
752
|
+
item.execute(...args);
|
|
753
|
+
} catch (error) {
|
|
754
|
+
onError(error);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
(async () => {
|
|
758
|
+
for (const item of this.event.promiseStack) {
|
|
759
|
+
await item.execute(...args);
|
|
760
|
+
}
|
|
761
|
+
})().catch((e) => {
|
|
762
|
+
this.onerror(e);
|
|
763
|
+
});
|
|
764
|
+
}
|
|
692
765
|
complete = () => {
|
|
693
766
|
if (this.ended) {
|
|
694
767
|
return;
|
|
@@ -983,14 +1056,15 @@ async function randomPorts(num, protocol = "udp4", interfaceAddresses) {
|
|
|
983
1056
|
[...Array(num)].map(() => randomPort(protocol, interfaceAddresses))
|
|
984
1057
|
);
|
|
985
1058
|
}
|
|
986
|
-
async function findPort(min, max, protocol = "udp4", interfaceAddresses) {
|
|
1059
|
+
async function findPort(min, max, protocol = "udp4", interfaceAddresses, bindAddress) {
|
|
987
1060
|
let port;
|
|
1061
|
+
const address = bindAddress ?? interfaceAddress(protocol, interfaceAddresses);
|
|
988
1062
|
for (let i = min; i <= max; i++) {
|
|
989
1063
|
const socket = createSocket(protocol);
|
|
990
1064
|
setImmediate(
|
|
991
1065
|
() => socket.bind({
|
|
992
1066
|
port: i,
|
|
993
|
-
address
|
|
1067
|
+
address
|
|
994
1068
|
})
|
|
995
1069
|
);
|
|
996
1070
|
const err5 = await new Promise((r) => {
|
|
@@ -1247,15 +1321,13 @@ var UdpTransport = class _UdpTransport {
|
|
|
1247
1321
|
}
|
|
1248
1322
|
}
|
|
1249
1323
|
async init() {
|
|
1250
|
-
const address = interfaceAddress(
|
|
1251
|
-
this.socketType,
|
|
1252
|
-
this.options.interfaceAddresses
|
|
1253
|
-
);
|
|
1324
|
+
const address = this.options.bindAddress ?? interfaceAddress(this.socketType, this.options.interfaceAddresses);
|
|
1254
1325
|
const port = this.options.port ? this.options.port : this.options.portRange ? await findPort(
|
|
1255
1326
|
this.options.portRange[0],
|
|
1256
1327
|
this.options.portRange[1],
|
|
1257
1328
|
this.socketType,
|
|
1258
|
-
this.options.interfaceAddresses
|
|
1329
|
+
this.options.interfaceAddresses,
|
|
1330
|
+
address
|
|
1259
1331
|
) : void 0;
|
|
1260
1332
|
if (this.closed) {
|
|
1261
1333
|
throw new Error("udp transport closed");
|
|
@@ -5438,6 +5510,7 @@ var RtpContinuity = class {
|
|
|
5438
5510
|
seqOffset = 0;
|
|
5439
5511
|
pending = false;
|
|
5440
5512
|
pendingTimestampStep = 1;
|
|
5513
|
+
pendingFrom;
|
|
5441
5514
|
/** Last sent output sequence number; undefined before the first packet. */
|
|
5442
5515
|
get sequenceNumber() {
|
|
5443
5516
|
return this._sequenceNumber;
|
|
@@ -5449,14 +5522,19 @@ var RtpContinuity = class {
|
|
|
5449
5522
|
/**
|
|
5450
5523
|
* Rewrite offsets on the next sent packet.
|
|
5451
5524
|
* @param timestampStep Timestamp increment across the source boundary.
|
|
5525
|
+
* @param from Output to continue from instead of the last assigned one
|
|
5526
|
+
* (for example the highest output when the last assigned packet was a
|
|
5527
|
+
* reordered older one). Omitted: the last assigned output.
|
|
5452
5528
|
*/
|
|
5453
|
-
schedule(timestampStep = 1) {
|
|
5529
|
+
schedule(timestampStep = 1, from) {
|
|
5454
5530
|
this.pending = true;
|
|
5455
5531
|
this.pendingTimestampStep = timestampStep;
|
|
5532
|
+
this.pendingFrom = from;
|
|
5456
5533
|
}
|
|
5457
5534
|
/** Forget a scheduled rewrite (track detached / sender stopped). */
|
|
5458
5535
|
cancel() {
|
|
5459
5536
|
this.pending = false;
|
|
5537
|
+
this.pendingFrom = void 0;
|
|
5460
5538
|
}
|
|
5461
5539
|
/** Output timestamp of `inputTimestamp` with the current offset (before send). */
|
|
5462
5540
|
mapTimestamp(inputTimestamp) {
|
|
@@ -5470,19 +5548,22 @@ var RtpContinuity = class {
|
|
|
5470
5548
|
assign(header, inputSequenceNumber, inputTimestamp) {
|
|
5471
5549
|
let rewritten = false;
|
|
5472
5550
|
if (this.pending) {
|
|
5473
|
-
|
|
5551
|
+
const lastSequenceNumber = this.pendingFrom?.sequenceNumber ?? this._sequenceNumber;
|
|
5552
|
+
const lastTimestamp = this.pendingFrom?.timestamp ?? this._timestamp;
|
|
5553
|
+
if (lastSequenceNumber != void 0 && lastTimestamp != void 0) {
|
|
5474
5554
|
this.seqOffset = uint16Add(
|
|
5475
|
-
uint16Add(
|
|
5555
|
+
uint16Add(lastSequenceNumber, 1),
|
|
5476
5556
|
-inputSequenceNumber
|
|
5477
5557
|
);
|
|
5478
5558
|
this.timestampOffset = uint32Add(
|
|
5479
|
-
uint32Add(
|
|
5559
|
+
uint32Add(lastTimestamp, this.pendingTimestampStep),
|
|
5480
5560
|
-inputTimestamp
|
|
5481
5561
|
);
|
|
5482
5562
|
rewritten = true;
|
|
5483
5563
|
}
|
|
5484
5564
|
this.pending = false;
|
|
5485
5565
|
this.pendingTimestampStep = 1;
|
|
5566
|
+
this.pendingFrom = void 0;
|
|
5486
5567
|
}
|
|
5487
5568
|
header.timestamp = uint32Add(inputTimestamp, this.timestampOffset);
|
|
5488
5569
|
header.sequenceNumber = uint16Add(inputSequenceNumber, this.seqOffset);
|
|
@@ -6366,6 +6447,230 @@ function stampHopByHopExtensions(header, negotiated, {
|
|
|
6366
6447
|
return packetWideSeq;
|
|
6367
6448
|
}
|
|
6368
6449
|
|
|
6450
|
+
// ../rtp/src/rtp/timelineRewriter.ts
|
|
6451
|
+
var RtpTimelineDropReason = {
|
|
6452
|
+
staleSource: "staleSource",
|
|
6453
|
+
beforeSourceStart: "beforeSourceStart"
|
|
6454
|
+
};
|
|
6455
|
+
var RetiredSources = class _RetiredSources {
|
|
6456
|
+
primitive = /* @__PURE__ */ new Map();
|
|
6457
|
+
objects = /* @__PURE__ */ new WeakMap();
|
|
6458
|
+
static isObject(key) {
|
|
6459
|
+
return typeof key === "object" && key !== null || typeof key === "function";
|
|
6460
|
+
}
|
|
6461
|
+
get(key) {
|
|
6462
|
+
return _RetiredSources.isObject(key) ? this.objects.get(key) : this.primitive.get(key);
|
|
6463
|
+
}
|
|
6464
|
+
add(key, ssrc) {
|
|
6465
|
+
let entry = this.get(key);
|
|
6466
|
+
if (!entry) {
|
|
6467
|
+
entry = { all: false, ssrcs: /* @__PURE__ */ new Set() };
|
|
6468
|
+
if (_RetiredSources.isObject(key)) this.objects.set(key, entry);
|
|
6469
|
+
else this.primitive.set(key, entry);
|
|
6470
|
+
}
|
|
6471
|
+
if (ssrc === void 0) entry.all = true;
|
|
6472
|
+
else entry.ssrcs.add(ssrc);
|
|
6473
|
+
}
|
|
6474
|
+
has(key, ssrc, switchOnSsrc) {
|
|
6475
|
+
const entry = this.get(key);
|
|
6476
|
+
if (!entry) return false;
|
|
6477
|
+
return entry.all || switchOnSsrc && entry.ssrcs.has(ssrc);
|
|
6478
|
+
}
|
|
6479
|
+
};
|
|
6480
|
+
var seqDiff = (a, b) => a - b << 16 >> 16;
|
|
6481
|
+
var tsDiff = (a, b) => a - b | 0;
|
|
6482
|
+
var RtpTimelineRewriter = class {
|
|
6483
|
+
/** A new source started on the output ({@link RtpTimelineSwitch}). */
|
|
6484
|
+
onSourceSwitch = new Event2();
|
|
6485
|
+
/** A packet was dropped. Receives the input packet. */
|
|
6486
|
+
onDrop = new Event2();
|
|
6487
|
+
continuity = new RtpContinuity();
|
|
6488
|
+
options;
|
|
6489
|
+
now;
|
|
6490
|
+
started = false;
|
|
6491
|
+
currentSource = void 0;
|
|
6492
|
+
currentSsrc;
|
|
6493
|
+
retired = new RetiredSources();
|
|
6494
|
+
/** A switch is waiting for the first packet of the new source. */
|
|
6495
|
+
pendingSwitch = false;
|
|
6496
|
+
pendingTimestampStep;
|
|
6497
|
+
/** The current source continues an earlier one (start check applies). */
|
|
6498
|
+
guardSourceStart = false;
|
|
6499
|
+
sourceHasPacket = false;
|
|
6500
|
+
sourceHighestSeq = 0;
|
|
6501
|
+
/** Highest input sequence number of the source, relative to its first packet. */
|
|
6502
|
+
sourceHighestExtended = 0;
|
|
6503
|
+
highestSequenceNumber;
|
|
6504
|
+
highestTimestamp;
|
|
6505
|
+
lastTimestampDelta;
|
|
6506
|
+
/** Arrival time of the packet that set `highestTimestamp`. */
|
|
6507
|
+
lastPacketTime;
|
|
6508
|
+
constructor(options = {}) {
|
|
6509
|
+
this.options = options;
|
|
6510
|
+
this.now = options.now ?? (() => performance.now());
|
|
6511
|
+
}
|
|
6512
|
+
/** Last output sequence number; undefined before the first packet. */
|
|
6513
|
+
get sequenceNumber() {
|
|
6514
|
+
return this.continuity.sequenceNumber;
|
|
6515
|
+
}
|
|
6516
|
+
/** Last output timestamp; undefined before the first packet. */
|
|
6517
|
+
get timestamp() {
|
|
6518
|
+
return this.continuity.timestamp;
|
|
6519
|
+
}
|
|
6520
|
+
/**
|
|
6521
|
+
* Output timestamp of an input timestamp of the current source (for example
|
|
6522
|
+
* to rewrite the RTP timestamp of an upstream Sender Report). Until the first
|
|
6523
|
+
* packet of a new source is rewritten, this still uses the previous source's offset.
|
|
6524
|
+
*/
|
|
6525
|
+
mapTimestamp(inputTimestamp) {
|
|
6526
|
+
return this.continuity.mapTimestamp(inputTimestamp);
|
|
6527
|
+
}
|
|
6528
|
+
/**
|
|
6529
|
+
* Start a new source at the next packet.
|
|
6530
|
+
* @param options.source `source` key of the new source. When given, packets
|
|
6531
|
+
* with the current key are dropped from now on; packets must then carry this key.
|
|
6532
|
+
* @param options.timestampStep Timestamp increment for this switch only,
|
|
6533
|
+
* instead of {@link RtpTimelineRewriterOptions.timestampStep}.
|
|
6534
|
+
*/
|
|
6535
|
+
switchSource(options = {}) {
|
|
6536
|
+
if ("source" in options && !Object.is(options.source, this.currentSource)) {
|
|
6537
|
+
if (this.started) {
|
|
6538
|
+
this.retired.add(this.currentSource);
|
|
6539
|
+
}
|
|
6540
|
+
this.started = true;
|
|
6541
|
+
this.currentSource = options.source;
|
|
6542
|
+
this.currentSsrc = void 0;
|
|
6543
|
+
}
|
|
6544
|
+
this.pendingSwitch = true;
|
|
6545
|
+
this.pendingTimestampStep = options.timestampStep;
|
|
6546
|
+
}
|
|
6547
|
+
/**
|
|
6548
|
+
* Rewrite one packet onto the output timeline.
|
|
6549
|
+
* @param options.source Identity of the upstream source (for example a
|
|
6550
|
+
* connection generation number). A new key starts a new source.
|
|
6551
|
+
* @returns the rewritten packet (a clone unless `inPlace`), or undefined when
|
|
6552
|
+
* the packet is dropped ({@link RtpTimelineDropReason}).
|
|
6553
|
+
*/
|
|
6554
|
+
rewrite(packet, options = {}) {
|
|
6555
|
+
const source = options.source;
|
|
6556
|
+
const ssrc = packet.header.ssrc;
|
|
6557
|
+
const switchOnSsrc = this.options.switchOnSsrcChange ?? true;
|
|
6558
|
+
if (this.retired.has(source, ssrc, switchOnSsrc)) {
|
|
6559
|
+
this.onDrop.execute(packet, RtpTimelineDropReason.staleSource);
|
|
6560
|
+
return void 0;
|
|
6561
|
+
}
|
|
6562
|
+
if (!this.started) {
|
|
6563
|
+
this.started = true;
|
|
6564
|
+
this.currentSource = source;
|
|
6565
|
+
} else if (!Object.is(source, this.currentSource)) {
|
|
6566
|
+
this.retired.add(this.currentSource);
|
|
6567
|
+
this.currentSource = source;
|
|
6568
|
+
this.pendingSwitch = true;
|
|
6569
|
+
} else if (switchOnSsrc && this.currentSsrc !== void 0 && ssrc !== this.currentSsrc) {
|
|
6570
|
+
this.retired.add(this.currentSource, this.currentSsrc);
|
|
6571
|
+
this.pendingSwitch = true;
|
|
6572
|
+
}
|
|
6573
|
+
const sequenceNumber = packet.header.sequenceNumber;
|
|
6574
|
+
const timestamp = packet.header.timestamp;
|
|
6575
|
+
const now = this.now();
|
|
6576
|
+
let timestampStep;
|
|
6577
|
+
if (this.pendingSwitch) {
|
|
6578
|
+
this.pendingSwitch = false;
|
|
6579
|
+
this.sourceHasPacket = false;
|
|
6580
|
+
this.currentSsrc = void 0;
|
|
6581
|
+
if (this.highestSequenceNumber !== void 0) {
|
|
6582
|
+
timestampStep = this.timestampStepFor(now);
|
|
6583
|
+
this.continuity.schedule(timestampStep, {
|
|
6584
|
+
sequenceNumber: this.highestSequenceNumber,
|
|
6585
|
+
timestamp: this.highestTimestamp
|
|
6586
|
+
});
|
|
6587
|
+
this.guardSourceStart = true;
|
|
6588
|
+
}
|
|
6589
|
+
this.pendingTimestampStep = void 0;
|
|
6590
|
+
}
|
|
6591
|
+
if (!this.sourceHasPacket) {
|
|
6592
|
+
this.sourceHasPacket = true;
|
|
6593
|
+
this.currentSsrc = ssrc;
|
|
6594
|
+
this.sourceHighestSeq = sequenceNumber;
|
|
6595
|
+
this.sourceHighestExtended = 0;
|
|
6596
|
+
} else {
|
|
6597
|
+
const diff = seqDiff(sequenceNumber, this.sourceHighestSeq);
|
|
6598
|
+
const extended = this.sourceHighestExtended + diff;
|
|
6599
|
+
if (this.guardSourceStart && extended < 0) {
|
|
6600
|
+
this.onDrop.execute(packet, RtpTimelineDropReason.beforeSourceStart);
|
|
6601
|
+
return void 0;
|
|
6602
|
+
}
|
|
6603
|
+
if (diff > 0) {
|
|
6604
|
+
this.sourceHighestSeq = sequenceNumber;
|
|
6605
|
+
this.sourceHighestExtended = extended;
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
const out = this.options.inPlace ? packet : packet.clone();
|
|
6609
|
+
const rewritten = this.continuity.assign(
|
|
6610
|
+
out.header,
|
|
6611
|
+
sequenceNumber,
|
|
6612
|
+
timestamp
|
|
6613
|
+
);
|
|
6614
|
+
if (this.options.ssrc !== void 0) {
|
|
6615
|
+
out.header.ssrc = this.options.ssrc;
|
|
6616
|
+
}
|
|
6617
|
+
if (this.options.payloadType !== void 0) {
|
|
6618
|
+
out.header.payloadType = this.options.payloadType;
|
|
6619
|
+
}
|
|
6620
|
+
this.observeOutput(out, rewritten, now);
|
|
6621
|
+
if (rewritten) {
|
|
6622
|
+
this.onSourceSwitch.execute({
|
|
6623
|
+
source: this.currentSource,
|
|
6624
|
+
inputSsrc: ssrc,
|
|
6625
|
+
sequenceNumber: out.header.sequenceNumber,
|
|
6626
|
+
timestamp: out.header.timestamp,
|
|
6627
|
+
timestampStep
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
return out;
|
|
6631
|
+
}
|
|
6632
|
+
observeOutput(out, rewritten, now) {
|
|
6633
|
+
const { sequenceNumber, timestamp } = out.header;
|
|
6634
|
+
if (this.highestSequenceNumber === void 0 || seqDiff(sequenceNumber, this.highestSequenceNumber) > 0) {
|
|
6635
|
+
this.highestSequenceNumber = sequenceNumber;
|
|
6636
|
+
}
|
|
6637
|
+
if (this.highestTimestamp === void 0) {
|
|
6638
|
+
this.highestTimestamp = timestamp;
|
|
6639
|
+
this.lastPacketTime = now;
|
|
6640
|
+
} else {
|
|
6641
|
+
const delta = tsDiff(timestamp, this.highestTimestamp);
|
|
6642
|
+
if (delta > 0) {
|
|
6643
|
+
if (!rewritten && !isPaddingOnlyRtpPacket(out)) {
|
|
6644
|
+
this.lastTimestampDelta = delta;
|
|
6645
|
+
}
|
|
6646
|
+
this.highestTimestamp = timestamp;
|
|
6647
|
+
this.lastPacketTime = now;
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
}
|
|
6651
|
+
timestampStepFor(now) {
|
|
6652
|
+
const fallback = this.options.defaultTimestampStep ?? 1;
|
|
6653
|
+
let step;
|
|
6654
|
+
if (this.pendingTimestampStep !== void 0) {
|
|
6655
|
+
step = this.pendingTimestampStep;
|
|
6656
|
+
} else {
|
|
6657
|
+
const mode = this.options.timestampStep ?? "auto";
|
|
6658
|
+
if (typeof mode === "number") {
|
|
6659
|
+
step = mode;
|
|
6660
|
+
} else if ((mode === "wallClock" || mode === "auto") && this.options.clockRate !== void 0 && this.lastPacketTime !== void 0) {
|
|
6661
|
+
step = Math.round(
|
|
6662
|
+
(now - this.lastPacketTime) * this.options.clockRate / 1e3
|
|
6663
|
+
);
|
|
6664
|
+
} else if (mode === "wallClock") {
|
|
6665
|
+
step = fallback;
|
|
6666
|
+
} else {
|
|
6667
|
+
step = this.lastTimestampDelta ?? fallback;
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
return Math.min(Math.max(1, Math.trunc(step)), 2147483647);
|
|
6671
|
+
}
|
|
6672
|
+
};
|
|
6673
|
+
|
|
6369
6674
|
// ../rtp/src/srtp/const.ts
|
|
6370
6675
|
var ProtectionProfileAes128CmHmacSha1_80 = 1;
|
|
6371
6676
|
var ProtectionProfileAeadAes128Gcm = 7;
|
|
@@ -11498,11 +11803,32 @@ import { createSocket as createSocket3 } from "dgram";
|
|
|
11498
11803
|
import { EventEmitter } from "node:events";
|
|
11499
11804
|
var EventTarget2 = class extends EventEmitter {
|
|
11500
11805
|
emit(type, ...args) {
|
|
11806
|
+
return super.emit(type, ...this.eventArgs(type, args));
|
|
11807
|
+
}
|
|
11808
|
+
/**
|
|
11809
|
+
* @internal
|
|
11810
|
+
* Like {@link emit}, but every listener runs even if an earlier one
|
|
11811
|
+
* throws: each exception is passed to `onError` (`once` listeners still
|
|
11812
|
+
* run once). Unlike `emit("error")`, nothing is thrown when no listener
|
|
11813
|
+
* is registered.
|
|
11814
|
+
*/
|
|
11815
|
+
emitIsolated(onError, type, ...args) {
|
|
11816
|
+
const eventArgs = this.eventArgs(type, args);
|
|
11817
|
+
for (const listener of this.rawListeners(type)) {
|
|
11818
|
+
try {
|
|
11819
|
+
listener.apply(this, eventArgs);
|
|
11820
|
+
} catch (error) {
|
|
11821
|
+
onError(error);
|
|
11822
|
+
}
|
|
11823
|
+
}
|
|
11824
|
+
}
|
|
11825
|
+
/** The DOM-like event arguments: an Event with `type` as the first one. */
|
|
11826
|
+
eventArgs(type, args) {
|
|
11501
11827
|
if (typeof type !== "string") {
|
|
11502
|
-
return
|
|
11828
|
+
return args;
|
|
11503
11829
|
}
|
|
11504
11830
|
if (args.length === 0) {
|
|
11505
|
-
return
|
|
11831
|
+
return [new Event(type)];
|
|
11506
11832
|
}
|
|
11507
11833
|
const [event, ...rest] = args;
|
|
11508
11834
|
if (event && typeof event === "object" && !("type" in event)) {
|
|
@@ -11513,10 +11839,10 @@ var EventTarget2 = class extends EventEmitter {
|
|
|
11513
11839
|
value: type
|
|
11514
11840
|
});
|
|
11515
11841
|
} catch {
|
|
11516
|
-
return
|
|
11842
|
+
return [{ type, ...event }, ...rest];
|
|
11517
11843
|
}
|
|
11518
11844
|
}
|
|
11519
|
-
return
|
|
11845
|
+
return [event, ...rest];
|
|
11520
11846
|
}
|
|
11521
11847
|
addEventListener = (type, listener, options) => {
|
|
11522
11848
|
if (typeof options === "object" && options?.once) {
|
|
@@ -11534,73 +11860,6 @@ var EventTarget2 = class extends EventEmitter {
|
|
|
11534
11860
|
// src/dataChannel.ts
|
|
11535
11861
|
var log11 = debug("werift:packages/webrtc/src/dataChannel.ts");
|
|
11536
11862
|
|
|
11537
|
-
// ../dtls/src/cipher/const.ts
|
|
11538
|
-
var SignatureAlgorithm = {
|
|
11539
|
-
rsa_1: 1,
|
|
11540
|
-
ecdsa_3: 3
|
|
11541
|
-
};
|
|
11542
|
-
var HashAlgorithm = {
|
|
11543
|
-
sha256_4: 4
|
|
11544
|
-
};
|
|
11545
|
-
var CipherSuite = {
|
|
11546
|
-
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_49195: 49195,
|
|
11547
|
-
//49195,
|
|
11548
|
-
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256_49199: 49199
|
|
11549
|
-
//49199
|
|
11550
|
-
};
|
|
11551
|
-
var CipherSuiteList = Object.values(CipherSuite);
|
|
11552
|
-
var NamedCurveAlgorithm = {
|
|
11553
|
-
x25519_29: 29,
|
|
11554
|
-
secp256r1_23: 23
|
|
11555
|
-
};
|
|
11556
|
-
var NamedCurveAlgorithmList = Object.values(NamedCurveAlgorithm);
|
|
11557
|
-
var CurveType = { named_curve_3: 3 };
|
|
11558
|
-
var signatures = [
|
|
11559
|
-
{ hash: HashAlgorithm.sha256_4, signature: SignatureAlgorithm.rsa_1 },
|
|
11560
|
-
{ hash: HashAlgorithm.sha256_4, signature: SignatureAlgorithm.ecdsa_3 }
|
|
11561
|
-
];
|
|
11562
|
-
|
|
11563
|
-
// ../dtls/src/cipher/suites/abstract.ts
|
|
11564
|
-
var SessionType = {
|
|
11565
|
-
CLIENT: 1,
|
|
11566
|
-
SERVER: 2
|
|
11567
|
-
};
|
|
11568
|
-
var AbstractCipher = class {
|
|
11569
|
-
id = 0;
|
|
11570
|
-
name;
|
|
11571
|
-
hashAlgorithm;
|
|
11572
|
-
verifyDataLength = 12;
|
|
11573
|
-
blockAlgorithm;
|
|
11574
|
-
kx;
|
|
11575
|
-
/**
|
|
11576
|
-
* Init cipher.
|
|
11577
|
-
* @abstract
|
|
11578
|
-
*/
|
|
11579
|
-
init(...args) {
|
|
11580
|
-
throw new Error("not implemented");
|
|
11581
|
-
}
|
|
11582
|
-
/**
|
|
11583
|
-
* Encrypts data.
|
|
11584
|
-
* @abstract
|
|
11585
|
-
*/
|
|
11586
|
-
encrypt(...args) {
|
|
11587
|
-
throw new Error("not implemented");
|
|
11588
|
-
}
|
|
11589
|
-
/**
|
|
11590
|
-
* Decrypts data.
|
|
11591
|
-
* @abstract
|
|
11592
|
-
*/
|
|
11593
|
-
decrypt(...args) {
|
|
11594
|
-
throw new Error("not implemented");
|
|
11595
|
-
}
|
|
11596
|
-
/**
|
|
11597
|
-
* @returns {string}
|
|
11598
|
-
*/
|
|
11599
|
-
toString() {
|
|
11600
|
-
return this.name;
|
|
11601
|
-
}
|
|
11602
|
-
};
|
|
11603
|
-
|
|
11604
11863
|
// ../common/src/asn1.ts
|
|
11605
11864
|
var Asn1Tag = {
|
|
11606
11865
|
integer: 2,
|
|
@@ -11739,6 +11998,29 @@ ${lines.join("\n")}
|
|
|
11739
11998
|
`;
|
|
11740
11999
|
}
|
|
11741
12000
|
|
|
12001
|
+
// ../dtls/src/handshake/message/alert.ts
|
|
12002
|
+
var { decode: decode2, encode: encode2, types: types2 } = binaryData_exports;
|
|
12003
|
+
var Alert = class _Alert {
|
|
12004
|
+
level;
|
|
12005
|
+
description;
|
|
12006
|
+
static spec = {
|
|
12007
|
+
level: types2.uint8,
|
|
12008
|
+
description: types2.uint8
|
|
12009
|
+
};
|
|
12010
|
+
constructor(level, description) {
|
|
12011
|
+
this.level = level;
|
|
12012
|
+
this.description = description;
|
|
12013
|
+
}
|
|
12014
|
+
static deSerialize(buf) {
|
|
12015
|
+
return new _Alert(
|
|
12016
|
+
...Object.values(decode2(buf, _Alert.spec))
|
|
12017
|
+
);
|
|
12018
|
+
}
|
|
12019
|
+
serialize() {
|
|
12020
|
+
return encode2(this, _Alert.spec);
|
|
12021
|
+
}
|
|
12022
|
+
};
|
|
12023
|
+
|
|
11742
12024
|
// ../dtls/src/helper.ts
|
|
11743
12025
|
var dumpBuffer2 = (data) => "0x" + data.toString("hex").replace(/(.)(.)/g, "$1$2 ").split(" ").filter((s) => s != void 0 && s.length > 0).join(",0x");
|
|
11744
12026
|
var getObjectSummary = (obj) => Object.entries({ ...obj }).reduce((acc, [key, value]) => {
|
|
@@ -11751,8 +12033,130 @@ var getObjectSummary = (obj) => Object.entries({ ...obj }).reduce((acc, [key, va
|
|
|
11751
12033
|
return acc;
|
|
11752
12034
|
}, {});
|
|
11753
12035
|
|
|
12036
|
+
// ../dtls/src/handshake/binary.ts
|
|
12037
|
+
var { types: types3 } = binaryData_exports;
|
|
12038
|
+
var { uint16be, uint24be, buffer: buffer2, array: array2, uint8, string: string3 } = types3;
|
|
12039
|
+
var Extension = {
|
|
12040
|
+
type: uint16be,
|
|
12041
|
+
data: buffer2(uint16be)
|
|
12042
|
+
};
|
|
12043
|
+
var ExtensionList = array2(Extension, uint16be, "bytes");
|
|
12044
|
+
var ASN11Cert = buffer2(uint24be);
|
|
12045
|
+
var ClientCertificateType = uint8;
|
|
12046
|
+
var DistinguishedName = string3(uint16be);
|
|
12047
|
+
var SignatureHashAlgorithm = { hash: uint8, signature: uint8 };
|
|
12048
|
+
var ProtocolVersion = { major: uint8, minor: uint8 };
|
|
12049
|
+
|
|
12050
|
+
// ../dtls/src/record/message/header.ts
|
|
12051
|
+
var { decode: decode3, encode: encode3, types: types4 } = binaryData_exports;
|
|
12052
|
+
var MACHeader = class _MACHeader {
|
|
12053
|
+
epoch;
|
|
12054
|
+
sequenceNumber;
|
|
12055
|
+
contentType;
|
|
12056
|
+
protocolVersion;
|
|
12057
|
+
contentLen;
|
|
12058
|
+
static spec = {
|
|
12059
|
+
epoch: types4.uint16be,
|
|
12060
|
+
sequenceNumber: types4.uint48be,
|
|
12061
|
+
contentType: types4.uint8,
|
|
12062
|
+
protocolVersion: ProtocolVersion,
|
|
12063
|
+
contentLen: types4.uint16be
|
|
12064
|
+
};
|
|
12065
|
+
constructor(epoch, sequenceNumber, contentType, protocolVersion, contentLen) {
|
|
12066
|
+
this.epoch = epoch;
|
|
12067
|
+
this.sequenceNumber = sequenceNumber;
|
|
12068
|
+
this.contentType = contentType;
|
|
12069
|
+
this.protocolVersion = protocolVersion;
|
|
12070
|
+
this.contentLen = contentLen;
|
|
12071
|
+
}
|
|
12072
|
+
static createEmpty() {
|
|
12073
|
+
return new _MACHeader(
|
|
12074
|
+
void 0,
|
|
12075
|
+
void 0,
|
|
12076
|
+
void 0,
|
|
12077
|
+
void 0,
|
|
12078
|
+
void 0
|
|
12079
|
+
);
|
|
12080
|
+
}
|
|
12081
|
+
static deSerialize(buf) {
|
|
12082
|
+
return new _MACHeader(
|
|
12083
|
+
...Object.values(decode3(buf, _MACHeader.spec))
|
|
12084
|
+
);
|
|
12085
|
+
}
|
|
12086
|
+
serialize() {
|
|
12087
|
+
return encode3(this, _MACHeader.spec);
|
|
12088
|
+
}
|
|
12089
|
+
};
|
|
12090
|
+
|
|
12091
|
+
// ../dtls/src/cipher/const.ts
|
|
12092
|
+
var SignatureAlgorithm = {
|
|
12093
|
+
rsa_1: 1,
|
|
12094
|
+
ecdsa_3: 3
|
|
12095
|
+
};
|
|
12096
|
+
var HashAlgorithm = {
|
|
12097
|
+
sha256_4: 4
|
|
12098
|
+
};
|
|
12099
|
+
var CipherSuite = {
|
|
12100
|
+
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_49195: 49195,
|
|
12101
|
+
//49195,
|
|
12102
|
+
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256_49199: 49199
|
|
12103
|
+
//49199
|
|
12104
|
+
};
|
|
12105
|
+
var CipherSuiteList = Object.values(CipherSuite);
|
|
12106
|
+
var NamedCurveAlgorithm = {
|
|
12107
|
+
x25519_29: 29,
|
|
12108
|
+
secp256r1_23: 23
|
|
12109
|
+
};
|
|
12110
|
+
var NamedCurveAlgorithmList = Object.values(NamedCurveAlgorithm);
|
|
12111
|
+
var CurveType = { named_curve_3: 3 };
|
|
12112
|
+
var signatures = [
|
|
12113
|
+
{ hash: HashAlgorithm.sha256_4, signature: SignatureAlgorithm.rsa_1 },
|
|
12114
|
+
{ hash: HashAlgorithm.sha256_4, signature: SignatureAlgorithm.ecdsa_3 }
|
|
12115
|
+
];
|
|
12116
|
+
|
|
12117
|
+
// ../dtls/src/cipher/suites/abstract.ts
|
|
12118
|
+
var SessionType = {
|
|
12119
|
+
CLIENT: 1,
|
|
12120
|
+
SERVER: 2
|
|
12121
|
+
};
|
|
12122
|
+
var AbstractCipher = class {
|
|
12123
|
+
id = 0;
|
|
12124
|
+
name;
|
|
12125
|
+
hashAlgorithm;
|
|
12126
|
+
verifyDataLength = 12;
|
|
12127
|
+
blockAlgorithm;
|
|
12128
|
+
kx;
|
|
12129
|
+
/**
|
|
12130
|
+
* Init cipher.
|
|
12131
|
+
* @abstract
|
|
12132
|
+
*/
|
|
12133
|
+
init(...args) {
|
|
12134
|
+
throw new Error("not implemented");
|
|
12135
|
+
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Encrypts data.
|
|
12138
|
+
* @abstract
|
|
12139
|
+
*/
|
|
12140
|
+
encrypt(...args) {
|
|
12141
|
+
throw new Error("not implemented");
|
|
12142
|
+
}
|
|
12143
|
+
/**
|
|
12144
|
+
* Decrypts data.
|
|
12145
|
+
* @abstract
|
|
12146
|
+
*/
|
|
12147
|
+
decrypt(...args) {
|
|
12148
|
+
throw new Error("not implemented");
|
|
12149
|
+
}
|
|
12150
|
+
/**
|
|
12151
|
+
* @returns {string}
|
|
12152
|
+
*/
|
|
12153
|
+
toString() {
|
|
12154
|
+
return this.name;
|
|
12155
|
+
}
|
|
12156
|
+
};
|
|
12157
|
+
|
|
11754
12158
|
// ../dtls/src/record/message/fragment.ts
|
|
11755
|
-
var { decode:
|
|
12159
|
+
var { decode: decode4, encode: encode4, types: types5 } = binaryData_exports;
|
|
11756
12160
|
var FragmentedHandshake = class _FragmentedHandshake {
|
|
11757
12161
|
msg_type;
|
|
11758
12162
|
length;
|
|
@@ -11761,12 +12165,12 @@ var FragmentedHandshake = class _FragmentedHandshake {
|
|
|
11761
12165
|
fragment_length;
|
|
11762
12166
|
fragment;
|
|
11763
12167
|
static spec = {
|
|
11764
|
-
msg_type:
|
|
11765
|
-
length:
|
|
11766
|
-
message_seq:
|
|
11767
|
-
fragment_offset:
|
|
11768
|
-
fragment_length:
|
|
11769
|
-
fragment:
|
|
12168
|
+
msg_type: types5.uint8,
|
|
12169
|
+
length: types5.uint24be,
|
|
12170
|
+
message_seq: types5.uint16be,
|
|
12171
|
+
fragment_offset: types5.uint24be,
|
|
12172
|
+
fragment_length: types5.uint24be,
|
|
12173
|
+
fragment: types5.buffer((context) => context.current.fragment_length)
|
|
11770
12174
|
};
|
|
11771
12175
|
constructor(msg_type, length, message_seq, fragment_offset, fragment_length, fragment) {
|
|
11772
12176
|
this.msg_type = msg_type;
|
|
@@ -11791,11 +12195,11 @@ var FragmentedHandshake = class _FragmentedHandshake {
|
|
|
11791
12195
|
}
|
|
11792
12196
|
static deSerialize(buf) {
|
|
11793
12197
|
return new _FragmentedHandshake(
|
|
11794
|
-
...Object.values(
|
|
12198
|
+
...Object.values(decode4(buf, _FragmentedHandshake.spec))
|
|
11795
12199
|
);
|
|
11796
12200
|
}
|
|
11797
12201
|
serialize() {
|
|
11798
|
-
return
|
|
12202
|
+
return encode4(this, _FragmentedHandshake.spec);
|
|
11799
12203
|
}
|
|
11800
12204
|
chunk(maxFragmentLength) {
|
|
11801
12205
|
let start = 0;
|
|
@@ -11867,20 +12271,6 @@ var FragmentedHandshake = class _FragmentedHandshake {
|
|
|
11867
12271
|
}
|
|
11868
12272
|
};
|
|
11869
12273
|
|
|
11870
|
-
// ../dtls/src/handshake/binary.ts
|
|
11871
|
-
var { types: types3 } = binaryData_exports;
|
|
11872
|
-
var { uint16be, uint24be, buffer: buffer2, array: array2, uint8, string: string3 } = types3;
|
|
11873
|
-
var Extension = {
|
|
11874
|
-
type: uint16be,
|
|
11875
|
-
data: buffer2(uint16be)
|
|
11876
|
-
};
|
|
11877
|
-
var ExtensionList = array2(Extension, uint16be, "bytes");
|
|
11878
|
-
var ASN11Cert = buffer2(uint24be);
|
|
11879
|
-
var ClientCertificateType = uint8;
|
|
11880
|
-
var DistinguishedName = string3(uint16be);
|
|
11881
|
-
var SignatureHashAlgorithm = { hash: uint8, signature: uint8 };
|
|
11882
|
-
var ProtocolVersion = { major: uint8, minor: uint8 };
|
|
11883
|
-
|
|
11884
12274
|
// ../dtls/src/handshake/const.ts
|
|
11885
12275
|
var HandshakeType = {
|
|
11886
12276
|
hello_request_0: 0,
|
|
@@ -11898,13 +12288,13 @@ var HandshakeType = {
|
|
|
11898
12288
|
|
|
11899
12289
|
// ../dtls/src/handshake/random.ts
|
|
11900
12290
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
11901
|
-
var { decode:
|
|
12291
|
+
var { decode: decode5, encode: encode5, types: types6 } = binaryData_exports;
|
|
11902
12292
|
var DtlsRandom = class _DtlsRandom {
|
|
11903
12293
|
gmt_unix_time;
|
|
11904
12294
|
random_bytes;
|
|
11905
12295
|
static spec = {
|
|
11906
|
-
gmt_unix_time:
|
|
11907
|
-
random_bytes:
|
|
12296
|
+
gmt_unix_time: types6.uint32be,
|
|
12297
|
+
random_bytes: types6.buffer(28)
|
|
11908
12298
|
};
|
|
11909
12299
|
constructor(gmt_unix_time = Math.floor(Date.now() / 1e3), random_bytes = randomBytes3(28)) {
|
|
11910
12300
|
this.gmt_unix_time = gmt_unix_time;
|
|
@@ -11912,19 +12302,19 @@ var DtlsRandom = class _DtlsRandom {
|
|
|
11912
12302
|
}
|
|
11913
12303
|
static deSerialize(buf) {
|
|
11914
12304
|
return new _DtlsRandom(
|
|
11915
|
-
...Object.values(
|
|
12305
|
+
...Object.values(decode5(buf, _DtlsRandom.spec))
|
|
11916
12306
|
);
|
|
11917
12307
|
}
|
|
11918
12308
|
static from(spec) {
|
|
11919
12309
|
return new _DtlsRandom(...Object.values(spec));
|
|
11920
12310
|
}
|
|
11921
12311
|
serialize() {
|
|
11922
|
-
return
|
|
12312
|
+
return encode5(this, _DtlsRandom.spec);
|
|
11923
12313
|
}
|
|
11924
12314
|
};
|
|
11925
12315
|
|
|
11926
12316
|
// ../dtls/src/handshake/message/client/hello.ts
|
|
11927
|
-
var { decode:
|
|
12317
|
+
var { decode: decode6, encode: encode6, types: types7 } = binaryData_exports;
|
|
11928
12318
|
var ClientHello = class _ClientHello {
|
|
11929
12319
|
clientVersion;
|
|
11930
12320
|
random;
|
|
@@ -11936,12 +12326,12 @@ var ClientHello = class _ClientHello {
|
|
|
11936
12326
|
msgType = HandshakeType.client_hello_1;
|
|
11937
12327
|
messageSeq = 0;
|
|
11938
12328
|
static spec = {
|
|
11939
|
-
clientVersion: { major:
|
|
12329
|
+
clientVersion: { major: types7.uint8, minor: types7.uint8 },
|
|
11940
12330
|
random: DtlsRandom.spec,
|
|
11941
|
-
sessionId:
|
|
11942
|
-
cookie:
|
|
11943
|
-
cipherSuites:
|
|
11944
|
-
compressionMethods:
|
|
12331
|
+
sessionId: types7.buffer(types7.uint8),
|
|
12332
|
+
cookie: types7.buffer(types7.uint8),
|
|
12333
|
+
cipherSuites: types7.array(types7.uint16be, types7.uint16be, "bytes"),
|
|
12334
|
+
compressionMethods: types7.array(types7.uint8, types7.uint8, "bytes"),
|
|
11945
12335
|
extensions: ExtensionList
|
|
11946
12336
|
};
|
|
11947
12337
|
constructor(clientVersion, random, sessionId, cookie, cipherSuites2, compressionMethods, extensions) {
|
|
@@ -11966,11 +12356,11 @@ var ClientHello = class _ClientHello {
|
|
|
11966
12356
|
}
|
|
11967
12357
|
static deSerialize(buf) {
|
|
11968
12358
|
return new _ClientHello(
|
|
11969
|
-
...Object.values(
|
|
12359
|
+
...Object.values(decode6(buf, _ClientHello.spec))
|
|
11970
12360
|
);
|
|
11971
12361
|
}
|
|
11972
12362
|
serialize() {
|
|
11973
|
-
return
|
|
12363
|
+
return encode6(this, _ClientHello.spec);
|
|
11974
12364
|
}
|
|
11975
12365
|
toFragment() {
|
|
11976
12366
|
const body = this.serialize();
|
|
@@ -11985,47 +12375,6 @@ var ClientHello = class _ClientHello {
|
|
|
11985
12375
|
}
|
|
11986
12376
|
};
|
|
11987
12377
|
|
|
11988
|
-
// ../dtls/src/record/message/header.ts
|
|
11989
|
-
var { decode: decode5, encode: encode5, types: types6 } = binaryData_exports;
|
|
11990
|
-
var MACHeader = class _MACHeader {
|
|
11991
|
-
epoch;
|
|
11992
|
-
sequenceNumber;
|
|
11993
|
-
contentType;
|
|
11994
|
-
protocolVersion;
|
|
11995
|
-
contentLen;
|
|
11996
|
-
static spec = {
|
|
11997
|
-
epoch: types6.uint16be,
|
|
11998
|
-
sequenceNumber: types6.uint48be,
|
|
11999
|
-
contentType: types6.uint8,
|
|
12000
|
-
protocolVersion: ProtocolVersion,
|
|
12001
|
-
contentLen: types6.uint16be
|
|
12002
|
-
};
|
|
12003
|
-
constructor(epoch, sequenceNumber, contentType, protocolVersion, contentLen) {
|
|
12004
|
-
this.epoch = epoch;
|
|
12005
|
-
this.sequenceNumber = sequenceNumber;
|
|
12006
|
-
this.contentType = contentType;
|
|
12007
|
-
this.protocolVersion = protocolVersion;
|
|
12008
|
-
this.contentLen = contentLen;
|
|
12009
|
-
}
|
|
12010
|
-
static createEmpty() {
|
|
12011
|
-
return new _MACHeader(
|
|
12012
|
-
void 0,
|
|
12013
|
-
void 0,
|
|
12014
|
-
void 0,
|
|
12015
|
-
void 0,
|
|
12016
|
-
void 0
|
|
12017
|
-
);
|
|
12018
|
-
}
|
|
12019
|
-
static deSerialize(buf) {
|
|
12020
|
-
return new _MACHeader(
|
|
12021
|
-
...Object.values(decode5(buf, _MACHeader.spec))
|
|
12022
|
-
);
|
|
12023
|
-
}
|
|
12024
|
-
serialize() {
|
|
12025
|
-
return encode5(this, _MACHeader.spec);
|
|
12026
|
-
}
|
|
12027
|
-
};
|
|
12028
|
-
|
|
12029
12378
|
// ../dtls/src/flight/flight.ts
|
|
12030
12379
|
var warn = debug("werift-dtls : packages/dtls/src/flight/flight.ts : warn");
|
|
12031
12380
|
var err = debug("werift-dtls : packages/dtls/src/flight/flight.ts : err");
|
|
@@ -12575,12 +12924,12 @@ var ExtendedMasterSecret = class {
|
|
|
12575
12924
|
};
|
|
12576
12925
|
|
|
12577
12926
|
// ../dtls/src/handshake/extensions/renegotiationIndication.ts
|
|
12578
|
-
var { decode:
|
|
12927
|
+
var { decode: decode7, encode: encode7, types: types8 } = binaryData_exports;
|
|
12579
12928
|
var RenegotiationIndication = class _RenegotiationIndication {
|
|
12580
12929
|
static type = 65281;
|
|
12581
12930
|
static spec = {
|
|
12582
|
-
type:
|
|
12583
|
-
data:
|
|
12931
|
+
type: types8.uint16be,
|
|
12932
|
+
data: types8.uint8
|
|
12584
12933
|
};
|
|
12585
12934
|
type = _RenegotiationIndication.type;
|
|
12586
12935
|
data = 0;
|
|
@@ -12593,11 +12942,11 @@ var RenegotiationIndication = class _RenegotiationIndication {
|
|
|
12593
12942
|
}
|
|
12594
12943
|
static deSerialize(buf) {
|
|
12595
12944
|
return new _RenegotiationIndication(
|
|
12596
|
-
|
|
12945
|
+
decode7(buf, _RenegotiationIndication.spec)
|
|
12597
12946
|
);
|
|
12598
12947
|
}
|
|
12599
12948
|
serialize() {
|
|
12600
|
-
return
|
|
12949
|
+
return encode7(this, _RenegotiationIndication.spec);
|
|
12601
12950
|
}
|
|
12602
12951
|
get extension() {
|
|
12603
12952
|
return {
|
|
@@ -12608,13 +12957,13 @@ var RenegotiationIndication = class _RenegotiationIndication {
|
|
|
12608
12957
|
};
|
|
12609
12958
|
|
|
12610
12959
|
// ../dtls/src/handshake/extensions/useSrtp.ts
|
|
12611
|
-
var { decode:
|
|
12960
|
+
var { decode: decode8, encode: encode8, types: types9 } = binaryData_exports;
|
|
12612
12961
|
var UseSRTP = class _UseSRTP {
|
|
12613
12962
|
static type = 14;
|
|
12614
12963
|
// 9. IANA Considerations
|
|
12615
12964
|
static spec = {
|
|
12616
|
-
type:
|
|
12617
|
-
data:
|
|
12965
|
+
type: types9.uint16be,
|
|
12966
|
+
data: types9.buffer(types9.uint16be)
|
|
12618
12967
|
};
|
|
12619
12968
|
type = _UseSRTP.type;
|
|
12620
12969
|
data = Buffer.from([]);
|
|
@@ -12631,7 +12980,7 @@ var UseSRTP = class _UseSRTP {
|
|
|
12631
12980
|
return v;
|
|
12632
12981
|
}
|
|
12633
12982
|
static deSerialize(buf) {
|
|
12634
|
-
const useSrtp = new _UseSRTP(
|
|
12983
|
+
const useSrtp = new _UseSRTP(decode8(buf, _UseSRTP.spec));
|
|
12635
12984
|
const profileLength = useSrtp.data.readUInt16BE();
|
|
12636
12985
|
const profiles = new Array(profileLength / 2);
|
|
12637
12986
|
for (let i = 0; i < profiles.length; i++) {
|
|
@@ -12654,7 +13003,7 @@ var UseSRTP = class _UseSRTP {
|
|
|
12654
13003
|
this.mki
|
|
12655
13004
|
]);
|
|
12656
13005
|
this.data = data;
|
|
12657
|
-
return
|
|
13006
|
+
return encode8(this, _UseSRTP.spec);
|
|
12658
13007
|
}
|
|
12659
13008
|
static fromData(buf) {
|
|
12660
13009
|
const head = Buffer.alloc(4);
|
|
@@ -12671,13 +13020,13 @@ var UseSRTP = class _UseSRTP {
|
|
|
12671
13020
|
};
|
|
12672
13021
|
|
|
12673
13022
|
// ../dtls/src/handshake/message/certificate.ts
|
|
12674
|
-
var { decode:
|
|
13023
|
+
var { decode: decode9, encode: encode9, types: types10 } = binaryData_exports;
|
|
12675
13024
|
var Certificate = class _Certificate {
|
|
12676
13025
|
certificateList;
|
|
12677
13026
|
msgType = HandshakeType.certificate_11;
|
|
12678
13027
|
messageSeq;
|
|
12679
13028
|
static spec = {
|
|
12680
|
-
certificateList:
|
|
13029
|
+
certificateList: types10.array(ASN11Cert, types10.uint24be, "bytes")
|
|
12681
13030
|
};
|
|
12682
13031
|
constructor(certificateList) {
|
|
12683
13032
|
this.certificateList = certificateList;
|
|
@@ -12687,11 +13036,11 @@ var Certificate = class _Certificate {
|
|
|
12687
13036
|
}
|
|
12688
13037
|
static deSerialize(buf) {
|
|
12689
13038
|
return new _Certificate(
|
|
12690
|
-
...Object.values(
|
|
13039
|
+
...Object.values(decode9(buf, _Certificate.spec))
|
|
12691
13040
|
);
|
|
12692
13041
|
}
|
|
12693
13042
|
serialize() {
|
|
12694
|
-
return
|
|
13043
|
+
return encode9(this, _Certificate.spec);
|
|
12695
13044
|
}
|
|
12696
13045
|
toFragment() {
|
|
12697
13046
|
const body = this.serialize();
|
|
@@ -12707,11 +13056,11 @@ var Certificate = class _Certificate {
|
|
|
12707
13056
|
};
|
|
12708
13057
|
|
|
12709
13058
|
// ../dtls/src/handshake/message/changeCipherSpec.ts
|
|
12710
|
-
var { decode:
|
|
13059
|
+
var { decode: decode10, encode: encode10, types: types11 } = binaryData_exports;
|
|
12711
13060
|
var ChangeCipherSpec = class _ChangeCipherSpec {
|
|
12712
13061
|
type;
|
|
12713
13062
|
static spec = {
|
|
12714
|
-
type:
|
|
13063
|
+
type: types11.uint8
|
|
12715
13064
|
};
|
|
12716
13065
|
constructor(type = 1) {
|
|
12717
13066
|
this.type = type;
|
|
@@ -12720,24 +13069,24 @@ var ChangeCipherSpec = class _ChangeCipherSpec {
|
|
|
12720
13069
|
return new _ChangeCipherSpec();
|
|
12721
13070
|
}
|
|
12722
13071
|
static deSerialize(buf) {
|
|
12723
|
-
const { type } =
|
|
13072
|
+
const { type } = decode10(buf, _ChangeCipherSpec.spec);
|
|
12724
13073
|
return new _ChangeCipherSpec(type);
|
|
12725
13074
|
}
|
|
12726
13075
|
serialize() {
|
|
12727
|
-
return
|
|
13076
|
+
return encode10(this, _ChangeCipherSpec.spec);
|
|
12728
13077
|
}
|
|
12729
13078
|
};
|
|
12730
13079
|
|
|
12731
13080
|
// ../dtls/src/handshake/message/client/certificateVerify.ts
|
|
12732
|
-
var { decode:
|
|
13081
|
+
var { decode: decode11, encode: encode11, types: types12 } = binaryData_exports;
|
|
12733
13082
|
var CertificateVerify = class _CertificateVerify {
|
|
12734
13083
|
algorithm;
|
|
12735
13084
|
signature;
|
|
12736
13085
|
msgType = HandshakeType.certificate_verify_15;
|
|
12737
13086
|
messageSeq;
|
|
12738
13087
|
static spec = {
|
|
12739
|
-
algorithm:
|
|
12740
|
-
signature:
|
|
13088
|
+
algorithm: types12.uint16be,
|
|
13089
|
+
signature: types12.buffer(types12.uint16be)
|
|
12741
13090
|
};
|
|
12742
13091
|
constructor(algorithm, signature) {
|
|
12743
13092
|
this.algorithm = algorithm;
|
|
@@ -12747,13 +13096,13 @@ var CertificateVerify = class _CertificateVerify {
|
|
|
12747
13096
|
return new _CertificateVerify(void 0, void 0);
|
|
12748
13097
|
}
|
|
12749
13098
|
static deSerialize(buf) {
|
|
12750
|
-
const res =
|
|
13099
|
+
const res = decode11(buf, _CertificateVerify.spec);
|
|
12751
13100
|
return new _CertificateVerify(
|
|
12752
13101
|
...Object.values(res)
|
|
12753
13102
|
);
|
|
12754
13103
|
}
|
|
12755
13104
|
serialize() {
|
|
12756
|
-
return
|
|
13105
|
+
return encode11(this, _CertificateVerify.spec);
|
|
12757
13106
|
}
|
|
12758
13107
|
toFragment() {
|
|
12759
13108
|
const body = this.serialize();
|
|
@@ -12769,13 +13118,13 @@ var CertificateVerify = class _CertificateVerify {
|
|
|
12769
13118
|
};
|
|
12770
13119
|
|
|
12771
13120
|
// ../dtls/src/handshake/message/client/keyExchange.ts
|
|
12772
|
-
var { decode:
|
|
13121
|
+
var { decode: decode12, encode: encode12, types: types13 } = binaryData_exports;
|
|
12773
13122
|
var ClientKeyExchange = class _ClientKeyExchange {
|
|
12774
13123
|
publicKey;
|
|
12775
13124
|
msgType = HandshakeType.client_key_exchange_16;
|
|
12776
13125
|
messageSeq;
|
|
12777
13126
|
static spec = {
|
|
12778
|
-
publicKey:
|
|
13127
|
+
publicKey: types13.buffer(types13.uint8)
|
|
12779
13128
|
};
|
|
12780
13129
|
constructor(publicKey) {
|
|
12781
13130
|
this.publicKey = publicKey;
|
|
@@ -12784,13 +13133,13 @@ var ClientKeyExchange = class _ClientKeyExchange {
|
|
|
12784
13133
|
return new _ClientKeyExchange(void 0);
|
|
12785
13134
|
}
|
|
12786
13135
|
static deSerialize(buf) {
|
|
12787
|
-
const res =
|
|
13136
|
+
const res = decode12(buf, _ClientKeyExchange.spec);
|
|
12788
13137
|
return new _ClientKeyExchange(
|
|
12789
13138
|
...Object.values(res)
|
|
12790
13139
|
);
|
|
12791
13140
|
}
|
|
12792
13141
|
serialize() {
|
|
12793
|
-
return
|
|
13142
|
+
return encode12(this, _ClientKeyExchange.spec);
|
|
12794
13143
|
}
|
|
12795
13144
|
toFragment() {
|
|
12796
13145
|
const body = this.serialize();
|
|
@@ -12806,7 +13155,7 @@ var ClientKeyExchange = class _ClientKeyExchange {
|
|
|
12806
13155
|
};
|
|
12807
13156
|
|
|
12808
13157
|
// ../dtls/src/handshake/message/server/certificateRequest.ts
|
|
12809
|
-
var { decode:
|
|
13158
|
+
var { decode: decode13, encode: encode13, types: types14 } = binaryData_exports;
|
|
12810
13159
|
var ServerCertificateRequest = class _ServerCertificateRequest {
|
|
12811
13160
|
certificateTypes;
|
|
12812
13161
|
signatures;
|
|
@@ -12814,9 +13163,9 @@ var ServerCertificateRequest = class _ServerCertificateRequest {
|
|
|
12814
13163
|
msgType = HandshakeType.certificate_request_13;
|
|
12815
13164
|
messageSeq;
|
|
12816
13165
|
static spec = {
|
|
12817
|
-
certificateTypes:
|
|
12818
|
-
signatures:
|
|
12819
|
-
authorities:
|
|
13166
|
+
certificateTypes: types14.array(ClientCertificateType, types14.uint8, "bytes"),
|
|
13167
|
+
signatures: types14.array(SignatureHashAlgorithm, types14.uint16be, "bytes"),
|
|
13168
|
+
authorities: types14.array(DistinguishedName, types14.uint16be, "bytes")
|
|
12820
13169
|
};
|
|
12821
13170
|
constructor(certificateTypes2, signatures2, authorities) {
|
|
12822
13171
|
this.certificateTypes = certificateTypes2;
|
|
@@ -12832,11 +13181,11 @@ var ServerCertificateRequest = class _ServerCertificateRequest {
|
|
|
12832
13181
|
}
|
|
12833
13182
|
static deSerialize(buf) {
|
|
12834
13183
|
return new _ServerCertificateRequest(
|
|
12835
|
-
...Object.values(
|
|
13184
|
+
...Object.values(decode13(buf, _ServerCertificateRequest.spec))
|
|
12836
13185
|
);
|
|
12837
13186
|
}
|
|
12838
13187
|
serialize() {
|
|
12839
|
-
return
|
|
13188
|
+
return encode13(this, _ServerCertificateRequest.spec);
|
|
12840
13189
|
}
|
|
12841
13190
|
toFragment() {
|
|
12842
13191
|
const body = this.serialize();
|
|
@@ -12852,7 +13201,7 @@ var ServerCertificateRequest = class _ServerCertificateRequest {
|
|
|
12852
13201
|
};
|
|
12853
13202
|
|
|
12854
13203
|
// ../dtls/src/handshake/message/server/hello.ts
|
|
12855
|
-
var { decode:
|
|
13204
|
+
var { decode: decode14, encode: encode14, types: types15 } = binaryData_exports;
|
|
12856
13205
|
var ServerHello = class _ServerHello {
|
|
12857
13206
|
serverVersion;
|
|
12858
13207
|
random;
|
|
@@ -12865,9 +13214,9 @@ var ServerHello = class _ServerHello {
|
|
|
12865
13214
|
static spec = {
|
|
12866
13215
|
serverVersion: ProtocolVersion,
|
|
12867
13216
|
random: DtlsRandom.spec,
|
|
12868
|
-
sessionId:
|
|
12869
|
-
cipherSuite:
|
|
12870
|
-
compressionMethod:
|
|
13217
|
+
sessionId: types15.buffer(types15.uint8),
|
|
13218
|
+
cipherSuite: types15.uint16be,
|
|
13219
|
+
compressionMethod: types15.uint8
|
|
12871
13220
|
};
|
|
12872
13221
|
constructor(serverVersion, random, sessionId, cipherSuite, compressionMethod, extensions) {
|
|
12873
13222
|
this.serverVersion = serverVersion;
|
|
@@ -12888,7 +13237,7 @@ var ServerHello = class _ServerHello {
|
|
|
12888
13237
|
);
|
|
12889
13238
|
}
|
|
12890
13239
|
static deSerialize(buf) {
|
|
12891
|
-
const res =
|
|
13240
|
+
const res = decode14(buf, _ServerHello.spec);
|
|
12892
13241
|
const cls = new _ServerHello(
|
|
12893
13242
|
...Object.values(res)
|
|
12894
13243
|
);
|
|
@@ -12896,14 +13245,14 @@ var ServerHello = class _ServerHello {
|
|
|
12896
13245
|
if (expect.length < buf.length) {
|
|
12897
13246
|
return new _ServerHello(
|
|
12898
13247
|
...Object.values(
|
|
12899
|
-
|
|
13248
|
+
decode14(buf, { ..._ServerHello.spec, extensions: ExtensionList })
|
|
12900
13249
|
)
|
|
12901
13250
|
);
|
|
12902
13251
|
}
|
|
12903
13252
|
return cls;
|
|
12904
13253
|
}
|
|
12905
13254
|
serialize() {
|
|
12906
|
-
return this.extensions === void 0 ?
|
|
13255
|
+
return this.extensions === void 0 ? encode14(this, _ServerHello.spec) : encode14(this, {
|
|
12907
13256
|
..._ServerHello.spec,
|
|
12908
13257
|
extensions: ExtensionList
|
|
12909
13258
|
});
|
|
@@ -12922,16 +13271,16 @@ var ServerHello = class _ServerHello {
|
|
|
12922
13271
|
};
|
|
12923
13272
|
|
|
12924
13273
|
// ../dtls/src/handshake/message/server/helloDone.ts
|
|
12925
|
-
var { decode:
|
|
13274
|
+
var { decode: decode15, encode: encode15 } = binaryData_exports;
|
|
12926
13275
|
|
|
12927
13276
|
// ../dtls/src/util/binary.ts
|
|
12928
|
-
var { encode:
|
|
13277
|
+
var { encode: encode16 } = binaryData_exports;
|
|
12929
13278
|
function encodeBuffer(obj, spec) {
|
|
12930
|
-
return
|
|
13279
|
+
return encode16(obj, spec);
|
|
12931
13280
|
}
|
|
12932
13281
|
|
|
12933
13282
|
// ../dtls/src/handshake/message/server/keyExchange.ts
|
|
12934
|
-
var { decode:
|
|
13283
|
+
var { decode: decode16, types: types16 } = binaryData_exports;
|
|
12935
13284
|
var ServerKeyExchange = class _ServerKeyExchange {
|
|
12936
13285
|
ellipticCurveType;
|
|
12937
13286
|
namedCurve;
|
|
@@ -12944,14 +13293,14 @@ var ServerKeyExchange = class _ServerKeyExchange {
|
|
|
12944
13293
|
msgType = HandshakeType.server_key_exchange_12;
|
|
12945
13294
|
messageSeq;
|
|
12946
13295
|
static spec = {
|
|
12947
|
-
ellipticCurveType:
|
|
12948
|
-
namedCurve:
|
|
12949
|
-
publicKeyLength:
|
|
12950
|
-
publicKey:
|
|
12951
|
-
hashAlgorithm:
|
|
12952
|
-
signatureAlgorithm:
|
|
12953
|
-
signatureLength:
|
|
12954
|
-
signature:
|
|
13296
|
+
ellipticCurveType: types16.uint8,
|
|
13297
|
+
namedCurve: types16.uint16be,
|
|
13298
|
+
publicKeyLength: types16.uint8,
|
|
13299
|
+
publicKey: types16.buffer((ctx) => ctx.current.publicKeyLength),
|
|
13300
|
+
hashAlgorithm: types16.uint8,
|
|
13301
|
+
signatureAlgorithm: types16.uint8,
|
|
13302
|
+
signatureLength: types16.uint16be,
|
|
13303
|
+
signature: types16.buffer((ctx) => ctx.current.signatureLength)
|
|
12955
13304
|
};
|
|
12956
13305
|
constructor(ellipticCurveType, namedCurve, publicKeyLength, publicKey, hashAlgorithm, signatureAlgorithm, signatureLength, signature) {
|
|
12957
13306
|
this.ellipticCurveType = ellipticCurveType;
|
|
@@ -12976,7 +13325,7 @@ var ServerKeyExchange = class _ServerKeyExchange {
|
|
|
12976
13325
|
);
|
|
12977
13326
|
}
|
|
12978
13327
|
static deSerialize(buf) {
|
|
12979
|
-
const res =
|
|
13328
|
+
const res = decode16(buf, _ServerKeyExchange.spec);
|
|
12980
13329
|
return new _ServerKeyExchange(
|
|
12981
13330
|
...Object.values(res)
|
|
12982
13331
|
);
|
|
@@ -13057,7 +13406,7 @@ handlers[HandshakeType.server_hello_done_14] = ({ dtls }) => (msg) => {
|
|
|
13057
13406
|
};
|
|
13058
13407
|
|
|
13059
13408
|
// ../dtls/src/handshake/message/server/helloVerifyRequest.ts
|
|
13060
|
-
var { decode:
|
|
13409
|
+
var { decode: decode17, encode: encode17, types: types17 } = binaryData_exports;
|
|
13061
13410
|
var ServerHelloVerifyRequest = class _ServerHelloVerifyRequest {
|
|
13062
13411
|
serverVersion;
|
|
13063
13412
|
cookie;
|
|
@@ -13065,7 +13414,7 @@ var ServerHelloVerifyRequest = class _ServerHelloVerifyRequest {
|
|
|
13065
13414
|
messageSeq;
|
|
13066
13415
|
static spec = {
|
|
13067
13416
|
serverVersion: ProtocolVersion,
|
|
13068
|
-
cookie:
|
|
13417
|
+
cookie: types17.buffer(types17.uint8)
|
|
13069
13418
|
};
|
|
13070
13419
|
constructor(serverVersion, cookie) {
|
|
13071
13420
|
this.serverVersion = serverVersion;
|
|
@@ -13076,11 +13425,11 @@ var ServerHelloVerifyRequest = class _ServerHelloVerifyRequest {
|
|
|
13076
13425
|
}
|
|
13077
13426
|
static deSerialize(buf) {
|
|
13078
13427
|
return new _ServerHelloVerifyRequest(
|
|
13079
|
-
...Object.values(
|
|
13428
|
+
...Object.values(decode17(buf, _ServerHelloVerifyRequest.spec))
|
|
13080
13429
|
);
|
|
13081
13430
|
}
|
|
13082
13431
|
serialize() {
|
|
13083
|
-
return
|
|
13432
|
+
return encode17(this, _ServerHelloVerifyRequest.spec);
|
|
13084
13433
|
}
|
|
13085
13434
|
get version() {
|
|
13086
13435
|
return {
|
|
@@ -13179,7 +13528,7 @@ function createSelfSignedCertificatePem({
|
|
|
13179
13528
|
}
|
|
13180
13529
|
|
|
13181
13530
|
// ../dtls/src/context/cipher.ts
|
|
13182
|
-
var { encode:
|
|
13531
|
+
var { encode: encode18, types: types18 } = binaryData_exports;
|
|
13183
13532
|
var generateKeyPairAsync = promisify(generateKeyPair2);
|
|
13184
13533
|
var CipherContext = class {
|
|
13185
13534
|
sessionType;
|
|
@@ -13297,13 +13646,13 @@ var CipherContext = class {
|
|
|
13297
13646
|
this.signatureHashAlgorithm = signatureHash;
|
|
13298
13647
|
}
|
|
13299
13648
|
valueKeySignature(clientRandom, serverRandom, publicKey, namedCurve) {
|
|
13300
|
-
const serverParams =
|
|
13649
|
+
const serverParams = encode18(
|
|
13301
13650
|
{
|
|
13302
13651
|
type: CurveType.named_curve_3,
|
|
13303
13652
|
curve: namedCurve,
|
|
13304
13653
|
len: publicKey.length
|
|
13305
13654
|
},
|
|
13306
|
-
{ type:
|
|
13655
|
+
{ type: types18.uint8, curve: types18.uint16be, len: types18.uint8 }
|
|
13307
13656
|
);
|
|
13308
13657
|
return Buffer.concat([clientRandom, serverRandom, serverParams, publicKey]);
|
|
13309
13658
|
}
|
|
@@ -13317,12 +13666,12 @@ function normalizePem(pem) {
|
|
|
13317
13666
|
var log14 = debug("werift-dtls : packages/dtls/src/context/dtls.ts : log");
|
|
13318
13667
|
|
|
13319
13668
|
// ../dtls/src/handshake/extensions/ellipticCurves.ts
|
|
13320
|
-
var { decode:
|
|
13669
|
+
var { decode: decode18, encode: encode19, types: types19 } = binaryData_exports;
|
|
13321
13670
|
var EllipticCurves = class _EllipticCurves {
|
|
13322
13671
|
static type = 10;
|
|
13323
13672
|
static spec = {
|
|
13324
|
-
type:
|
|
13325
|
-
data:
|
|
13673
|
+
type: types19.uint16be,
|
|
13674
|
+
data: types19.array(types19.uint16be, types19.uint16be, "bytes")
|
|
13326
13675
|
};
|
|
13327
13676
|
type = _EllipticCurves.type;
|
|
13328
13677
|
data = [];
|
|
@@ -13335,14 +13684,14 @@ var EllipticCurves = class _EllipticCurves {
|
|
|
13335
13684
|
static fromData(buf) {
|
|
13336
13685
|
return new _EllipticCurves({
|
|
13337
13686
|
type: _EllipticCurves.type,
|
|
13338
|
-
data:
|
|
13687
|
+
data: decode18(buf, _EllipticCurves.spec.data)
|
|
13339
13688
|
});
|
|
13340
13689
|
}
|
|
13341
13690
|
static deSerialize(buf) {
|
|
13342
|
-
return new _EllipticCurves(
|
|
13691
|
+
return new _EllipticCurves(decode18(buf, _EllipticCurves.spec));
|
|
13343
13692
|
}
|
|
13344
13693
|
serialize() {
|
|
13345
|
-
return
|
|
13694
|
+
return encode19(this, _EllipticCurves.spec);
|
|
13346
13695
|
}
|
|
13347
13696
|
get extension() {
|
|
13348
13697
|
return {
|
|
@@ -13353,14 +13702,14 @@ var EllipticCurves = class _EllipticCurves {
|
|
|
13353
13702
|
};
|
|
13354
13703
|
|
|
13355
13704
|
// ../dtls/src/handshake/extensions/signature.ts
|
|
13356
|
-
var { decode:
|
|
13705
|
+
var { decode: decode19, encode: encode20, types: types20 } = binaryData_exports;
|
|
13357
13706
|
var Signature = class _Signature {
|
|
13358
13707
|
static type = 13;
|
|
13359
13708
|
static spec = {
|
|
13360
|
-
type:
|
|
13361
|
-
data:
|
|
13362
|
-
{ hash:
|
|
13363
|
-
|
|
13709
|
+
type: types20.uint16be,
|
|
13710
|
+
data: types20.array(
|
|
13711
|
+
{ hash: types20.uint8, signature: types20.uint8 },
|
|
13712
|
+
types20.uint16be,
|
|
13364
13713
|
"bytes"
|
|
13365
13714
|
)
|
|
13366
13715
|
};
|
|
@@ -13374,10 +13723,10 @@ var Signature = class _Signature {
|
|
|
13374
13723
|
return v;
|
|
13375
13724
|
}
|
|
13376
13725
|
static deSerialize(buf) {
|
|
13377
|
-
return new _Signature(
|
|
13726
|
+
return new _Signature(decode19(buf, _Signature.spec));
|
|
13378
13727
|
}
|
|
13379
13728
|
serialize() {
|
|
13380
|
-
return
|
|
13729
|
+
return encode20(this, _Signature.spec);
|
|
13381
13730
|
}
|
|
13382
13731
|
static fromData(buf) {
|
|
13383
13732
|
const type = Buffer.alloc(2);
|
|
@@ -13392,29 +13741,6 @@ var Signature = class _Signature {
|
|
|
13392
13741
|
}
|
|
13393
13742
|
};
|
|
13394
13743
|
|
|
13395
|
-
// ../dtls/src/handshake/message/alert.ts
|
|
13396
|
-
var { decode: decode19, encode: encode20, types: types20 } = binaryData_exports;
|
|
13397
|
-
var Alert = class _Alert {
|
|
13398
|
-
level;
|
|
13399
|
-
description;
|
|
13400
|
-
static spec = {
|
|
13401
|
-
level: types20.uint8,
|
|
13402
|
-
description: types20.uint8
|
|
13403
|
-
};
|
|
13404
|
-
constructor(level, description) {
|
|
13405
|
-
this.level = level;
|
|
13406
|
-
this.description = description;
|
|
13407
|
-
}
|
|
13408
|
-
static deSerialize(buf) {
|
|
13409
|
-
return new _Alert(
|
|
13410
|
-
...Object.values(decode19(buf, _Alert.spec))
|
|
13411
|
-
);
|
|
13412
|
-
}
|
|
13413
|
-
serialize() {
|
|
13414
|
-
return encode20(this, _Alert.spec);
|
|
13415
|
-
}
|
|
13416
|
-
};
|
|
13417
|
-
|
|
13418
13744
|
// ../dtls/src/record/receive.ts
|
|
13419
13745
|
var log15 = debug("werift-dtls : packages/dtls/record/receive.ts : log");
|
|
13420
13746
|
var err3 = debug("werift-dtls : packages/dtls/record/receive.ts : err");
|
|
@@ -13487,11 +13813,11 @@ handlers2[HandshakeType.finished_20] = ({ dtls }) => (message) => {
|
|
|
13487
13813
|
// ../dtls/src/server.ts
|
|
13488
13814
|
var log21 = debug("werift-dtls : packages/dtls/src/server.ts : log");
|
|
13489
13815
|
|
|
13490
|
-
// ../ice/src/dns/lookup.ts
|
|
13491
|
-
import mdns from "multicast-dns";
|
|
13492
|
-
|
|
13493
13816
|
// ../ice-server/src/stun/const.ts
|
|
13494
13817
|
var COOKIE = 554869826;
|
|
13818
|
+
var INTEGRITY_LENGTH = 24;
|
|
13819
|
+
var INTEGRITY_SHA256_VALUE_LENGTH = 32;
|
|
13820
|
+
var INTEGRITY_SHA256_LENGTH = 4 + INTEGRITY_SHA256_VALUE_LENGTH;
|
|
13495
13821
|
var IPV4_PROTOCOL = 1;
|
|
13496
13822
|
var IPV6_PROTOCOL = 2;
|
|
13497
13823
|
|
|
@@ -13717,7 +14043,11 @@ var ATTRIBUTES = [
|
|
|
13717
14043
|
[32809, "ICE-CONTROLLED", packUnsigned64, unpackUnsigned64],
|
|
13718
14044
|
[32810, "ICE-CONTROLLING", packUnsigned64, unpackUnsigned64],
|
|
13719
14045
|
[32811, "RESPONSE-ORIGIN", packAddress, unpackAddress],
|
|
13720
|
-
[32812, "OTHER-ADDRESS", packAddress, unpackAddress]
|
|
14046
|
+
[32812, "OTHER-ADDRESS", packAddress, unpackAddress],
|
|
14047
|
+
// draft-thatcher-ice-renomination (libwebrtc's GOOG_NOMINATION): the
|
|
14048
|
+
// controlling agent nominates with an increasing value; the controlled
|
|
14049
|
+
// agent selects the pair with the largest one.
|
|
14050
|
+
[49153, "NOMINATION", packUnsigned, unpackUnsigned]
|
|
13721
14051
|
];
|
|
13722
14052
|
var ATTRIBUTES_BY_TYPE = ATTRIBUTES.reduce(
|
|
13723
14053
|
(acc, cur) => {
|
|
@@ -13734,6 +14064,9 @@ var ATTRIBUTES_BY_NAME = ATTRIBUTES.reduce(
|
|
|
13734
14064
|
{}
|
|
13735
14065
|
);
|
|
13736
14066
|
|
|
14067
|
+
// ../ice-server/src/stun/message.ts
|
|
14068
|
+
var INTEGRITY_SHA1_VALUE_LENGTH = INTEGRITY_LENGTH - 4;
|
|
14069
|
+
|
|
13737
14070
|
// ../ice/src/iceBase.ts
|
|
13738
14071
|
var log22 = debug("werift-ice : packages/ice/src/ice.ts : log");
|
|
13739
14072
|
|
|
@@ -13749,11 +14082,33 @@ var log25 = debug("werift-ice:packages/ice/src/stun/tcpProtocol.ts");
|
|
|
13749
14082
|
// ../ice/src/turn/protocol.ts
|
|
13750
14083
|
var log26 = debug("werift-ice:packages/ice/src/turn/protocol.ts");
|
|
13751
14084
|
|
|
14085
|
+
// ../ice/src/candidateGatherer.ts
|
|
14086
|
+
var log27 = debug("werift-ice : packages/ice/src/candidateGatherer.ts : log");
|
|
14087
|
+
|
|
14088
|
+
// ../ice/src/consent.ts
|
|
14089
|
+
var log28 = debug("werift-ice : packages/ice/src/consent.ts : log");
|
|
14090
|
+
|
|
14091
|
+
// ../ice/src/dns/lookup.ts
|
|
14092
|
+
import mdns from "multicast-dns";
|
|
14093
|
+
|
|
13752
14094
|
// ../ice/src/utils.ts
|
|
13753
14095
|
var logger = debug("werift-ice : packages/ice/src/utils.ts");
|
|
13754
14096
|
|
|
14097
|
+
// ../ice/src/nomination/regularNomination.ts
|
|
14098
|
+
var log29 = debug(
|
|
14099
|
+
"werift-ice : packages/ice/src/nomination/regularNomination.ts : log"
|
|
14100
|
+
);
|
|
14101
|
+
|
|
14102
|
+
// ../ice/src/nomination/selectionReplacement.ts
|
|
14103
|
+
var log30 = debug(
|
|
14104
|
+
"werift-ice : packages/ice/src/nomination/selectionReplacement.ts : log"
|
|
14105
|
+
);
|
|
14106
|
+
|
|
14107
|
+
// ../ice/src/provisional.ts
|
|
14108
|
+
var log31 = debug("werift-ice : packages/ice/src/provisional.ts : log");
|
|
14109
|
+
|
|
13755
14110
|
// ../ice/src/ice.ts
|
|
13756
|
-
var
|
|
14111
|
+
var log32 = debug("werift-ice : packages/ice/src/ice.ts : log");
|
|
13757
14112
|
|
|
13758
14113
|
// ../sctp/src/chunk.ts
|
|
13759
14114
|
var SCTP_PADDING_MULTIPLE = 4;
|
|
@@ -14160,7 +14515,7 @@ function decodeParams(body) {
|
|
|
14160
14515
|
}
|
|
14161
14516
|
|
|
14162
14517
|
// ../sctp/src/sctp.ts
|
|
14163
|
-
var
|
|
14518
|
+
var log33 = debug("werift/sctp/sctp");
|
|
14164
14519
|
var DEFAULT_SCTP_MTU = 1191;
|
|
14165
14520
|
var SCTP_RTO_ALPHA = 1 / 8;
|
|
14166
14521
|
var SCTP_RTO_BETA = 1 / 4;
|
|
@@ -14423,6 +14778,15 @@ var MediaStreamTrack = class _MediaStreamTrack extends EventTarget2 {
|
|
|
14423
14778
|
writeRtcp = (rtcp) => {
|
|
14424
14779
|
this.broadcastSource.deliverRtcp(rtcp);
|
|
14425
14780
|
};
|
|
14781
|
+
/**
|
|
14782
|
+
* Tell the senders of this track that the RTP written with {@link writeRtp}
|
|
14783
|
+
* now comes from another source (for example a recreated upstream
|
|
14784
|
+
* connection). Each `RTCRtpSender` continues its output sequence number /
|
|
14785
|
+
* timestamp from the last sent packet (timestamp step 1; use
|
|
14786
|
+
* `RTCRtpSender.replaceRTP` to choose the step) and drops queued packets of
|
|
14787
|
+
* the old source. `header` is kept for compatibility and is not used for the
|
|
14788
|
+
* offsets. Without an `RTCRtpSender`, use `RtpTimelineRewriter`.
|
|
14789
|
+
*/
|
|
14426
14790
|
notifySourceChanged(header) {
|
|
14427
14791
|
this.broadcastSource.deliverSourceChanged(header);
|
|
14428
14792
|
}
|
|
@@ -14505,14 +14869,14 @@ var MediaStream = class _MediaStream {
|
|
|
14505
14869
|
};
|
|
14506
14870
|
|
|
14507
14871
|
// src/utils.ts
|
|
14508
|
-
var
|
|
14872
|
+
var log34 = debug("werift:packages/webrtc/src/utils.ts");
|
|
14509
14873
|
var milliTime = Date.now;
|
|
14510
14874
|
var startupTimestampInMicroseconds = BigInt(Date.now()) * 1000n - process.hrtime.bigint() / 1000n;
|
|
14511
14875
|
var NTP_FRACTION_SCALE = 2 ** 32;
|
|
14512
14876
|
var createSelfSignedCertificate = CipherContext.createSelfSignedCertificateWithKey;
|
|
14513
14877
|
|
|
14514
14878
|
// src/transport/dtls.ts
|
|
14515
|
-
var
|
|
14879
|
+
var log35 = debug("werift:packages/webrtc/src/transport/dtls.ts");
|
|
14516
14880
|
|
|
14517
14881
|
// src/transport/iceCandidateAttribute.ts
|
|
14518
14882
|
var emptyCandidateFields = Object.freeze({
|
|
@@ -14533,26 +14897,27 @@ var fqdn = new RegExp(
|
|
|
14533
14897
|
);
|
|
14534
14898
|
|
|
14535
14899
|
// src/transport/ice.ts
|
|
14536
|
-
var
|
|
14900
|
+
var log36 = debug("werift:packages/webrtc/src/transport/ice.ts");
|
|
14537
14901
|
|
|
14538
14902
|
// src/transport/sctp.ts
|
|
14539
|
-
var
|
|
14903
|
+
var log37 = debug("werift:packages/webrtc/src/transport/sctp.ts");
|
|
14540
14904
|
var DEFAULT_MAX_MESSAGE_SIZE = 65536;
|
|
14541
14905
|
|
|
14542
|
-
// src/
|
|
14543
|
-
var
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
// src/media/rtpReceiver.ts
|
|
14550
|
-
var log35 = debug("werift:packages/webrtc/src/media/rtpReceiver.ts");
|
|
14551
|
-
|
|
14552
|
-
// src/media/router.ts
|
|
14553
|
-
var log36 = debug("werift:packages/webrtc/src/media/router.ts");
|
|
14906
|
+
// src/api/compatibilityOptions.ts
|
|
14907
|
+
var CompatibilityOptionValues = {
|
|
14908
|
+
certificateScope: ["standard", "process"],
|
|
14909
|
+
mLineReuse: ["standard", "aggressive"],
|
|
14910
|
+
transceiverPairing: ["standard", "byKind"],
|
|
14911
|
+
keyFrameRequestRouting: ["standard", "fallback"]
|
|
14912
|
+
};
|
|
14554
14913
|
|
|
14555
14914
|
// src/api/peerConfig.ts
|
|
14915
|
+
var CertificateScopeModes = CompatibilityOptionValues.certificateScope;
|
|
14916
|
+
var MLineReuseModes = CompatibilityOptionValues.mLineReuse;
|
|
14917
|
+
var TransceiverPairingModes = CompatibilityOptionValues.transceiverPairing;
|
|
14918
|
+
var COMPATIBILITY_OPTIONS = Object.keys(
|
|
14919
|
+
CompatibilityOptionValues
|
|
14920
|
+
);
|
|
14556
14921
|
function generateDefaultPeerConfig() {
|
|
14557
14922
|
return {
|
|
14558
14923
|
codecs: defaultCodecs(),
|
|
@@ -14573,11 +14938,16 @@ function generateDefaultPeerConfig() {
|
|
|
14573
14938
|
iceTcpPassive: true,
|
|
14574
14939
|
iceStunGatherTimeout: void 0,
|
|
14575
14940
|
iceTurnConnectTimeout: void 0,
|
|
14941
|
+
iceNominationDelayMs: void 0,
|
|
14942
|
+
iceNomination: void 0,
|
|
14943
|
+
iceRenomination: false,
|
|
14576
14944
|
turnTransport: void 0,
|
|
14577
14945
|
turnTlsOptions: void 0,
|
|
14578
14946
|
turnUdpFamily: void 0,
|
|
14579
14947
|
iceFilterStunResponse: void 0,
|
|
14580
14948
|
iceFilterCandidatePair: void 0,
|
|
14949
|
+
iceMessageIntegrity: void 0,
|
|
14950
|
+
iceOptionIce2: false,
|
|
14581
14951
|
icePasswordPrefix: void 0,
|
|
14582
14952
|
iceUseLinkLocalAddress: void 0,
|
|
14583
14953
|
dtls: {},
|
|
@@ -14594,8 +14964,11 @@ function generateDefaultPeerConfig() {
|
|
|
14594
14964
|
bandwidthEstimator: "lightweight",
|
|
14595
14965
|
sctp: { mtu: DEFAULT_SCTP_MTU },
|
|
14596
14966
|
pendingRtp: false,
|
|
14597
|
-
mLineReuse: "
|
|
14598
|
-
|
|
14967
|
+
mLineReuse: "standard",
|
|
14968
|
+
transceiverPairing: "byKind",
|
|
14969
|
+
keyFrameRequestRouting: "fallback",
|
|
14970
|
+
bundleCandidates: "legacy",
|
|
14971
|
+
compatibility: void 0
|
|
14599
14972
|
};
|
|
14600
14973
|
}
|
|
14601
14974
|
var defaultPeerConfig = generateDefaultPeerConfig();
|
|
@@ -14604,25 +14977,44 @@ var defaultPeerConfig = generateDefaultPeerConfig();
|
|
|
14604
14977
|
var kNetworkStateEstimateProbingIntervalMs = Number.POSITIVE_INFINITY;
|
|
14605
14978
|
|
|
14606
14979
|
// src/transceiverManager.ts
|
|
14607
|
-
var
|
|
14980
|
+
var log38 = debug("werift:packages/webrtc/src/media/rtpTransceiverManager.ts");
|
|
14981
|
+
|
|
14982
|
+
// src/media/receiver/nack.ts
|
|
14983
|
+
var log39 = debug("werift:packages/webrtc/src/media/receiver/nack.ts");
|
|
14984
|
+
var LOST_SIZE2 = 30 * 5;
|
|
14985
|
+
|
|
14986
|
+
// src/media/receiver/receiverTwcc.ts
|
|
14987
|
+
var log40 = debug("werift:packages/webrtc/media/receiver/receiverTwcc");
|
|
14988
|
+
|
|
14989
|
+
// src/media/rtpReceiver.ts
|
|
14990
|
+
var log41 = debug("werift:packages/webrtc/src/media/rtpReceiver.ts");
|
|
14991
|
+
|
|
14992
|
+
// src/media/routing/ridRouting.ts
|
|
14993
|
+
var log42 = debug("werift:packages/webrtc/src/media/routing/ridRouting.ts");
|
|
14994
|
+
|
|
14995
|
+
// src/media/routing/rtcpRouting.ts
|
|
14996
|
+
var KeyFrameRequestRoutingModes = CompatibilityOptionValues.keyFrameRequestRouting;
|
|
14997
|
+
|
|
14998
|
+
// src/media/router.ts
|
|
14999
|
+
var log43 = debug("werift:packages/webrtc/src/media/router.ts");
|
|
14608
15000
|
|
|
14609
15001
|
// src/media/sender/outgoingQueue.ts
|
|
14610
15002
|
var kOutgoingQueueMaxBytesVideo = 512 * 1024;
|
|
14611
15003
|
var kOutgoingQueueMaxBytesAudio = 64 * 1024;
|
|
14612
15004
|
|
|
14613
15005
|
// src/media/rtpSender.ts
|
|
14614
|
-
var
|
|
15006
|
+
var log44 = debug("werift:packages/webrtc/src/media/rtpSender.ts");
|
|
14615
15007
|
|
|
14616
15008
|
// src/negotiation/transportActivation.ts
|
|
14617
|
-
var
|
|
15009
|
+
var log45 = debug(
|
|
14618
15010
|
"werift:packages/webrtc/src/negotiation/transportActivation.ts"
|
|
14619
15011
|
);
|
|
14620
15012
|
|
|
14621
15013
|
// src/sctpManager.ts
|
|
14622
|
-
var
|
|
15014
|
+
var log46 = debug("werift:packages/webrtc/src/transport/sctpManager.ts");
|
|
14623
15015
|
|
|
14624
15016
|
// src/secureTransportManager.ts
|
|
14625
|
-
var
|
|
15017
|
+
var log47 = debug(
|
|
14626
15018
|
"werift:packages/webrtc/src/transport/secureTransportManager.ts"
|
|
14627
15019
|
);
|
|
14628
15020
|
var srtpProfiles = [
|
|
@@ -14632,7 +15024,7 @@ var srtpProfiles = [
|
|
|
14632
15024
|
];
|
|
14633
15025
|
|
|
14634
15026
|
// src/peerConnection.ts
|
|
14635
|
-
var
|
|
15027
|
+
var log48 = debug("werift:packages/webrtc/src/peerConnection.ts");
|
|
14636
15028
|
|
|
14637
15029
|
// src/nonstandard/dummyMedia.ts
|
|
14638
15030
|
var AUDIO_PACKET_MS = 20;
|
|
@@ -15399,6 +15791,8 @@ export {
|
|
|
15399
15791
|
RtpSourceStream,
|
|
15400
15792
|
RtpTimeBase,
|
|
15401
15793
|
RtpTimeCallback,
|
|
15794
|
+
RtpTimelineDropReason,
|
|
15795
|
+
RtpTimelineRewriter,
|
|
15402
15796
|
RunLengthChunk,
|
|
15403
15797
|
SRTP_REPLAY_WINDOW_SIZE,
|
|
15404
15798
|
SegmentSizePosition,
|