amiudmodz 6.2.9 → 6.3.1
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/lib/Foundation/ai-rich.d.ts +123 -0
- package/lib/Foundation/ai-rich.d.ts.map +1 -0
- package/lib/Foundation/ai-rich.js +542 -0
- package/lib/Foundation/ai-rich.js.map +1 -0
- package/lib/Foundation/audio-duration.d.ts +3 -0
- package/lib/Foundation/audio-duration.d.ts.map +1 -0
- package/lib/Foundation/audio-duration.js +514 -0
- package/lib/Foundation/audio-duration.js.map +1 -0
- package/lib/Foundation/audio-samples.d.ts +3 -0
- package/lib/Foundation/audio-samples.d.ts.map +1 -0
- package/lib/Foundation/audio-samples.js +294 -0
- package/lib/Foundation/audio-samples.js.map +1 -0
- package/lib/Foundation/boom.d.ts +17 -0
- package/lib/Foundation/boom.d.ts.map +1 -0
- package/lib/Foundation/boom.js +37 -0
- package/lib/Foundation/boom.js.map +1 -0
- package/lib/Foundation/cache.d.ts +25 -0
- package/lib/Foundation/cache.d.ts.map +1 -0
- package/lib/Foundation/cache.js +112 -0
- package/lib/Foundation/cache.js.map +1 -0
- package/lib/Foundation/concurrency.d.ts +13 -0
- package/lib/Foundation/concurrency.d.ts.map +1 -0
- package/lib/Foundation/concurrency.js +62 -0
- package/lib/Foundation/concurrency.js.map +1 -0
- package/lib/Foundation/curve25519.d.ts +11 -0
- package/lib/Foundation/curve25519.d.ts.map +1 -0
- package/lib/Foundation/curve25519.js +178 -0
- package/lib/Foundation/curve25519.js.map +1 -0
- package/lib/Foundation/image-thumb.d.ts +13 -0
- package/lib/Foundation/image-thumb.d.ts.map +1 -0
- package/lib/Foundation/image-thumb.js +65 -0
- package/lib/Foundation/image-thumb.js.map +1 -0
- package/lib/Foundation/link-preview.d.ts +29 -0
- package/lib/Foundation/link-preview.d.ts.map +1 -0
- package/lib/Foundation/link-preview.js +309 -0
- package/lib/Foundation/link-preview.js.map +1 -0
- package/lib/Foundation/logger.d.ts +31 -0
- package/lib/Foundation/logger.d.ts.map +1 -0
- package/lib/Foundation/logger.js +54 -0
- package/lib/Foundation/logger.js.map +1 -0
- package/lib/Foundation/long.d.ts +33 -0
- package/lib/Foundation/long.d.ts.map +1 -0
- package/lib/Foundation/long.js +135 -0
- package/lib/Foundation/long.js.map +1 -0
- package/lib/Foundation/protobuf-minimal.d.ts +115 -0
- package/lib/Foundation/protobuf-minimal.d.ts.map +1 -0
- package/lib/Foundation/protobuf-minimal.js +614 -0
- package/lib/Foundation/protobuf-minimal.js.map +1 -0
- package/lib/Foundation/qrcode-terminal.d.ts +2 -0
- package/lib/Foundation/qrcode-terminal.d.ts.map +1 -0
- package/lib/Foundation/qrcode-terminal.js +405 -0
- package/lib/Foundation/qrcode-terminal.js.map +1 -0
- package/lib/Foundation/sql-database.d.ts +15 -0
- package/lib/Foundation/sql-database.d.ts.map +1 -0
- package/lib/Foundation/sql-database.js +719 -0
- package/lib/Foundation/sql-database.js.map +1 -0
- package/lib/Foundation/wa-crypto.d.ts +14 -0
- package/lib/Foundation/wa-crypto.d.ts.map +1 -0
- package/lib/Foundation/wa-crypto.js +48 -0
- package/lib/Foundation/wa-crypto.js.map +1 -0
- package/lib/Foundation/zip.d.ts +2 -0
- package/lib/Foundation/zip.d.ts.map +1 -0
- package/lib/Foundation/zip.js +98 -0
- package/lib/Foundation/zip.js.map +1 -0
- package/lib/Signal/libsignal.js +0 -3
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Socket/business.d.ts +3 -1
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/communities.d.ts +3 -1
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +19 -14
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +3 -1
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +6 -2
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +3 -1
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +298 -52
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +4 -5
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js +6 -7
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +89 -26
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +6 -0
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +198 -27
- package/lib/Utils/messages.js.map +1 -1
- package/lib/VoIP/WaVoipCoordinator.d.ts +39 -0
- package/lib/VoIP/WaVoipCoordinator.d.ts.map +1 -0
- package/lib/VoIP/WaVoipCoordinator.js +156 -0
- package/lib/VoIP/WaVoipCoordinator.js.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts +35 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.js +174 -0
- package/lib/VoIP/app-data/WaAppDataStream.js.map +1 -0
- package/lib/VoIP/app-data/protocol.d.ts +28 -0
- package/lib/VoIP/app-data/protocol.d.ts.map +1 -0
- package/lib/VoIP/app-data/protocol.js +167 -0
- package/lib/VoIP/app-data/protocol.js.map +1 -0
- package/lib/VoIP/bytes.d.ts +19 -0
- package/lib/VoIP/bytes.d.ts.map +1 -0
- package/lib/VoIP/bytes.js +64 -0
- package/lib/VoIP/bytes.js.map +1 -0
- package/lib/VoIP/call/WaCallManager.d.ts +58 -0
- package/lib/VoIP/call/WaCallManager.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallManager.js +434 -0
- package/lib/VoIP/call/WaCallManager.js.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts +143 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.js +1674 -0
- package/lib/VoIP/call/WaCallMediaSession.js.map +1 -0
- package/lib/VoIP/call/call-state.d.ts +34 -0
- package/lib/VoIP/call/call-state.d.ts.map +1 -0
- package/lib/VoIP/call/call-state.js +189 -0
- package/lib/VoIP/call/call-state.js.map +1 -0
- package/lib/VoIP/crypto/encryption.d.ts +6 -0
- package/lib/VoIP/crypto/encryption.d.ts.map +1 -0
- package/lib/VoIP/crypto/encryption.js +14 -0
- package/lib/VoIP/crypto/encryption.js.map +1 -0
- package/lib/VoIP/crypto/primitives.d.ts +5 -0
- package/lib/VoIP/crypto/primitives.d.ts.map +1 -0
- package/lib/VoIP/crypto/primitives.js +22 -0
- package/lib/VoIP/crypto/primitives.js.map +1 -0
- package/lib/VoIP/crypto/rtcp.d.ts +6 -0
- package/lib/VoIP/crypto/rtcp.d.ts.map +1 -0
- package/lib/VoIP/crypto/rtcp.js +71 -0
- package/lib/VoIP/crypto/rtcp.js.map +1 -0
- package/lib/VoIP/crypto/srtp.d.ts +40 -0
- package/lib/VoIP/crypto/srtp.d.ts.map +1 -0
- package/lib/VoIP/crypto/srtp.js +174 -0
- package/lib/VoIP/crypto/srtp.js.map +1 -0
- package/lib/VoIP/crypto/ssrc.d.ts +4 -0
- package/lib/VoIP/crypto/ssrc.d.ts.map +1 -0
- package/lib/VoIP/crypto/ssrc.js +15 -0
- package/lib/VoIP/crypto/ssrc.js.map +1 -0
- package/lib/VoIP/index.d.ts +82 -104
- package/lib/VoIP/index.d.ts.map +1 -1
- package/lib/VoIP/index.js +596 -885
- package/lib/VoIP/index.js.map +1 -1
- package/lib/VoIP/media/WaAudioEngine.d.ts +79 -0
- package/lib/VoIP/media/WaAudioEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaAudioEngine.js +478 -0
- package/lib/VoIP/media/WaAudioEngine.js.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts +31 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.js +261 -0
- package/lib/VoIP/media/WaVideoEngine.js.map +1 -0
- package/lib/VoIP/media/audio-codec.d.ts +74 -0
- package/lib/VoIP/media/audio-codec.d.ts.map +1 -0
- package/lib/VoIP/media/audio-codec.js +0 -0
- package/lib/VoIP/media/audio-codec.js.map +1 -0
- package/lib/VoIP/media/audio-reorder.d.ts +19 -0
- package/lib/VoIP/media/audio-reorder.d.ts.map +1 -0
- package/lib/VoIP/media/audio-reorder.js +112 -0
- package/lib/VoIP/media/audio-reorder.js.map +1 -0
- package/lib/VoIP/media/h264.d.ts +21 -0
- package/lib/VoIP/media/h264.d.ts.map +1 -0
- package/lib/VoIP/media/h264.js +239 -0
- package/lib/VoIP/media/h264.js.map +1 -0
- package/lib/VoIP/media/mlow-codec.d.ts +77 -0
- package/lib/VoIP/media/mlow-codec.d.ts.map +1 -0
- package/lib/VoIP/media/mlow-codec.js +467 -0
- package/lib/VoIP/media/mlow-codec.js.map +1 -0
- package/lib/VoIP/media/rtcp.d.ts +10 -0
- package/lib/VoIP/media/rtcp.d.ts.map +1 -0
- package/lib/VoIP/media/rtcp.js +61 -0
- package/lib/VoIP/media/rtcp.js.map +1 -0
- package/lib/VoIP/media/rtp.d.ts +56 -0
- package/lib/VoIP/media/rtp.d.ts.map +1 -0
- package/lib/VoIP/media/rtp.js +225 -0
- package/lib/VoIP/media/rtp.js.map +1 -0
- package/lib/VoIP/protobuf.d.ts +3 -0
- package/lib/VoIP/protobuf.d.ts.map +1 -0
- package/lib/VoIP/protobuf.js +30 -0
- package/lib/VoIP/protobuf.js.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts +62 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.js +619 -0
- package/lib/VoIP/relay/WaManualRelay.js.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts +22 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js +34 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js.map +1 -0
- package/lib/VoIP/relay/dtls/aead.d.ts +23 -0
- package/lib/VoIP/relay/dtls/aead.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/aead.js +41 -0
- package/lib/VoIP/relay/dtls/aead.js.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts +6 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.js +68 -0
- package/lib/VoIP/relay/dtls/cert-builder.js.map +1 -0
- package/lib/VoIP/relay/dtls/der.d.ts +19 -0
- package/lib/VoIP/relay/dtls/der.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/der.js +96 -0
- package/lib/VoIP/relay/dtls/der.js.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts +9 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.js +33 -0
- package/lib/VoIP/relay/dtls/ecdhe.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts +49 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js +102 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts +64 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js +154 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts +28 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.js +555 -0
- package/lib/VoIP/relay/dtls/handshake.js.map +1 -0
- package/lib/VoIP/relay/dtls/prf.d.ts +13 -0
- package/lib/VoIP/relay/dtls/prf.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/prf.js +35 -0
- package/lib/VoIP/relay/dtls/prf.js.map +1 -0
- package/lib/VoIP/relay/dtls/record.d.ts +25 -0
- package/lib/VoIP/relay/dtls/record.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/record.js +49 -0
- package/lib/VoIP/relay/dtls/record.js.map +1 -0
- package/lib/VoIP/relay/relay-ack.d.ts +31 -0
- package/lib/VoIP/relay/relay-ack.d.ts.map +1 -0
- package/lib/VoIP/relay/relay-ack.js +142 -0
- package/lib/VoIP/relay/relay-ack.js.map +1 -0
- package/lib/VoIP/relay/sctp/association.d.ts +22 -0
- package/lib/VoIP/relay/sctp/association.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/association.js +434 -0
- package/lib/VoIP/relay/sctp/association.js.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts +2 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.js +20 -0
- package/lib/VoIP/relay/sctp/crc32c.js.map +1 -0
- package/lib/VoIP/relay/sctp/wire.d.ts +96 -0
- package/lib/VoIP/relay/sctp/wire.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/wire.js +206 -0
- package/lib/VoIP/relay/sctp/wire.js.map +1 -0
- package/lib/VoIP/relay/stun.d.ts +47 -0
- package/lib/VoIP/relay/stun.d.ts.map +1 -0
- package/lib/VoIP/relay/stun.js +459 -0
- package/lib/VoIP/relay/stun.js.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts +2 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.js +22 -0
- package/lib/VoIP/shim/baileys-resolve.js.map +1 -0
- package/lib/VoIP/shim/core.d.ts +32 -0
- package/lib/VoIP/shim/core.d.ts.map +1 -0
- package/lib/VoIP/shim/core.js +67 -0
- package/lib/VoIP/shim/core.js.map +1 -0
- package/lib/VoIP/shim/crypto.d.ts +2 -0
- package/lib/VoIP/shim/crypto.d.ts.map +1 -0
- package/lib/VoIP/shim/crypto.js +7 -0
- package/lib/VoIP/shim/crypto.js.map +1 -0
- package/lib/VoIP/shim/proto.d.ts +2 -0
- package/lib/VoIP/shim/proto.d.ts.map +1 -0
- package/lib/VoIP/shim/proto.js +10 -0
- package/lib/VoIP/shim/proto.js.map +1 -0
- package/lib/VoIP/shim/protocol.d.ts +32 -0
- package/lib/VoIP/shim/protocol.d.ts.map +1 -0
- package/lib/VoIP/shim/protocol.js +131 -0
- package/lib/VoIP/shim/protocol.js.map +1 -0
- package/lib/VoIP/shim/transport.d.ts +20 -0
- package/lib/VoIP/shim/transport.d.ts.map +1 -0
- package/lib/VoIP/shim/transport.js +83 -0
- package/lib/VoIP/shim/transport.js.map +1 -0
- package/lib/VoIP/shim/util.d.ts +13 -0
- package/lib/VoIP/shim/util.d.ts.map +1 -0
- package/lib/VoIP/shim/util.js +208 -0
- package/lib/VoIP/shim/util.js.map +1 -0
- package/lib/VoIP/signaling/bridge.d.ts +4 -0
- package/lib/VoIP/signaling/bridge.d.ts.map +1 -0
- package/lib/VoIP/signaling/bridge.js +103 -0
- package/lib/VoIP/signaling/bridge.js.map +1 -0
- package/lib/VoIP/signaling/screen-share.d.ts +40 -0
- package/lib/VoIP/signaling/screen-share.d.ts.map +1 -0
- package/lib/VoIP/signaling/screen-share.js +55 -0
- package/lib/VoIP/signaling/screen-share.js.map +1 -0
- package/lib/VoIP/signaling/signaling.d.ts +396 -0
- package/lib/VoIP/signaling/signaling.d.ts.map +1 -0
- package/lib/VoIP/signaling/signaling.js +488 -0
- package/lib/VoIP/signaling/signaling.js.map +1 -0
- package/lib/VoIP/types.d.ts +37 -12
- package/lib/VoIP/types.d.ts.map +1 -1
- package/lib/VoIP/types.js +65 -12
- package/lib/VoIP/types.js.map +1 -1
- package/lib/VoIP/voip-deps.d.ts +46 -0
- package/lib/VoIP/voip-deps.d.ts.map +1 -0
- package/lib/VoIP/voip-deps.js +244 -0
- package/lib/VoIP/voip-deps.js.map +1 -0
- package/lib/VoIP/voipClient.d.ts +34 -0
- package/lib/VoIP/voipClient.d.ts.map +1 -0
- package/lib/VoIP/voipClient.js +351 -0
- package/lib/VoIP/voipClient.js.map +1 -0
- package/lib/VoIP/wasm-engine.d.ts +2 -2
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/decode.js +10 -0
- package/lib/WABinary/decode.js.map +1 -1
- package/lib/WABinary/encode.d.ts.map +1 -1
- package/lib/WABinary/encode.js +10 -0
- package/lib/WABinary/encode.js.map +1 -1
- package/lib/WABinary/generic-utils.js +1 -1
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +18 -17
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _SctpAssociation_instances, _SctpAssociation_sendDtlsPayload, _SctpAssociation_logger, _SctpAssociation_state, _SctpAssociation_myTag, _SctpAssociation_peerVerificationTag, _SctpAssociation_initialTsn, _SctpAssociation_nextTsn, _SctpAssociation_peerInitialTsn, _SctpAssociation_cumulativeAckReceived, _SctpAssociation_stateCookie, _SctpAssociation_retransmitTimer, _SctpAssociation_initRetries, _SctpAssociation_heartbeatTimer, _SctpAssociation_outboundStreamSeq, _SctpAssociation_outboundVideoStreamSeq, _SctpAssociation_inboundExpectedStreamSeq, _SctpAssociation_reorderBuffer, _SctpAssociation_inFlight, _SctpAssociation_videoInFlightCount, _SctpAssociation_videoFlushCount, _SctpAssociation_audioQueue, _SctpAssociation_videoQueue, _SctpAssociation_inboundCumulativeTsn, _SctpAssociation_inboundReceivedAheadTsns, _SctpAssociation_sendInit, _SctpAssociation_sendCookieEcho, _SctpAssociation_onConnected, _SctpAssociation_pumpSendQueue, _SctpAssociation_retransmitCount, _SctpAssociation_armDataRetransmit, _SctpAssociation_handleChunk, _SctpAssociation_handleIncomingData, _SctpAssociation_recordInboundTsn, _SctpAssociation_buildAndSendSack, _SctpAssociation_handleSack, _SctpAssociation_sendHeartbeat, _SctpAssociation_fail;
|
|
13
|
+
import { randomBytes } from 'node:crypto';
|
|
14
|
+
import { EventEmitter } from 'node:events';
|
|
15
|
+
import { createNoopLogger } from '../../shim/core.js';
|
|
16
|
+
import * as sctp from './wire.js';
|
|
17
|
+
const SCTP_PORT = 5000;
|
|
18
|
+
const RETRANSMIT_TIMEOUT_MS = 1000;
|
|
19
|
+
const MAX_INIT_RETRIES = 5;
|
|
20
|
+
const HEARTBEAT_INTERVAL_MS = 5000;
|
|
21
|
+
const SEND_WINDOW_SIZE = 32;
|
|
22
|
+
const MAX_VIDEO_QUEUE_AGE_MS = 400;
|
|
23
|
+
const MAX_QUEUED_VIDEO_PACKETS = 200;
|
|
24
|
+
const MAX_QUEUED_AUDIO_FRAMES = 20;
|
|
25
|
+
const MAX_VIDEO_IN_FLIGHT = 24;
|
|
26
|
+
const STALE_GAP_TSN_LIMIT = 512;
|
|
27
|
+
function randomUint32() {
|
|
28
|
+
return randomBytes(4).readUInt32BE(0);
|
|
29
|
+
}
|
|
30
|
+
export class SctpAssociation extends EventEmitter {
|
|
31
|
+
constructor({ sendDtlsPayload, logger }) {
|
|
32
|
+
super();
|
|
33
|
+
_SctpAssociation_instances.add(this);
|
|
34
|
+
_SctpAssociation_sendDtlsPayload.set(this, void 0);
|
|
35
|
+
_SctpAssociation_logger.set(this, void 0);
|
|
36
|
+
_SctpAssociation_state.set(this, 'idle');
|
|
37
|
+
_SctpAssociation_myTag.set(this, randomUint32());
|
|
38
|
+
_SctpAssociation_peerVerificationTag.set(this, 0);
|
|
39
|
+
_SctpAssociation_initialTsn.set(this, randomUint32());
|
|
40
|
+
_SctpAssociation_nextTsn.set(this, void 0);
|
|
41
|
+
_SctpAssociation_peerInitialTsn.set(this, 0);
|
|
42
|
+
_SctpAssociation_cumulativeAckReceived.set(this, -1);
|
|
43
|
+
_SctpAssociation_stateCookie.set(this, null);
|
|
44
|
+
_SctpAssociation_retransmitTimer.set(this, null);
|
|
45
|
+
_SctpAssociation_initRetries.set(this, 0);
|
|
46
|
+
_SctpAssociation_heartbeatTimer.set(this, null);
|
|
47
|
+
_SctpAssociation_outboundStreamSeq.set(this, 0);
|
|
48
|
+
_SctpAssociation_outboundVideoStreamSeq.set(this, 0);
|
|
49
|
+
_SctpAssociation_inboundExpectedStreamSeq.set(this, 0);
|
|
50
|
+
_SctpAssociation_reorderBuffer.set(this, new Map());
|
|
51
|
+
_SctpAssociation_inFlight.set(this, new Map());
|
|
52
|
+
_SctpAssociation_videoInFlightCount.set(this, 0);
|
|
53
|
+
_SctpAssociation_videoFlushCount.set(this, 0);
|
|
54
|
+
_SctpAssociation_audioQueue.set(this, []);
|
|
55
|
+
_SctpAssociation_videoQueue.set(this, []);
|
|
56
|
+
_SctpAssociation_inboundCumulativeTsn.set(this, -1);
|
|
57
|
+
_SctpAssociation_inboundReceivedAheadTsns.set(this, new Set());
|
|
58
|
+
_SctpAssociation_retransmitCount.set(this, 0);
|
|
59
|
+
__classPrivateFieldSet(this, _SctpAssociation_sendDtlsPayload, sendDtlsPayload, "f");
|
|
60
|
+
__classPrivateFieldSet(this, _SctpAssociation_logger, logger ?? createNoopLogger(), "f");
|
|
61
|
+
__classPrivateFieldSet(this, _SctpAssociation_nextTsn, __classPrivateFieldGet(this, _SctpAssociation_initialTsn, "f"), "f");
|
|
62
|
+
}
|
|
63
|
+
start() {
|
|
64
|
+
__classPrivateFieldSet(this, _SctpAssociation_state, 'wait_init_ack', "f");
|
|
65
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_sendInit).call(this);
|
|
66
|
+
}
|
|
67
|
+
close() {
|
|
68
|
+
__classPrivateFieldSet(this, _SctpAssociation_state, 'closed', "f");
|
|
69
|
+
clearTimeout(__classPrivateFieldGet(this, _SctpAssociation_retransmitTimer, "f"));
|
|
70
|
+
clearInterval(__classPrivateFieldGet(this, _SctpAssociation_heartbeatTimer, "f"));
|
|
71
|
+
for (const entry of __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").values())
|
|
72
|
+
clearTimeout(entry.timer);
|
|
73
|
+
__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").clear();
|
|
74
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoInFlightCount, 0, "f");
|
|
75
|
+
__classPrivateFieldSet(this, _SctpAssociation_audioQueue, [], "f");
|
|
76
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoQueue, [], "f");
|
|
77
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").clear();
|
|
78
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").clear();
|
|
79
|
+
}
|
|
80
|
+
get isConnected() { return __classPrivateFieldGet(this, _SctpAssociation_state, "f") === 'connected'; }
|
|
81
|
+
getSendBacklog() {
|
|
82
|
+
return {
|
|
83
|
+
queued: __classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").length + __classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").length,
|
|
84
|
+
queuedAudio: __classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").length,
|
|
85
|
+
queuedVideo: __classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").length,
|
|
86
|
+
inFlight: __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").size,
|
|
87
|
+
retransmits: __classPrivateFieldGet(this, _SctpAssociation_retransmitCount, "f"),
|
|
88
|
+
videoFlushes: __classPrivateFieldGet(this, _SctpAssociation_videoFlushCount, "f")
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
send(payload, isAudio = true) {
|
|
92
|
+
var _a;
|
|
93
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") === 'closed')
|
|
94
|
+
return;
|
|
95
|
+
if (isAudio) {
|
|
96
|
+
__classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").push(payload);
|
|
97
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").length > MAX_QUEUED_AUDIO_FRAMES) {
|
|
98
|
+
__classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").splice(0, __classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").length - MAX_QUEUED_AUDIO_FRAMES);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
__classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").push({ payload, queuedAtMs: now });
|
|
104
|
+
const oldest = __classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f")[0];
|
|
105
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").length > MAX_QUEUED_VIDEO_PACKETS ||
|
|
106
|
+
now - oldest.queuedAtMs > MAX_VIDEO_QUEUE_AGE_MS) {
|
|
107
|
+
const dropped = __classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").length;
|
|
108
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoQueue, [], "f");
|
|
109
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoFlushCount, (_a = __classPrivateFieldGet(this, _SctpAssociation_videoFlushCount, "f"), _a++, _a), "f");
|
|
110
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").trace('sctp flushed stale video queue to protect audio latency', {
|
|
111
|
+
dropped
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_pumpSendQueue).call(this);
|
|
116
|
+
}
|
|
117
|
+
handleDtlsPayload(plaintext) {
|
|
118
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") === 'closed')
|
|
119
|
+
return;
|
|
120
|
+
let header;
|
|
121
|
+
try {
|
|
122
|
+
header = sctp.parsePacketHeader(plaintext);
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").trace('sctp payload failed to parse', {
|
|
126
|
+
message: e.message, bytes: plaintext.length, hex: Buffer.from(plaintext).toString('hex')
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const chunkTypesForLog = sctp.splitChunks(plaintext, header.chunksStart).map((c) => c.type);
|
|
131
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").trace('sctp recv packet', {
|
|
132
|
+
vtag: `0x${header.verificationTag.toString(16)}`,
|
|
133
|
+
expectVtag: `0x${__classPrivateFieldGet(this, _SctpAssociation_myTag, "f").toString(16)}`,
|
|
134
|
+
chunkTypes: chunkTypesForLog,
|
|
135
|
+
state: __classPrivateFieldGet(this, _SctpAssociation_state, "f")
|
|
136
|
+
});
|
|
137
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'wait_init_ack' && header.verificationTag !== __classPrivateFieldGet(this, _SctpAssociation_myTag, "f")) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const chunks = sctp.splitChunks(plaintext, header.chunksStart);
|
|
141
|
+
for (const chunk of chunks)
|
|
142
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_handleChunk).call(this, chunk, header);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
_SctpAssociation_sendDtlsPayload = new WeakMap(), _SctpAssociation_logger = new WeakMap(), _SctpAssociation_state = new WeakMap(), _SctpAssociation_myTag = new WeakMap(), _SctpAssociation_peerVerificationTag = new WeakMap(), _SctpAssociation_initialTsn = new WeakMap(), _SctpAssociation_nextTsn = new WeakMap(), _SctpAssociation_peerInitialTsn = new WeakMap(), _SctpAssociation_cumulativeAckReceived = new WeakMap(), _SctpAssociation_stateCookie = new WeakMap(), _SctpAssociation_retransmitTimer = new WeakMap(), _SctpAssociation_initRetries = new WeakMap(), _SctpAssociation_heartbeatTimer = new WeakMap(), _SctpAssociation_outboundStreamSeq = new WeakMap(), _SctpAssociation_outboundVideoStreamSeq = new WeakMap(), _SctpAssociation_inboundExpectedStreamSeq = new WeakMap(), _SctpAssociation_reorderBuffer = new WeakMap(), _SctpAssociation_inFlight = new WeakMap(), _SctpAssociation_videoInFlightCount = new WeakMap(), _SctpAssociation_videoFlushCount = new WeakMap(), _SctpAssociation_audioQueue = new WeakMap(), _SctpAssociation_videoQueue = new WeakMap(), _SctpAssociation_inboundCumulativeTsn = new WeakMap(), _SctpAssociation_inboundReceivedAheadTsns = new WeakMap(), _SctpAssociation_retransmitCount = new WeakMap(), _SctpAssociation_instances = new WeakSet(), _SctpAssociation_sendInit = function _SctpAssociation_sendInit() {
|
|
146
|
+
const chunk = sctp.buildInit({
|
|
147
|
+
initiateTag: __classPrivateFieldGet(this, _SctpAssociation_myTag, "f"),
|
|
148
|
+
advertisedReceiverWindow: 131072,
|
|
149
|
+
outboundStreams: 65535,
|
|
150
|
+
inboundStreams: 65535,
|
|
151
|
+
initialTsn: __classPrivateFieldGet(this, _SctpAssociation_initialTsn, "f"),
|
|
152
|
+
});
|
|
153
|
+
const packet = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: 0, chunks: [chunk] });
|
|
154
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").trace('sctp sending INIT', {
|
|
155
|
+
myTag: `0x${__classPrivateFieldGet(this, _SctpAssociation_myTag, "f").toString(16)}`, initialTsn: __classPrivateFieldGet(this, _SctpAssociation_initialTsn, "f"), attempt: __classPrivateFieldGet(this, _SctpAssociation_initRetries, "f")
|
|
156
|
+
});
|
|
157
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_initRetries, "f") === 0) {
|
|
158
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").trace('sctp INIT packet hex (first attempt only)', { hex: packet.toString('hex') });
|
|
159
|
+
}
|
|
160
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, packet);
|
|
161
|
+
clearTimeout(__classPrivateFieldGet(this, _SctpAssociation_retransmitTimer, "f"));
|
|
162
|
+
__classPrivateFieldSet(this, _SctpAssociation_retransmitTimer, setTimeout(() => {
|
|
163
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'wait_init_ack')
|
|
164
|
+
return;
|
|
165
|
+
__classPrivateFieldSet(this, _SctpAssociation_initRetries, __classPrivateFieldGet(this, _SctpAssociation_initRetries, "f") + 1, "f");
|
|
166
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_initRetries, "f") > MAX_INIT_RETRIES) {
|
|
167
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_fail).call(this, new Error('SCTP: INIT retransmit limit exceeded'));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_sendInit).call(this);
|
|
171
|
+
}, RETRANSMIT_TIMEOUT_MS * Math.min(2 ** __classPrivateFieldGet(this, _SctpAssociation_initRetries, "f"), 8)), "f");
|
|
172
|
+
}, _SctpAssociation_sendCookieEcho = function _SctpAssociation_sendCookieEcho() {
|
|
173
|
+
const chunk = sctp.buildCookieEcho(__classPrivateFieldGet(this, _SctpAssociation_stateCookie, "f"));
|
|
174
|
+
const packet = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: __classPrivateFieldGet(this, _SctpAssociation_peerVerificationTag, "f"), chunks: [chunk] });
|
|
175
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, packet);
|
|
176
|
+
clearTimeout(__classPrivateFieldGet(this, _SctpAssociation_retransmitTimer, "f"));
|
|
177
|
+
__classPrivateFieldSet(this, _SctpAssociation_retransmitTimer, setTimeout(() => {
|
|
178
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'wait_cookie_ack')
|
|
179
|
+
return;
|
|
180
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_sendCookieEcho).call(this);
|
|
181
|
+
}, RETRANSMIT_TIMEOUT_MS), "f");
|
|
182
|
+
}, _SctpAssociation_onConnected = function _SctpAssociation_onConnected() {
|
|
183
|
+
__classPrivateFieldSet(this, _SctpAssociation_state, 'connected', "f");
|
|
184
|
+
clearTimeout(__classPrivateFieldGet(this, _SctpAssociation_retransmitTimer, "f"));
|
|
185
|
+
__classPrivateFieldSet(this, _SctpAssociation_heartbeatTimer, setInterval(() => __classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_sendHeartbeat).call(this), HEARTBEAT_INTERVAL_MS), "f");
|
|
186
|
+
this.emit('connected');
|
|
187
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_pumpSendQueue).call(this);
|
|
188
|
+
}, _SctpAssociation_pumpSendQueue = function _SctpAssociation_pumpSendQueue() {
|
|
189
|
+
var _a, _b, _c, _d, _e;
|
|
190
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'connected')
|
|
191
|
+
return;
|
|
192
|
+
while (__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").size < SEND_WINDOW_SIZE) {
|
|
193
|
+
let payload, isAudio;
|
|
194
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").length > 0) {
|
|
195
|
+
payload = __classPrivateFieldGet(this, _SctpAssociation_audioQueue, "f").shift();
|
|
196
|
+
isAudio = true;
|
|
197
|
+
}
|
|
198
|
+
else if (__classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").length > 0 && __classPrivateFieldGet(this, _SctpAssociation_videoInFlightCount, "f") < MAX_VIDEO_IN_FLIGHT) {
|
|
199
|
+
payload = __classPrivateFieldGet(this, _SctpAssociation_videoQueue, "f").shift().payload;
|
|
200
|
+
isAudio = false;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
const tsn = __classPrivateFieldGet(this, _SctpAssociation_nextTsn, "f");
|
|
206
|
+
__classPrivateFieldSet(this, _SctpAssociation_nextTsn, (__classPrivateFieldGet(this, _SctpAssociation_nextTsn, "f") + 1) >>> 0, "f");
|
|
207
|
+
const streamSeq = isAudio ? (__classPrivateFieldSet(this, _SctpAssociation_outboundStreamSeq, (_b = __classPrivateFieldGet(this, _SctpAssociation_outboundStreamSeq, "f"), _a = _b++, _b), "f"), _a) : (__classPrivateFieldSet(this, _SctpAssociation_outboundVideoStreamSeq, (_d = __classPrivateFieldGet(this, _SctpAssociation_outboundVideoStreamSeq, "f"), _c = _d++, _d), "f"), _c);
|
|
208
|
+
const chunk = sctp.buildData({ tsn, streamId: 0, streamSeq, ppid: 53, payload, unordered: isAudio });
|
|
209
|
+
const packet = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: __classPrivateFieldGet(this, _SctpAssociation_peerVerificationTag, "f"), chunks: [chunk] });
|
|
210
|
+
const entry = { packet, timer: null, isAudio };
|
|
211
|
+
__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").set(tsn, entry);
|
|
212
|
+
if (!isAudio)
|
|
213
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoInFlightCount, (_e = __classPrivateFieldGet(this, _SctpAssociation_videoInFlightCount, "f"), _e++, _e), "f");
|
|
214
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, packet);
|
|
215
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_armDataRetransmit).call(this, tsn, entry);
|
|
216
|
+
}
|
|
217
|
+
}, _SctpAssociation_armDataRetransmit = function _SctpAssociation_armDataRetransmit(tsn, entry) {
|
|
218
|
+
clearTimeout(entry.timer);
|
|
219
|
+
entry.timer = setTimeout(() => {
|
|
220
|
+
var _a;
|
|
221
|
+
if (!__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").has(tsn))
|
|
222
|
+
return;
|
|
223
|
+
__classPrivateFieldSet(this, _SctpAssociation_retransmitCount, (_a = __classPrivateFieldGet(this, _SctpAssociation_retransmitCount, "f"), _a++, _a), "f");
|
|
224
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, entry.packet);
|
|
225
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_armDataRetransmit).call(this, tsn, entry);
|
|
226
|
+
}, RETRANSMIT_TIMEOUT_MS);
|
|
227
|
+
}, _SctpAssociation_handleChunk = function _SctpAssociation_handleChunk(chunk, header) {
|
|
228
|
+
switch (chunk.type) {
|
|
229
|
+
case sctp.ChunkType.INIT_ACK: {
|
|
230
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'wait_init_ack')
|
|
231
|
+
return;
|
|
232
|
+
const parsed = sctp.parseInitOrInitAck(chunk.value);
|
|
233
|
+
if (!parsed.stateCookie) {
|
|
234
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_fail).call(this, new Error('SCTP: INIT ACK missing State Cookie'));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
__classPrivateFieldSet(this, _SctpAssociation_peerVerificationTag, parsed.initiateTag, "f");
|
|
238
|
+
__classPrivateFieldSet(this, _SctpAssociation_peerInitialTsn, parsed.initialTsn, "f");
|
|
239
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, 0, "f");
|
|
240
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundCumulativeTsn, (parsed.initialTsn - 1) >>> 0, "f");
|
|
241
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").clear();
|
|
242
|
+
__classPrivateFieldSet(this, _SctpAssociation_stateCookie, parsed.stateCookie, "f");
|
|
243
|
+
__classPrivateFieldSet(this, _SctpAssociation_state, 'wait_cookie_ack', "f");
|
|
244
|
+
__classPrivateFieldSet(this, _SctpAssociation_initRetries, 0, "f");
|
|
245
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_sendCookieEcho).call(this);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
case sctp.ChunkType.COOKIE_ACK: {
|
|
249
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'wait_cookie_ack')
|
|
250
|
+
return;
|
|
251
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_onConnected).call(this);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
case sctp.ChunkType.DATA: {
|
|
255
|
+
const parsed = sctp.parseData(chunk.flags, chunk.value);
|
|
256
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_handleIncomingData).call(this, parsed);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
case sctp.ChunkType.SACK: {
|
|
260
|
+
const parsed = sctp.parseSack(chunk.value);
|
|
261
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_handleSack).call(this, parsed);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
case sctp.ChunkType.HEARTBEAT: {
|
|
265
|
+
const info = sctp.parseHeartbeatInfo(chunk.value);
|
|
266
|
+
const ackChunk = sctp.buildHeartbeatAck(info);
|
|
267
|
+
const packet = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: __classPrivateFieldGet(this, _SctpAssociation_peerVerificationTag, "f"), chunks: [ackChunk] });
|
|
268
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, packet);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
case sctp.ChunkType.HEARTBEAT_ACK:
|
|
272
|
+
return;
|
|
273
|
+
case sctp.ChunkType.ABORT:
|
|
274
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_fail).call(this, new Error('SCTP: received ABORT from peer'));
|
|
275
|
+
return;
|
|
276
|
+
case sctp.ChunkType.ERROR:
|
|
277
|
+
return;
|
|
278
|
+
default:
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
}, _SctpAssociation_handleIncomingData = function _SctpAssociation_handleIncomingData({ tsn, streamId, streamSeq, ppid, payload, unordered }) {
|
|
282
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_recordInboundTsn).call(this, tsn);
|
|
283
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_buildAndSendSack).call(this);
|
|
284
|
+
if (streamId !== 0 || ppid !== 53)
|
|
285
|
+
return;
|
|
286
|
+
if (unordered) {
|
|
287
|
+
this.emit('message', payload);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (streamSeq === __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f")) {
|
|
291
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f") + 1, "f");
|
|
292
|
+
this.emit('message', payload);
|
|
293
|
+
while (__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").has(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"))) {
|
|
294
|
+
const buffered = __classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").get(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
295
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").delete(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
296
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f") + 1, "f");
|
|
297
|
+
this.emit('message', buffered);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else if (streamSeq > __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f")) {
|
|
301
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").set(streamSeq, payload);
|
|
302
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").size > STALE_GAP_TSN_LIMIT) {
|
|
303
|
+
const bufferedSeqs = [...__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").keys()].sort((a, b) => a - b);
|
|
304
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").debug('sctp: forcing stream sequence past a stuck gap', {
|
|
305
|
+
from: __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"), bufferedCount: bufferedSeqs.length
|
|
306
|
+
});
|
|
307
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, bufferedSeqs[0], "f");
|
|
308
|
+
const buffered = __classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").get(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
309
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").delete(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
310
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f") + 1, "f");
|
|
311
|
+
this.emit('message', buffered);
|
|
312
|
+
while (__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").has(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"))) {
|
|
313
|
+
const next = __classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").get(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
314
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").delete(__classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f"));
|
|
315
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundExpectedStreamSeq, __classPrivateFieldGet(this, _SctpAssociation_inboundExpectedStreamSeq, "f") + 1, "f");
|
|
316
|
+
this.emit('message', next);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}, _SctpAssociation_recordInboundTsn = function _SctpAssociation_recordInboundTsn(tsn) {
|
|
321
|
+
if (sackAcksTsn(__classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f"), tsn)) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").add(tsn);
|
|
325
|
+
let next = (__classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f") + 1) >>> 0;
|
|
326
|
+
while (__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").has(next)) {
|
|
327
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").delete(next);
|
|
328
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundCumulativeTsn, next, "f");
|
|
329
|
+
next = (__classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f") + 1) >>> 0;
|
|
330
|
+
}
|
|
331
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").size > STALE_GAP_TSN_LIMIT) {
|
|
332
|
+
let maxAheadOffset = 0;
|
|
333
|
+
for (const aheadTsn of __classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f")) {
|
|
334
|
+
const offset = (aheadTsn - __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f")) >>> 0;
|
|
335
|
+
if (offset > maxAheadOffset)
|
|
336
|
+
maxAheadOffset = offset;
|
|
337
|
+
}
|
|
338
|
+
const jumpTo = (__classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f") + maxAheadOffset) >>> 0;
|
|
339
|
+
__classPrivateFieldGet(this, _SctpAssociation_logger, "f").debug('sctp: forcing cumulative TSN past a stuck gap', {
|
|
340
|
+
from: __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f"), to: jumpTo, aheadCount: __classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").size
|
|
341
|
+
});
|
|
342
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").delete(jumpTo);
|
|
343
|
+
__classPrivateFieldSet(this, _SctpAssociation_inboundCumulativeTsn, jumpTo, "f");
|
|
344
|
+
}
|
|
345
|
+
}, _SctpAssociation_buildAndSendSack = function _SctpAssociation_buildAndSendSack() {
|
|
346
|
+
const gapAckBlocks = [];
|
|
347
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").size > 0) {
|
|
348
|
+
const sorted = [...__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f")].sort((a, b) => {
|
|
349
|
+
const diffA = (a - __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f")) >>> 0;
|
|
350
|
+
const diffB = (b - __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f")) >>> 0;
|
|
351
|
+
return diffA - diffB;
|
|
352
|
+
});
|
|
353
|
+
let blockStart = null;
|
|
354
|
+
let blockEnd = null;
|
|
355
|
+
for (const tsn of sorted) {
|
|
356
|
+
const offset = (tsn - __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f")) >>> 0;
|
|
357
|
+
if (offset > 0xffff)
|
|
358
|
+
continue;
|
|
359
|
+
if (blockStart !== null && offset === blockEnd + 1) {
|
|
360
|
+
blockEnd = offset;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
if (blockStart !== null)
|
|
364
|
+
gapAckBlocks.push({ start: blockStart, end: blockEnd });
|
|
365
|
+
blockStart = offset;
|
|
366
|
+
blockEnd = offset;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (blockStart !== null)
|
|
370
|
+
gapAckBlocks.push({ start: blockStart, end: blockEnd });
|
|
371
|
+
}
|
|
372
|
+
const sackChunk = sctp.buildSack({
|
|
373
|
+
cumulativeTsnAck: __classPrivateFieldGet(this, _SctpAssociation_inboundCumulativeTsn, "f"),
|
|
374
|
+
advertisedReceiverWindow: 131072,
|
|
375
|
+
gapAckBlocks
|
|
376
|
+
});
|
|
377
|
+
const sackPacket = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: __classPrivateFieldGet(this, _SctpAssociation_peerVerificationTag, "f"), chunks: [sackChunk] });
|
|
378
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, sackPacket);
|
|
379
|
+
}, _SctpAssociation_handleSack = function _SctpAssociation_handleSack({ cumulativeTsnAck, gapAckBlocks }) {
|
|
380
|
+
var _a, _b;
|
|
381
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").size === 0)
|
|
382
|
+
return;
|
|
383
|
+
let acked = false;
|
|
384
|
+
for (const [tsn, entry] of __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f")) {
|
|
385
|
+
if (sackAcksTsn(cumulativeTsnAck, tsn)) {
|
|
386
|
+
clearTimeout(entry.timer);
|
|
387
|
+
__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").delete(tsn);
|
|
388
|
+
if (!entry.isAudio)
|
|
389
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoInFlightCount, (_a = __classPrivateFieldGet(this, _SctpAssociation_videoInFlightCount, "f"), _a--, _a), "f");
|
|
390
|
+
acked = true;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (gapAckBlocks && gapAckBlocks.length > 0 && __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").size > 0) {
|
|
394
|
+
for (const block of gapAckBlocks) {
|
|
395
|
+
for (const [tsn, entry] of __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f")) {
|
|
396
|
+
const offset = (tsn - cumulativeTsnAck) >>> 0;
|
|
397
|
+
if (offset >= block.start && offset <= block.end) {
|
|
398
|
+
clearTimeout(entry.timer);
|
|
399
|
+
__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").delete(tsn);
|
|
400
|
+
if (!entry.isAudio)
|
|
401
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoInFlightCount, (_b = __classPrivateFieldGet(this, _SctpAssociation_videoInFlightCount, "f"), _b--, _b), "f");
|
|
402
|
+
acked = true;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (acked)
|
|
408
|
+
__classPrivateFieldGet(this, _SctpAssociation_instances, "m", _SctpAssociation_pumpSendQueue).call(this);
|
|
409
|
+
}, _SctpAssociation_sendHeartbeat = function _SctpAssociation_sendHeartbeat() {
|
|
410
|
+
if (__classPrivateFieldGet(this, _SctpAssociation_state, "f") !== 'connected')
|
|
411
|
+
return;
|
|
412
|
+
const info = randomBytes(16);
|
|
413
|
+
const chunk = sctp.buildHeartbeat(info);
|
|
414
|
+
const packet = sctp.buildPacket({ sourcePort: SCTP_PORT, destinationPort: SCTP_PORT, verificationTag: __classPrivateFieldGet(this, _SctpAssociation_peerVerificationTag, "f"), chunks: [chunk] });
|
|
415
|
+
__classPrivateFieldGet(this, _SctpAssociation_sendDtlsPayload, "f").call(this, packet);
|
|
416
|
+
}, _SctpAssociation_fail = function _SctpAssociation_fail(err) {
|
|
417
|
+
__classPrivateFieldSet(this, _SctpAssociation_state, 'closed', "f");
|
|
418
|
+
clearTimeout(__classPrivateFieldGet(this, _SctpAssociation_retransmitTimer, "f"));
|
|
419
|
+
clearInterval(__classPrivateFieldGet(this, _SctpAssociation_heartbeatTimer, "f"));
|
|
420
|
+
for (const entry of __classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").values())
|
|
421
|
+
clearTimeout(entry.timer);
|
|
422
|
+
__classPrivateFieldGet(this, _SctpAssociation_inFlight, "f").clear();
|
|
423
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoInFlightCount, 0, "f");
|
|
424
|
+
__classPrivateFieldSet(this, _SctpAssociation_audioQueue, [], "f");
|
|
425
|
+
__classPrivateFieldSet(this, _SctpAssociation_videoQueue, [], "f");
|
|
426
|
+
__classPrivateFieldGet(this, _SctpAssociation_reorderBuffer, "f").clear();
|
|
427
|
+
__classPrivateFieldGet(this, _SctpAssociation_inboundReceivedAheadTsns, "f").clear();
|
|
428
|
+
this.emit('error', err);
|
|
429
|
+
};
|
|
430
|
+
function sackAcksTsn(cumAck, tsn) {
|
|
431
|
+
const diff = (cumAck - tsn) >>> 0;
|
|
432
|
+
return diff < 0x80000000;
|
|
433
|
+
}
|
|
434
|
+
//# sourceMappingURL=association.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"association.js","sourceRoot":"","sources":["../../../../src/VoIP/relay/sctp/association.js"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAA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E,CAAC;IAC5B,uBAAA,IAAI,iDAA0B,CAAC,KAAK,EAAE,CAAC;IACvC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAGH,SAAS,WAAW,CAAC,MAAM,EAAE,GAAG;IAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,IAAI,GAAG,UAAU,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crc32c.d.ts","sourceRoot":"","sources":["../../../../src/VoIP/relay/sctp/crc32c.js"],"names":[],"mappings":"AAcA,0CAMC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const TABLE = (() => {
|
|
2
|
+
const table = new Uint32Array(256);
|
|
3
|
+
const poly = 0x82f63b78;
|
|
4
|
+
for (let n = 0; n < 256; n++) {
|
|
5
|
+
let c = n;
|
|
6
|
+
for (let k = 0; k < 8; k++) {
|
|
7
|
+
c = c & 1 ? (c >>> 1) ^ poly : c >>> 1;
|
|
8
|
+
}
|
|
9
|
+
table[n] = c >>> 0;
|
|
10
|
+
}
|
|
11
|
+
return table;
|
|
12
|
+
})();
|
|
13
|
+
export function crc32c(data) {
|
|
14
|
+
let crc = 0xffffffff;
|
|
15
|
+
for (let i = 0; i < data.length; i++) {
|
|
16
|
+
crc = TABLE[(crc ^ data[i]) & 0xff] ^ (crc >>> 8);
|
|
17
|
+
}
|
|
18
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=crc32c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crc32c.js","sourceRoot":"","sources":["../../../../src/VoIP/relay/sctp/crc32c.js"],"names":[],"mappings":"AACA,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE;IAClB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,UAAU,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,UAAU,MAAM,CAAC,IAAI;IACzB,IAAI,GAAG,GAAG,UAAU,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export function buildPacket({ sourcePort, destinationPort, verificationTag, chunks }: {
|
|
2
|
+
sourcePort: any;
|
|
3
|
+
destinationPort: any;
|
|
4
|
+
verificationTag: any;
|
|
5
|
+
chunks: any;
|
|
6
|
+
}): Buffer<ArrayBuffer>;
|
|
7
|
+
export function parsePacketHeader(datagram: any): {
|
|
8
|
+
sourcePort: any;
|
|
9
|
+
destinationPort: any;
|
|
10
|
+
verificationTag: number;
|
|
11
|
+
chunksStart: number;
|
|
12
|
+
};
|
|
13
|
+
export function splitChunks(datagram: any, chunksStart: any): {
|
|
14
|
+
type: any;
|
|
15
|
+
flags: any;
|
|
16
|
+
value: any;
|
|
17
|
+
}[];
|
|
18
|
+
export function encodeChunk(type: any, flags: any, value: any): Buffer<ArrayBuffer>;
|
|
19
|
+
export function buildInit({ initiateTag, advertisedReceiverWindow, outboundStreams, inboundStreams, initialTsn }: {
|
|
20
|
+
initiateTag: any;
|
|
21
|
+
advertisedReceiverWindow: any;
|
|
22
|
+
outboundStreams: any;
|
|
23
|
+
inboundStreams: any;
|
|
24
|
+
initialTsn: any;
|
|
25
|
+
}): Buffer<ArrayBuffer>;
|
|
26
|
+
export function parseInitOrInitAck(chunkValue: any): {
|
|
27
|
+
initiateTag: number;
|
|
28
|
+
advertisedReceiverWindow: number;
|
|
29
|
+
outboundStreams: any;
|
|
30
|
+
inboundStreams: any;
|
|
31
|
+
initialTsn: number;
|
|
32
|
+
stateCookie: any;
|
|
33
|
+
};
|
|
34
|
+
export function buildInitAck({ initiateTag, advertisedReceiverWindow, outboundStreams, inboundStreams, initialTsn, stateCookie }: {
|
|
35
|
+
initiateTag: any;
|
|
36
|
+
advertisedReceiverWindow: any;
|
|
37
|
+
outboundStreams: any;
|
|
38
|
+
inboundStreams: any;
|
|
39
|
+
initialTsn: any;
|
|
40
|
+
stateCookie: any;
|
|
41
|
+
}): Buffer<ArrayBuffer>;
|
|
42
|
+
export function buildCookieEcho(stateCookie: any): Buffer<ArrayBuffer>;
|
|
43
|
+
export function buildCookieAck(): Buffer<ArrayBuffer>;
|
|
44
|
+
export function buildData({ tsn, streamId, streamSeq, ppid, payload, unordered, beginning, ending }: {
|
|
45
|
+
tsn: any;
|
|
46
|
+
streamId: any;
|
|
47
|
+
streamSeq: any;
|
|
48
|
+
ppid: any;
|
|
49
|
+
payload: any;
|
|
50
|
+
unordered?: boolean | undefined;
|
|
51
|
+
beginning?: boolean | undefined;
|
|
52
|
+
ending?: boolean | undefined;
|
|
53
|
+
}): Buffer<ArrayBuffer>;
|
|
54
|
+
export function parseData(chunkFlags: any, chunkValue: any): {
|
|
55
|
+
unordered: boolean;
|
|
56
|
+
beginning: boolean;
|
|
57
|
+
ending: boolean;
|
|
58
|
+
tsn: number;
|
|
59
|
+
streamId: any;
|
|
60
|
+
streamSeq: any;
|
|
61
|
+
ppid: number;
|
|
62
|
+
payload: any;
|
|
63
|
+
};
|
|
64
|
+
export function buildSack({ cumulativeTsnAck, advertisedReceiverWindow, gapAckBlocks }: {
|
|
65
|
+
cumulativeTsnAck: any;
|
|
66
|
+
advertisedReceiverWindow: any;
|
|
67
|
+
gapAckBlocks?: never[] | undefined;
|
|
68
|
+
}): Buffer<ArrayBuffer>;
|
|
69
|
+
export function parseSack(chunkValue: any): {
|
|
70
|
+
cumulativeTsnAck: number;
|
|
71
|
+
advertisedReceiverWindow: number;
|
|
72
|
+
gapAckBlocks: {
|
|
73
|
+
start: any;
|
|
74
|
+
end: any;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
export function buildHeartbeat(heartbeatInfo: any): Buffer<ArrayBuffer>;
|
|
78
|
+
export function buildHeartbeatAck(heartbeatParamValue: any): Buffer<ArrayBuffer>;
|
|
79
|
+
export function parseHeartbeatInfo(chunkValue: any): any;
|
|
80
|
+
export function buildAbort(reasonText?: string): Buffer<ArrayBuffer>;
|
|
81
|
+
export const ChunkType: Readonly<{
|
|
82
|
+
DATA: 0;
|
|
83
|
+
INIT: 1;
|
|
84
|
+
INIT_ACK: 2;
|
|
85
|
+
SACK: 3;
|
|
86
|
+
HEARTBEAT: 4;
|
|
87
|
+
HEARTBEAT_ACK: 5;
|
|
88
|
+
ABORT: 6;
|
|
89
|
+
SHUTDOWN: 7;
|
|
90
|
+
SHUTDOWN_ACK: 8;
|
|
91
|
+
ERROR: 9;
|
|
92
|
+
COOKIE_ECHO: 10;
|
|
93
|
+
COOKIE_ACK: 11;
|
|
94
|
+
SHUTDOWN_COMPLETE: 14;
|
|
95
|
+
}>;
|
|
96
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../../src/VoIP/relay/sctp/wire.js"],"names":[],"mappings":"AAsBA;;;;;wBAYC;AAED;;;;;EAcC;AAED;;;;IAYC;AAED,oFAQC;AAcD;;;;;;wBASC;AAED;;;;;;;EAkBC;AAED;;;;;;;wBAYC;AAED,uEAEC;AAED,sDAEC;AAID;;;;;;;;;wBAYC;AAED;;;;;;;;;EAWC;AAED;;;;wBAaC;AAED;;;;;;;EAgBC;AAED,wEAKC;AAED,iFAMC;AAED,yDAGC;AAED,qEAEC;AA/ND;;;;;;;;;;;;;;GAcG"}
|