werift 0.26.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 +182 -8
- package/THIRD_PARTY_LICENSES_LIBWEBRTC.txt +58 -0
- package/lib/common/src/binary.d.ts +1 -3
- package/lib/common/src/binary.js +8 -6
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/binaryData.js +2 -1
- package/lib/common/src/binaryData.js.map +1 -1
- 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/log.js +5 -7
- package/lib/common/src/log.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 +13 -7
- 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/cipher.d.ts +1 -1
- package/lib/dtls/src/context/cipher.js +6 -3
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.d.ts +2 -0
- package/lib/dtls/src/context/dtls.js +11 -2
- 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 +40 -3
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight1.js +2 -1
- package/lib/dtls/src/flight/client/flight1.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +8 -3
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +6 -1
- package/lib/dtls/src/flight/flight.js +18 -5
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.js +4 -2
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js +6 -2
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/const.d.ts +17 -13
- package/lib/dtls/src/handshake/const.js +16 -14
- package/lib/dtls/src/handshake/const.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.js +4 -2
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +2 -1
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +2 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +4 -2
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.js +14 -7
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +2 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/finished.js +2 -1
- package/lib/dtls/src/handshake/message/finished.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js +6 -3
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.js +12 -6
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +4 -2
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.js +16 -8
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +2 -2
- package/lib/dtls/src/handshake/random.js +5 -2
- package/lib/dtls/src/handshake/random.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 +52 -33
- package/lib/dtls/src/record/const.js +51 -36
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.js +12 -6
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.js +10 -5
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/record/message/plaintext.js +4 -2
- package/lib/dtls/src/record/message/plaintext.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 +326 -8
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidate.d.ts +1 -1
- package/lib/ice/src/candidate.js +24 -12
- package/lib/ice/src/candidate.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/dns/lookup.d.ts +10 -1
- package/lib/ice/src/dns/lookup.js +42 -7
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.d.ts +21 -5
- package/lib/ice/src/exceptions.js +58 -13
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/ice.d.ts +254 -58
- package/lib/ice/src/ice.js +979 -945
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/iceBase.d.ts +328 -14
- package/lib/ice/src/iceBase.js +254 -38
- 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.d.ts +30 -1
- package/lib/ice/src/stun/transaction.js +90 -19
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/turn/credential.d.ts +49 -0
- package/lib/ice/src/turn/credential.js +78 -0
- package/lib/ice/src/turn/credential.js.map +1 -0
- package/lib/ice/src/turn/protocol.d.ts +31 -10
- package/lib/ice/src/turn/protocol.js +127 -51
- 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.d.ts +2 -0
- package/lib/ice-server/src/stun/attributes.js +11 -1
- package/lib/ice-server/src/stun/attributes.js.map +1 -1
- package/lib/ice-server/src/stun/const.d.ts +44 -17
- package/lib/ice-server/src/stun/const.js +31 -19
- package/lib/ice-server/src/stun/const.js.map +1 -1
- package/lib/ice-server/src/stun/message.d.ts +29 -4
- package/lib/ice-server/src/stun/message.js +115 -24
- package/lib/ice-server/src/stun/message.js.map +1 -1
- package/lib/index.mjs +35121 -22337
- package/lib/nonstandard/index.mjs +3169 -1399
- package/lib/polyfill/dom.mjs +24650 -12365
- package/lib/polyfill/index.mjs +24650 -12365
- package/lib/rtp/src/codec/assertPayload.d.ts +4 -0
- package/lib/rtp/src/codec/assertPayload.js +12 -0
- package/lib/rtp/src/codec/assertPayload.js.map +1 -0
- package/lib/rtp/src/codec/av1.js +2 -0
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/h264.js +35 -43
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/vp8.js +11 -5
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.js +12 -0
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js +2 -1
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js +2 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.d.ts +21 -17
- package/lib/rtp/src/extra/container/mp4/h264.js +26 -24
- package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/index.d.ts +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js +1 -0
- package/lib/rtp/src/extra/container/ogg/index.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/writer.d.ts +90 -0
- package/lib/rtp/src/extra/container/ogg/writer.js +300 -0
- package/lib/rtp/src/extra/container/ogg/writer.js.map +1 -0
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js +6 -3
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +5 -0
- package/lib/rtp/src/extra/processor/depacketizer.js +28 -2
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtx.js +4 -2
- package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
- package/lib/rtp/src/extra/processor/index.d.ts +2 -0
- package/lib/rtp/src/extra/processor/index.js +2 -0
- package/lib/rtp/src/extra/processor/index.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +29 -6
- package/lib/rtp/src/extra/processor/jitterBuffer.js +101 -111
- package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js +2 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsync.d.ts +63 -0
- package/lib/rtp/src/extra/processor/lipsync.js +202 -51
- package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +0 -6
- package/lib/rtp/src/extra/processor/mp4.js +6 -3
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/mute.js +4 -2
- package/lib/rtp/src/extra/processor/mute.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.js +4 -2
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTime.js +4 -6
- package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/ogg.d.ts +72 -0
- package/lib/rtp/src/extra/processor/ogg.js +221 -0
- package/lib/rtp/src/extra/processor/ogg.js.map +1 -0
- package/lib/rtp/src/extra/processor/oggCallback.d.ts +21 -0
- package/lib/rtp/src/extra/processor/oggCallback.js +97 -0
- package/lib/rtp/src/extra/processor/oggCallback.js.map +1 -0
- package/lib/rtp/src/extra/processor/rtpCallback.js +2 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpStream.js +2 -1
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.js +2 -1
- package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/webm.js +14 -7
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/index.d.ts +8 -0
- package/lib/rtp/src/index.js +8 -0
- package/lib/rtp/src/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +4 -0
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +4 -0
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js +8 -4
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.d.ts +58 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js +143 -0
- package/lib/rtp/src/rtcp/rtpfb/transportWideSequence.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +35 -13
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +132 -54
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.d.ts +13 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js +29 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReceiveTiming.js.map +1 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.d.ts +41 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js +89 -0
- package/lib/rtp/src/rtcp/rtpfb/twccReferenceTime.js.map +1 -0
- package/lib/rtp/src/rtcp/sr.js +1 -0
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/rtp/continuity.d.ts +49 -0
- package/lib/rtp/src/rtp/continuity.js +120 -0
- package/lib/rtp/src/rtp/continuity.js.map +1 -0
- package/lib/rtp/src/rtp/headerExtension.js +41 -21
- package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
- package/lib/rtp/src/rtp/padding.d.ts +17 -0
- package/lib/rtp/src/rtp/padding.js +37 -0
- package/lib/rtp/src/rtp/padding.js.map +1 -0
- package/lib/rtp/src/rtp/red/encoder.d.ts +10 -0
- package/lib/rtp/src/rtp/red/encoder.js +14 -1
- package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.js +24 -8
- package/lib/rtp/src/rtp/red/packet.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.d.ts +24 -1
- package/lib/rtp/src/rtp/rtp.js +70 -29
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.js +3 -0
- package/lib/rtp/src/rtp/rtx.js.map +1 -1
- package/lib/rtp/src/rtp/sendHeaderExtensions.d.ts +36 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js +85 -0
- package/lib/rtp/src/rtp/sendHeaderExtensions.js.map +1 -0
- 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/rtp/src/srtp/cipher/ctr.js +4 -2
- package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/index.js +8 -4
- package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.js +6 -3
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtcp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtcp.js +33 -0
- package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtp.d.ts +1 -1
- package/lib/rtp/src/srtp/context/srtp.js +34 -10
- package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
- package/lib/rtp/src/srtp/error.d.ts +8 -0
- package/lib/rtp/src/srtp/error.js +13 -1
- package/lib/rtp/src/srtp/error.js.map +1 -1
- package/lib/rtp/src/srtp/packet.js +4 -1
- package/lib/rtp/src/srtp/packet.js.map +1 -1
- package/lib/rtp/src/srtp/replay.d.ts +24 -0
- package/lib/rtp/src/srtp/replay.js +75 -0
- package/lib/rtp/src/srtp/replay.js.map +1 -0
- package/lib/rtp/src/srtp/session.js +2 -1
- package/lib/rtp/src/srtp/session.js.map +1 -1
- package/lib/rtp/src/srtp/srtcp.js +2 -1
- package/lib/rtp/src/srtp/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/srtp.js +2 -1
- package/lib/rtp/src/srtp/srtp.js.map +1 -1
- package/lib/rtp/src/util.js +2 -1
- package/lib/rtp/src/util.js.map +1 -1
- package/lib/sctp/src/chunk.d.ts +5 -0
- package/lib/sctp/src/chunk.js +31 -8
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/const.d.ts +25 -17
- package/lib/sctp/src/const.js +23 -19
- package/lib/sctp/src/const.js.map +1 -1
- package/lib/sctp/src/param.d.ts +6 -2
- package/lib/sctp/src/param.js +22 -8
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +85 -0
- package/lib/sctp/src/sctp.js +707 -126
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.js +4 -2
- package/lib/sctp/src/transport.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 +385 -28
- package/lib/webrtc/src/api/peerConfig.js +121 -14
- 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/dataChannel.d.ts +10 -0
- package/lib/webrtc/src/dataChannel.js +24 -4
- package/lib/webrtc/src/dataChannel.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/index.d.ts +10 -0
- package/lib/webrtc/src/media/index.js +70 -0
- package/lib/webrtc/src/media/index.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.d.ts +43 -10
- package/lib/webrtc/src/media/receiver/nack.js +246 -88
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +61 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js +218 -63
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +241 -40
- package/lib/webrtc/src/media/router.js +676 -205
- 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 +252 -2
- package/lib/webrtc/src/media/rtpReceiver.js +833 -44
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +191 -70
- package/lib/webrtc/src/media/rtpSender.js +631 -448
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +19 -3
- package/lib/webrtc/src/media/rtpTransceiver.js +74 -9
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/bandwidthEstimator.d.ts +249 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js +144 -0
- package/lib/webrtc/src/media/sender/bandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.d.ts +20 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js +26 -0
- package/lib/webrtc/src/media/sender/createBandwidthEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.d.ts +70 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js +175 -0
- package/lib/webrtc/src/media/sender/estimatorBinding.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.d.ts +18 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js +44 -0
- package/lib/webrtc/src/media/sender/estimators/disabledBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.d.ts +79 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js +289 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/acknowledgedBitrateEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.d.ts +87 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js +429 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/aimdRateControl.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.d.ts +21 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js +84 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/alrDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.d.ts +37 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js +74 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/bandwidthLimitedCause.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.d.ts +383 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js +408 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/constants.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.d.ts +406 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js +1391 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/gccBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.d.ts +19 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js +75 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.d.ts +68 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js +201 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/interArrivalDelta.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js +72 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/intervalBudget.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.d.ts +41 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js +99 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/linkCapacityEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.d.ts +247 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js +1042 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/lossBasedBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.d.ts +26 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js +132 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/overuseDetector.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.d.ts +305 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js +1073 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/probeController.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.d.ts +60 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js +151 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/rttBasedBackoff.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.d.ts +44 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js +246 -0
- package/lib/webrtc/src/media/sender/estimators/gcc/trendlineEstimator.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/index.d.ts +7 -0
- package/lib/webrtc/src/media/sender/estimators/index.js +19 -0
- package/lib/webrtc/src/media/sender/estimators/index.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.d.ts +64 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js +216 -0
- package/lib/webrtc/src/media/sender/estimators/lightweightBwe.js.map +1 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.d.ts +117 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js +250 -0
- package/lib/webrtc/src/media/sender/estimators/twccFeedbackAdapter.js.map +1 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.d.ts +40 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js +153 -0
- package/lib/webrtc/src/media/sender/outgoingQueue.js.map +1 -0
- package/lib/webrtc/src/media/sender/padding.d.ts +45 -0
- package/lib/webrtc/src/media/sender/padding.js +134 -0
- package/lib/webrtc/src/media/sender/padding.js.map +1 -0
- package/lib/webrtc/src/media/sender/pendingRtp.d.ts +35 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js +120 -0
- package/lib/webrtc/src/media/sender/pendingRtp.js.map +1 -0
- package/lib/webrtc/src/media/sender/rtpWire.d.ts +13 -0
- package/lib/webrtc/src/media/sender/rtpWire.js +38 -0
- package/lib/webrtc/src/media/sender/rtpWire.js.map +1 -0
- package/lib/webrtc/src/media/sender/sendPacer.d.ts +27 -0
- package/lib/webrtc/src/media/sender/sendPacer.js +110 -0
- package/lib/webrtc/src/media/sender/sendPacer.js.map +1 -0
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +8 -33
- package/lib/webrtc/src/media/sender/senderBWE.js +5 -154
- package/lib/webrtc/src/media/sender/senderBWE.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 +101 -0
- package/lib/webrtc/src/media/sender/senderStats.js +317 -0
- package/lib/webrtc/src/media/sender/senderStats.js.map +1 -0
- package/lib/webrtc/src/media/track.d.ts +29 -2
- package/lib/webrtc/src/media/track.js +32 -5
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/negotiation/bundleTopology.d.ts +1 -5
- package/lib/webrtc/src/negotiation/bundleTopology.js +15 -11
- package/lib/webrtc/src/negotiation/bundleTopology.js.map +1 -1
- package/lib/webrtc/src/negotiation/descriptionValidation.js +12 -6
- package/lib/webrtc/src/negotiation/descriptionValidation.js.map +1 -1
- package/lib/webrtc/src/negotiation/negotiationNeeded.js +2 -1
- package/lib/webrtc/src/negotiation/negotiationNeeded.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteCandidates.js +10 -5
- package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
- package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +24 -7
- package/lib/webrtc/src/negotiation/remoteMediaApplication.js +67 -27
- 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 +40 -8
- package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
- package/lib/webrtc/src/negotiationTransaction.d.ts +43 -5
- package/lib/webrtc/src/negotiationTransaction.js +129 -13
- package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
- package/lib/webrtc/src/nonstandard/dummyMedia.js +2 -1
- package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
- package/lib/webrtc/src/nonstandard/navigator.js +4 -3
- package/lib/webrtc/src/nonstandard/navigator.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +32 -8
- package/lib/webrtc/src/nonstandard/recorder/index.js +81 -20
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +9 -7
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js +2 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.d.ts +32 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js +185 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/ogg.js.map +1 -0
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +8 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.js +2 -1
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +108 -6
- package/lib/webrtc/src/peerConnection.js +357 -36
- 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/polyfill/mediaDevices.js +2 -1
- package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
- package/lib/webrtc/src/sctpManager.d.ts +46 -14
- package/lib/webrtc/src/sctpManager.js +92 -25
- package/lib/webrtc/src/sctpManager.js.map +1 -1
- package/lib/webrtc/src/sdp.d.ts +69 -0
- package/lib/webrtc/src/sdp.js +151 -20
- 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 +89 -4
- package/lib/webrtc/src/secureTransportManager.js +184 -26
- package/lib/webrtc/src/secureTransportManager.js.map +1 -1
- package/lib/webrtc/src/transceiverManager.d.ts +82 -4
- package/lib/webrtc/src/transceiverManager.js +239 -41
- package/lib/webrtc/src/transceiverManager.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +147 -1
- package/lib/webrtc/src/transport/dtls.js +446 -50
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +71 -90
- package/lib/webrtc/src/transport/ice.js +250 -42
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +25 -0
- package/lib/webrtc/src/transport/sctp.js +153 -22
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +69 -3
- package/lib/webrtc/src/utils.js +105 -16
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +9 -6
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pairKey = exports.RegularNomination = exports.decideNomination = exports.PREFERRED_PAIR_WAIT_MS = exports.ICE_NOMINATION_ABANDONED = exports.NOMINATION_ATTEMPTS = exports.DEFAULT_NOMINATION_DELAY_MS = void 0;
|
|
4
|
+
const iceBase_1 = require("../iceBase");
|
|
5
|
+
const common_1 = require("../imports/common");
|
|
6
|
+
const log = (0, common_1.debug)("werift-ice : packages/ice/src/nomination/regularNomination.ts : log");
|
|
7
|
+
/** Default of `IceOptions.nominationDelayMs`. */
|
|
8
|
+
exports.DEFAULT_NOMINATION_DELAY_MS = 300;
|
|
9
|
+
/**
|
|
10
|
+
* USE-CANDIDATE transactions sent for one pair before an unanswered
|
|
11
|
+
* nomination gives up (each one retransmits as a check does).
|
|
12
|
+
*/
|
|
13
|
+
exports.NOMINATION_ATTEMPTS = 3;
|
|
14
|
+
/**
|
|
15
|
+
* Check-list result: an unanswered nomination was abandoned. Unlike
|
|
16
|
+
* ICE_FAILED (which connect() keeps waiting past, as more candidates may
|
|
17
|
+
* still pair), it ends connect() with an error.
|
|
18
|
+
*/
|
|
19
|
+
exports.ICE_NOMINATION_ABANDONED = 3;
|
|
20
|
+
/**
|
|
21
|
+
* How long, from the start of its checks, the live checklist waits for the pair
|
|
22
|
+
* a provisional nomination may have selected (`NominationHint`) to appear.
|
|
23
|
+
* It can appear after end-of-candidates: a peer-reflexive or passive TCP
|
|
24
|
+
* pair forms only when the peer's check arrives. Covers the peer's check
|
|
25
|
+
* pacing and a TCP check's response timeout (`TCP_CHECK_RESPONSE_TIMEOUT_MS`).
|
|
26
|
+
*/
|
|
27
|
+
exports.PREFERRED_PAIR_WAIT_MS = 3000;
|
|
28
|
+
/**
|
|
29
|
+
* RFC 8445 §8.1.1 regular nomination: when the controlling agent stops
|
|
30
|
+
* checking and nominates, shared by the live and the provisional checklist.
|
|
31
|
+
*
|
|
32
|
+
* - With a `preferred` rule (the peer may have selected that path already,
|
|
33
|
+
* see `NominationHint`), only the matching pair may be nominated: as soon
|
|
34
|
+
* as it is valid, waited for while its check runs. When it fails, or is not
|
|
35
|
+
* in the checklist `PREFERRED_PAIR_WAIT_MS` (at least the delay) after the
|
|
36
|
+
* checklist began, even after end-of-candidates or with no other valid
|
|
37
|
+
* pair, the nomination is
|
|
38
|
+
* abandoned (as an unanswered one is):
|
|
39
|
+
* nominating another pair could leave the agents on different paths.
|
|
40
|
+
* - The candidate is the first valid (Succeeded) pair of `pairs` (priority
|
|
41
|
+
* order, highest first), so the choice is deterministic.
|
|
42
|
+
* - Nominate at once when both sides signalled end-of-candidates and no
|
|
43
|
+
* higher-priority pair can still succeed.
|
|
44
|
+
* - Otherwise wait until `quietSince + delayMs`, then nominate anyway: a
|
|
45
|
+
* higher-priority pair still in progress (an unreachable host pair takes
|
|
46
|
+
* seconds to fail) or a peer that never signals end-of-candidates must not
|
|
47
|
+
* hold the selection back longer than that.
|
|
48
|
+
*/
|
|
49
|
+
const decideNomination = ({ pairs, remoteCandidatesEnd, localCandidatesEnd, quietSince, delayMs, now, unchecked, preferred, preferredSince, }) => {
|
|
50
|
+
if (preferred) {
|
|
51
|
+
const hinted = pairs.find(preferred);
|
|
52
|
+
if (hinted?.state === iceBase_1.CandidatePairState.SUCCEEDED) {
|
|
53
|
+
return { action: "nominate", pair: hinted };
|
|
54
|
+
}
|
|
55
|
+
if (hinted) {
|
|
56
|
+
if (hinted.state === iceBase_1.CandidatePairState.FAILED || unchecked(hinted)) {
|
|
57
|
+
return { action: "abandon", pair: hinted };
|
|
58
|
+
}
|
|
59
|
+
// Its check finishing re-evaluates the nomination.
|
|
60
|
+
return { action: "none" };
|
|
61
|
+
}
|
|
62
|
+
// Not (yet) in the checklist. End-of-candidates does not settle it, nor
|
|
63
|
+
// does an empty checklist: a peer-reflexive pair (or a passive TCP one) is
|
|
64
|
+
// only formed when the peer's check arrives, so wait for it a bounded time
|
|
65
|
+
// from when the checklist began.
|
|
66
|
+
const deadline = (preferredSince ?? now) + Math.max(delayMs, exports.PREFERRED_PAIR_WAIT_MS);
|
|
67
|
+
if (now >= deadline)
|
|
68
|
+
return { action: "abandon" };
|
|
69
|
+
return { action: "wait", deadline };
|
|
70
|
+
}
|
|
71
|
+
const index = pairs.findIndex((pair) => pair.state === iceBase_1.CandidatePairState.SUCCEEDED);
|
|
72
|
+
if (index === -1)
|
|
73
|
+
return { action: "none" };
|
|
74
|
+
const pair = pairs[index];
|
|
75
|
+
const pendingAbove = pairs
|
|
76
|
+
.slice(0, index)
|
|
77
|
+
.some((above) => above.state !== iceBase_1.CandidatePairState.FAILED && !unchecked(above));
|
|
78
|
+
if (remoteCandidatesEnd && localCandidatesEnd && !pendingAbove) {
|
|
79
|
+
return { action: "nominate", pair };
|
|
80
|
+
}
|
|
81
|
+
const deadline = (quietSince ?? now) + delayMs;
|
|
82
|
+
if (now >= deadline)
|
|
83
|
+
return { action: "nominate", pair };
|
|
84
|
+
return { action: "wait", deadline };
|
|
85
|
+
};
|
|
86
|
+
exports.decideNomination = decideNomination;
|
|
87
|
+
/**
|
|
88
|
+
* The regular nomination (RFC 8445 §8.1.1) of one checklist: the single
|
|
89
|
+
* state and rule set the live checklist and the provisional (ICE-restart)
|
|
90
|
+
* checklist share. It holds the delay, the USE-CANDIDATE attempt in flight,
|
|
91
|
+
* its repeats and the abandoned state; the checklist supplies the pairs and
|
|
92
|
+
* applies the outcome (`NominationHost`).
|
|
93
|
+
*
|
|
94
|
+
* - Delay: `quietSince` is the first valid pair, moved forward by every pair
|
|
95
|
+
* added later that outranks the best valid pair and is checked locally
|
|
96
|
+
* (a forceTurn-excluded pair cannot replace it and does not count).
|
|
97
|
+
* - One attempt at a time; a result whose attempt is no longer current (a
|
|
98
|
+
* restart, a replacement pranswer, close or a role change replaced it) is
|
|
99
|
+
* ignored and its transaction aborted.
|
|
100
|
+
* - An unanswered attempt may have been accepted: it is repeated on the same
|
|
101
|
+
* pair (never another), also when a repeat is answered with an error. When
|
|
102
|
+
* all `NOMINATION_ATTEMPTS` go unanswered nothing else is nominated.
|
|
103
|
+
* - An error answering the first attempt: only that pair fails.
|
|
104
|
+
*/
|
|
105
|
+
class RegularNomination {
|
|
106
|
+
constructor(host) {
|
|
107
|
+
Object.defineProperty(this, "quietSince", {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
configurable: true,
|
|
110
|
+
writable: true,
|
|
111
|
+
value: void 0
|
|
112
|
+
});
|
|
113
|
+
/** The checklist began waiting for the preferred pair (see `decideNomination`). */
|
|
114
|
+
Object.defineProperty(this, "preferredSince", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
value: void 0
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(this, "timer", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true,
|
|
123
|
+
writable: true,
|
|
124
|
+
value: void 0
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(this, "attempt", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
configurable: true,
|
|
129
|
+
writable: true,
|
|
130
|
+
value: void 0
|
|
131
|
+
});
|
|
132
|
+
/** Every attempt went unanswered: no other pair is nominated until reset. */
|
|
133
|
+
Object.defineProperty(this, "abandoned", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true,
|
|
136
|
+
writable: true,
|
|
137
|
+
value: false
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* The pair a USE-CANDIDATE was sent to and the peer did not refuse: the
|
|
141
|
+
* peer may have selected it (the provisional checklist hands it to the
|
|
142
|
+
* live one at the final answer, see `NominationHint`).
|
|
143
|
+
*/
|
|
144
|
+
Object.defineProperty(this, "maybeSelected", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
configurable: true,
|
|
147
|
+
writable: true,
|
|
148
|
+
value: void 0
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(this, "host", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
configurable: true,
|
|
153
|
+
writable: true,
|
|
154
|
+
value: void 0
|
|
155
|
+
});
|
|
156
|
+
this.host = host;
|
|
157
|
+
}
|
|
158
|
+
/** A USE-CANDIDATE transaction is in flight. */
|
|
159
|
+
get inFlight() {
|
|
160
|
+
return this.attempt !== undefined;
|
|
161
|
+
}
|
|
162
|
+
/** Waiting for the delay to end. */
|
|
163
|
+
get waiting() {
|
|
164
|
+
return this.timer !== undefined;
|
|
165
|
+
}
|
|
166
|
+
/** `pair` joined the checklist; `best` was its best valid pair before. */
|
|
167
|
+
pairAdded(pair, best) {
|
|
168
|
+
// A pair that may replace the best valid pair restarts the delay; a
|
|
169
|
+
// lower-priority one, or one the agent never checks, cannot change the
|
|
170
|
+
// choice and does not.
|
|
171
|
+
if (best && !this.host.unchecked(pair) && this.host.outranks(pair, best)) {
|
|
172
|
+
this.quietSince = Date.now();
|
|
173
|
+
this.evaluate();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Nominate now, or arm the timer that re-evaluates at the deadline. Called
|
|
178
|
+
* whenever the answer may change: a check finished, a pair was added,
|
|
179
|
+
* end-of-candidates, the role changed, the timer fired.
|
|
180
|
+
*/
|
|
181
|
+
evaluate() {
|
|
182
|
+
if (!this.host.active() || this.attempt || this.abandoned) {
|
|
183
|
+
this.stop();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const pairs = this.host.pairs();
|
|
187
|
+
const now = Date.now();
|
|
188
|
+
if (this.quietSince === undefined &&
|
|
189
|
+
pairs.some((pair) => pair.state === iceBase_1.CandidatePairState.SUCCEEDED)) {
|
|
190
|
+
this.quietSince = now;
|
|
191
|
+
}
|
|
192
|
+
const preferred = this.host.preferred();
|
|
193
|
+
if (preferred &&
|
|
194
|
+
this.preferredSince === undefined &&
|
|
195
|
+
this.host.checking()) {
|
|
196
|
+
this.preferredSince = now;
|
|
197
|
+
}
|
|
198
|
+
const decision = (0, exports.decideNomination)({
|
|
199
|
+
pairs,
|
|
200
|
+
remoteCandidatesEnd: this.host.remoteCandidatesEnd(),
|
|
201
|
+
localCandidatesEnd: this.host.localCandidatesEnd(),
|
|
202
|
+
quietSince: this.quietSince,
|
|
203
|
+
delayMs: this.host.delayMs(),
|
|
204
|
+
now,
|
|
205
|
+
unchecked: this.host.unchecked,
|
|
206
|
+
preferred,
|
|
207
|
+
preferredSince: this.preferredSince,
|
|
208
|
+
});
|
|
209
|
+
this.stop();
|
|
210
|
+
if (decision.action === "wait") {
|
|
211
|
+
this.timer = setTimeout(() => {
|
|
212
|
+
this.timer = undefined;
|
|
213
|
+
this.evaluate();
|
|
214
|
+
this.host.deadlinePassed?.();
|
|
215
|
+
}, Math.max(0, decision.deadline - now));
|
|
216
|
+
}
|
|
217
|
+
else if (decision.action === "nominate") {
|
|
218
|
+
this.nominate(decision.pair, 1, false);
|
|
219
|
+
}
|
|
220
|
+
else if (decision.action === "abandon") {
|
|
221
|
+
log("preferred pair cannot be nominated, giving up");
|
|
222
|
+
this.abandoned = true;
|
|
223
|
+
this.host.abandoned(decision.pair);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Stop waiting (a pair was nominated, or nomination is not possible now). */
|
|
227
|
+
stop() {
|
|
228
|
+
if (this.timer !== undefined) {
|
|
229
|
+
clearTimeout(this.timer);
|
|
230
|
+
this.timer = undefined;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** The role changed: the attempt in flight was sent as the controlling agent and changes nothing after it. */
|
|
234
|
+
invalidate() {
|
|
235
|
+
this.attempt?.abort.abort();
|
|
236
|
+
this.attempt = undefined;
|
|
237
|
+
this.abandoned = false;
|
|
238
|
+
}
|
|
239
|
+
/** The checklist starts over (restart, replacement pranswer, renomination, close). */
|
|
240
|
+
reset() {
|
|
241
|
+
this.invalidate();
|
|
242
|
+
this.stop();
|
|
243
|
+
this.quietSince = undefined;
|
|
244
|
+
this.preferredSince = undefined;
|
|
245
|
+
this.maybeSelected = undefined;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @param maybeAccepted an earlier attempt for `pair` went unanswered: the
|
|
249
|
+
* peer may have selected the pair already, so no later outcome lets the
|
|
250
|
+
* nomination move to another pair.
|
|
251
|
+
*/
|
|
252
|
+
nominate(pair, attempt, maybeAccepted) {
|
|
253
|
+
log("nominate", pair.toJSON(), { attempt, maybeAccepted });
|
|
254
|
+
const current = { pair, abort: new AbortController() };
|
|
255
|
+
this.attempt = current;
|
|
256
|
+
this.maybeSelected = pair;
|
|
257
|
+
void this.host.send(pair, current.abort.signal).then((outcome) => {
|
|
258
|
+
if (this.attempt !== current)
|
|
259
|
+
return;
|
|
260
|
+
this.attempt = undefined;
|
|
261
|
+
if (!this.host.owns(pair)) {
|
|
262
|
+
// The pair left the checklist (another remote generation dropped).
|
|
263
|
+
if (this.maybeSelected === pair)
|
|
264
|
+
this.maybeSelected = undefined;
|
|
265
|
+
this.evaluate();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (outcome === "nominated") {
|
|
269
|
+
this.stop();
|
|
270
|
+
this.host.nominated(pair);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (outcome === "role-conflict") {
|
|
274
|
+
// The peer did not accept it as controlled; it nominates now.
|
|
275
|
+
log("nomination role conflict", pair.toJSON());
|
|
276
|
+
if (!maybeAccepted)
|
|
277
|
+
this.maybeSelected = undefined;
|
|
278
|
+
this.host.roleConflict(pair);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (outcome === "unanswered" || maybeAccepted) {
|
|
282
|
+
if (attempt < exports.NOMINATION_ATTEMPTS) {
|
|
283
|
+
log("nomination unanswered, repeating", pair.toJSON(), { attempt });
|
|
284
|
+
this.nominate(pair, attempt + 1, true);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
log("nomination unanswered, giving up", pair.toJSON());
|
|
288
|
+
this.abandoned = true;
|
|
289
|
+
this.stop();
|
|
290
|
+
this.host.abandoned(pair);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
log("nomination rejected", pair.toJSON());
|
|
294
|
+
this.maybeSelected = undefined;
|
|
295
|
+
this.host.rejected(pair);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
exports.RegularNomination = RegularNomination;
|
|
300
|
+
/** Local foundation and the 5-tuple: the same path in another checklist. */
|
|
301
|
+
const pairKey = (pair) => [
|
|
302
|
+
pair.localCandidate.foundation,
|
|
303
|
+
pair.localCandidate.transport.toLowerCase(),
|
|
304
|
+
pair.localCandidate.host,
|
|
305
|
+
pair.localCandidate.port,
|
|
306
|
+
pair.remoteCandidate.transport.toLowerCase(),
|
|
307
|
+
pair.remoteCandidate.host,
|
|
308
|
+
pair.remoteCandidate.port,
|
|
309
|
+
].join(" ");
|
|
310
|
+
exports.pairKey = pairKey;
|
|
311
|
+
//# sourceMappingURL=regularNomination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regularNomination.js","sourceRoot":"","sources":["../../../../../ice/src/nomination/regularNomination.ts"],"names":[],"mappings":";;;AAAA,wCAAoE;AACpE,8CAA0C;AAG1C,MAAM,GAAG,GAAG,IAAA,cAAK,EACf,qEAAqE,CACtE,CAAC;AAEF,iDAAiD;AACpC,QAAA,2BAA2B,GAAG,GAAG,CAAC;AAC/C;;;GAGG;AACU,QAAA,mBAAmB,GAAG,CAAC,CAAC;AACrC;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,CAAC,CAAC;AAC1C;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAS3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,GAAG,EACH,SAAS,EACT,SAAS,EACT,cAAc,GAaf,EAAsB,EAAE;IACvB,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,MAAM,EAAE,KAAK,KAAK,4BAAkB,CAAC,SAAS,EAAE,CAAC;YACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,MAAM,CAAC,KAAK,KAAK,4BAAkB,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpE,OAAO,EAAE,MAAM,EAAE,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,GAAG,CAAC,kCAAkC,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;oBACpE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;oBACvC,OAAO;gBACT,CAAC;gBACD,GAAG,CAAC,kCAAkC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;gBACvD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1C,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9KD,8CA8KC;AA6BD,4EAA4E;AACrE,MAAM,OAAO,GAAG,CAAC,IAAmB,EAAE,EAAE,CAC7C;IACE,IAAI,CAAC,cAAc,CAAC,UAAU;IAC9B,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,EAAE;IAC3C,IAAI,CAAC,cAAc,CAAC,IAAI;IACxB,IAAI,CAAC,cAAc,CAAC,IAAI;IACxB,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAAW,EAAE;IAC5C,IAAI,CAAC,eAAe,CAAC,IAAI;IACzB,IAAI,CAAC,eAAe,CAAC,IAAI;CAC1B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AATD,QAAA,OAAO,WASN","sourcesContent":["import { type CandidatePair, CandidatePairState } from \"../iceBase\";\nimport { debug } from \"../imports/common\";\nimport type { Protocol } from \"../types/model\";\n\nconst log = debug(\n \"werift-ice : packages/ice/src/nomination/regularNomination.ts : log\",\n);\n\n/** Default of `IceOptions.nominationDelayMs`. */\nexport const DEFAULT_NOMINATION_DELAY_MS = 300;\n/**\n * USE-CANDIDATE transactions sent for one pair before an unanswered\n * nomination gives up (each one retransmits as a check does).\n */\nexport const NOMINATION_ATTEMPTS = 3;\n/**\n * Check-list result: an unanswered nomination was abandoned. Unlike\n * ICE_FAILED (which connect() keeps waiting past, as more candidates may\n * still pair), it ends connect() with an error.\n */\nexport const ICE_NOMINATION_ABANDONED = 3;\n/**\n * How long, from the start of its checks, the live checklist waits for the pair\n * a provisional nomination may have selected (`NominationHint`) to appear.\n * It can appear after end-of-candidates: a peer-reflexive or passive TCP\n * pair forms only when the peer's check arrives. Covers the peer's check\n * pacing and a TCP check's response timeout (`TCP_CHECK_RESPONSE_TIMEOUT_MS`).\n */\nexport const PREFERRED_PAIR_WAIT_MS = 3000;\n\nexport type NominationDecision =\n | { action: \"nominate\"; pair: CandidatePair }\n | { action: \"wait\"; deadline: number }\n /** The pair the peer may have selected cannot be nominated: nominate nothing else. */\n | { action: \"abandon\"; pair?: CandidatePair }\n | { action: \"none\" };\n\n/**\n * RFC 8445 §8.1.1 regular nomination: when the controlling agent stops\n * checking and nominates, shared by the live and the provisional checklist.\n *\n * - With a `preferred` rule (the peer may have selected that path already,\n * see `NominationHint`), only the matching pair may be nominated: as soon\n * as it is valid, waited for while its check runs. When it fails, or is not\n * in the checklist `PREFERRED_PAIR_WAIT_MS` (at least the delay) after the\n * checklist began, even after end-of-candidates or with no other valid\n * pair, the nomination is\n * abandoned (as an unanswered one is):\n * nominating another pair could leave the agents on different paths.\n * - The candidate is the first valid (Succeeded) pair of `pairs` (priority\n * order, highest first), so the choice is deterministic.\n * - Nominate at once when both sides signalled end-of-candidates and no\n * higher-priority pair can still succeed.\n * - Otherwise wait until `quietSince + delayMs`, then nominate anyway: a\n * higher-priority pair still in progress (an unreachable host pair takes\n * seconds to fail) or a peer that never signals end-of-candidates must not\n * hold the selection back longer than that.\n */\nexport const decideNomination = ({\n pairs,\n remoteCandidatesEnd,\n localCandidatesEnd,\n quietSince,\n delayMs,\n now,\n unchecked,\n preferred,\n preferredSince,\n}: {\n pairs: readonly CandidatePair[];\n remoteCandidatesEnd: boolean;\n localCandidatesEnd: boolean;\n quietSince: number | undefined;\n delayMs: number;\n now: number;\n /** Pairs never checked locally, which cannot be waited for. */\n unchecked: (pair: CandidatePair) => boolean;\n preferred: ((pair: CandidatePair) => boolean) | undefined;\n /** When the checklist began waiting for the `preferred` pair. */\n preferredSince: number | undefined;\n}): NominationDecision => {\n if (preferred) {\n const hinted = pairs.find(preferred);\n if (hinted?.state === CandidatePairState.SUCCEEDED) {\n return { action: \"nominate\", pair: hinted };\n }\n if (hinted) {\n if (hinted.state === CandidatePairState.FAILED || unchecked(hinted)) {\n return { action: \"abandon\", pair: hinted };\n }\n // Its check finishing re-evaluates the nomination.\n return { action: \"none\" };\n }\n // Not (yet) in the checklist. End-of-candidates does not settle it, nor\n // does an empty checklist: a peer-reflexive pair (or a passive TCP one) is\n // only formed when the peer's check arrives, so wait for it a bounded time\n // from when the checklist began.\n const deadline =\n (preferredSince ?? now) + Math.max(delayMs, PREFERRED_PAIR_WAIT_MS);\n if (now >= deadline) return { action: \"abandon\" };\n return { action: \"wait\", deadline };\n }\n const index = pairs.findIndex(\n (pair) => pair.state === CandidatePairState.SUCCEEDED,\n );\n if (index === -1) return { action: \"none\" };\n const pair = pairs[index];\n const pendingAbove = pairs\n .slice(0, index)\n .some(\n (above) => above.state !== CandidatePairState.FAILED && !unchecked(above),\n );\n if (remoteCandidatesEnd && localCandidatesEnd && !pendingAbove) {\n return { action: \"nominate\", pair };\n }\n const deadline = (quietSince ?? now) + delayMs;\n if (now >= deadline) return { action: \"nominate\", pair };\n return { action: \"wait\", deadline };\n};\n\n/** What a USE-CANDIDATE check came back with. */\nexport type NominationOutcome =\n /** Answered with success. */\n | \"nominated\"\n /** Timed out: the request may have reached the peer, which may have selected the pair. */\n | \"unanswered\"\n /** An error response, or the request never left (e.g. a refused TCP connect). */\n | \"rejected\"\n /** 487: the peer is controlling too and wins (RFC 8445 §7.2.5.1). */\n | \"role-conflict\";\n\n/** What a checklist (live or provisional) supplies to its `RegularNomination`. */\nexport type NominationHost = {\n /** The controlling agent nominates in this checklist now (full ICE on both sides, nothing nominated yet, the checklist still current). */\n active: () => boolean;\n /** The checklist's checks began (connect(), startProvisionalChecks()). */\n checking: () => boolean;\n /** The checklist, highest priority first. */\n pairs: () => readonly CandidatePair[];\n remoteCandidatesEnd: () => boolean;\n localCandidatesEnd: () => boolean;\n delayMs: () => number;\n /** Pairs never checked locally (forceTurn), which cannot be waited for. */\n unchecked: (pair: CandidatePair) => boolean;\n outranks: (pair: CandidatePair, other: CandidatePair) => boolean;\n /** Matches the only pair that may be nominated: the peer may have selected it already (see `NominationHint`). */\n preferred: () => ((pair: CandidatePair) => boolean) | undefined;\n /** A result for `pair` still applies: the pair is in the checklist and the agent open. */\n owns: (pair: CandidatePair) => boolean;\n /** Send the USE-CANDIDATE check; never rejects. */\n send: (\n pair: CandidatePair,\n signal: AbortSignal,\n ) => Promise<NominationOutcome>;\n nominated: (pair: CandidatePair) => void;\n /** The peer refused the pair: fail it, so the next valid pair is nominated. */\n rejected: (pair: CandidatePair) => void;\n roleConflict: (pair: CandidatePair) => void;\n /**\n * No attempt on a pair the peer may have selected was answered, or that\n * pair (the hint) failed or never appeared (`pair` undefined).\n */\n abandoned: (pair?: CandidatePair) => void;\n /** The delay ended (after the re-evaluation it triggers). */\n deadlinePassed?: () => void;\n};\n\n/**\n * The regular nomination (RFC 8445 §8.1.1) of one checklist: the single\n * state and rule set the live checklist and the provisional (ICE-restart)\n * checklist share. It holds the delay, the USE-CANDIDATE attempt in flight,\n * its repeats and the abandoned state; the checklist supplies the pairs and\n * applies the outcome (`NominationHost`).\n *\n * - Delay: `quietSince` is the first valid pair, moved forward by every pair\n * added later that outranks the best valid pair and is checked locally\n * (a forceTurn-excluded pair cannot replace it and does not count).\n * - One attempt at a time; a result whose attempt is no longer current (a\n * restart, a replacement pranswer, close or a role change replaced it) is\n * ignored and its transaction aborted.\n * - An unanswered attempt may have been accepted: it is repeated on the same\n * pair (never another), also when a repeat is answered with an error. When\n * all `NOMINATION_ATTEMPTS` go unanswered nothing else is nominated.\n * - An error answering the first attempt: only that pair fails.\n */\nexport class RegularNomination {\n private quietSince?: number;\n /** The checklist began waiting for the preferred pair (see `decideNomination`). */\n private preferredSince?: number;\n private timer?: ReturnType<typeof setTimeout>;\n private attempt?: { pair: CandidatePair; abort: AbortController };\n /** Every attempt went unanswered: no other pair is nominated until reset. */\n abandoned = false;\n /**\n * The pair a USE-CANDIDATE was sent to and the peer did not refuse: the\n * peer may have selected it (the provisional checklist hands it to the\n * live one at the final answer, see `NominationHint`).\n */\n maybeSelected?: CandidatePair;\n\n private readonly host: NominationHost;\n\n constructor(host: NominationHost) {\n this.host = host;\n }\n\n /** A USE-CANDIDATE transaction is in flight. */\n get inFlight() {\n return this.attempt !== undefined;\n }\n\n /** Waiting for the delay to end. */\n get waiting() {\n return this.timer !== undefined;\n }\n\n /** `pair` joined the checklist; `best` was its best valid pair before. */\n pairAdded(pair: CandidatePair, best: CandidatePair | undefined) {\n // A pair that may replace the best valid pair restarts the delay; a\n // lower-priority one, or one the agent never checks, cannot change the\n // choice and does not.\n if (best && !this.host.unchecked(pair) && this.host.outranks(pair, best)) {\n this.quietSince = Date.now();\n this.evaluate();\n }\n }\n\n /**\n * Nominate now, or arm the timer that re-evaluates at the deadline. Called\n * whenever the answer may change: a check finished, a pair was added,\n * end-of-candidates, the role changed, the timer fired.\n */\n evaluate() {\n if (!this.host.active() || this.attempt || this.abandoned) {\n this.stop();\n return;\n }\n const pairs = this.host.pairs();\n const now = Date.now();\n if (\n this.quietSince === undefined &&\n pairs.some((pair) => pair.state === CandidatePairState.SUCCEEDED)\n ) {\n this.quietSince = now;\n }\n const preferred = this.host.preferred();\n if (\n preferred &&\n this.preferredSince === undefined &&\n this.host.checking()\n ) {\n this.preferredSince = now;\n }\n const decision = decideNomination({\n pairs,\n remoteCandidatesEnd: this.host.remoteCandidatesEnd(),\n localCandidatesEnd: this.host.localCandidatesEnd(),\n quietSince: this.quietSince,\n delayMs: this.host.delayMs(),\n now,\n unchecked: this.host.unchecked,\n preferred,\n preferredSince: this.preferredSince,\n });\n this.stop();\n if (decision.action === \"wait\") {\n this.timer = setTimeout(\n () => {\n this.timer = undefined;\n this.evaluate();\n this.host.deadlinePassed?.();\n },\n Math.max(0, decision.deadline - now),\n );\n } else if (decision.action === \"nominate\") {\n this.nominate(decision.pair, 1, false);\n } else if (decision.action === \"abandon\") {\n log(\"preferred pair cannot be nominated, giving up\");\n this.abandoned = true;\n this.host.abandoned(decision.pair);\n }\n }\n\n /** Stop waiting (a pair was nominated, or nomination is not possible now). */\n stop() {\n if (this.timer !== undefined) {\n clearTimeout(this.timer);\n this.timer = undefined;\n }\n }\n\n /** The role changed: the attempt in flight was sent as the controlling agent and changes nothing after it. */\n invalidate() {\n this.attempt?.abort.abort();\n this.attempt = undefined;\n this.abandoned = false;\n }\n\n /** The checklist starts over (restart, replacement pranswer, renomination, close). */\n reset() {\n this.invalidate();\n this.stop();\n this.quietSince = undefined;\n this.preferredSince = undefined;\n this.maybeSelected = undefined;\n }\n\n /**\n * @param maybeAccepted an earlier attempt for `pair` went unanswered: the\n * peer may have selected the pair already, so no later outcome lets the\n * nomination move to another pair.\n */\n private nominate(\n pair: CandidatePair,\n attempt: number,\n maybeAccepted: boolean,\n ) {\n log(\"nominate\", pair.toJSON(), { attempt, maybeAccepted });\n const current = { pair, abort: new AbortController() };\n this.attempt = current;\n this.maybeSelected = pair;\n void this.host.send(pair, current.abort.signal).then((outcome) => {\n if (this.attempt !== current) return;\n this.attempt = undefined;\n if (!this.host.owns(pair)) {\n // The pair left the checklist (another remote generation dropped).\n if (this.maybeSelected === pair) this.maybeSelected = undefined;\n this.evaluate();\n return;\n }\n if (outcome === \"nominated\") {\n this.stop();\n this.host.nominated(pair);\n return;\n }\n if (outcome === \"role-conflict\") {\n // The peer did not accept it as controlled; it nominates now.\n log(\"nomination role conflict\", pair.toJSON());\n if (!maybeAccepted) this.maybeSelected = undefined;\n this.host.roleConflict(pair);\n return;\n }\n if (outcome === \"unanswered\" || maybeAccepted) {\n if (attempt < NOMINATION_ATTEMPTS) {\n log(\"nomination unanswered, repeating\", pair.toJSON(), { attempt });\n this.nominate(pair, attempt + 1, true);\n return;\n }\n log(\"nomination unanswered, giving up\", pair.toJSON());\n this.abandoned = true;\n this.stop();\n this.host.abandoned(pair);\n return;\n }\n log(\"nomination rejected\", pair.toJSON());\n this.maybeSelected = undefined;\n this.host.rejected(pair);\n });\n }\n}\n\n/**\n * The pair the controlling agent may have nominated in the provisional\n * checklist when a final answer replaced it with the live one. The peer\n * may have selected that pair already: a USE-CANDIDATE retransmission can\n * reach its live checklist (same credentials) after it committed the\n * answer, and a peer that keeps the ICE session across pranswer -> answer\n * (JSEP) keeps its provisional selection. The live checklist checks from\n * scratch (`[2.7-T4a]`) but nominates only the pair with the same 5-tuple;\n * when that pair fails or never appears it nominates nothing else and the\n * agent fails (see `decideNomination`). It only applies while the live\n * checklist uses the provisional credentials and the agent keeps the pair's\n * local socket (`protocol`); otherwise the usual rules choose the pair.\n */\nexport type NominationHint = {\n localUsername: string;\n remoteUsername: string;\n remotePassword: string;\n key: string;\n /**\n * The local socket (or TURN allocation) of the pair. The hint holds only\n * while the agent keeps it: a commit that closes it (an ICE restart\n * allocates TURN afresh, gather options that exclude the socket) ends the\n * path for both agents, so no selection of the peer is left to match.\n */\n protocol: Protocol;\n};\n\n/** Local foundation and the 5-tuple: the same path in another checklist. */\nexport const pairKey = (pair: CandidatePair) =>\n [\n pair.localCandidate.foundation,\n pair.localCandidate.transport.toLowerCase(),\n pair.localCandidate.host,\n pair.localCandidate.port,\n pair.remoteCandidate.transport.toLowerCase(),\n pair.remoteCandidate.host,\n pair.remoteCandidate.port,\n ].join(\" \");\n"]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type CandidatePair } from "../iceBase";
|
|
2
|
+
import { type Address } from "../imports/common";
|
|
3
|
+
import type { Protocol } from "../types/model";
|
|
4
|
+
import type { NominationOutcome } from "./regularNomination";
|
|
5
|
+
/**
|
|
6
|
+
* Semi-aggressive nomination and renomination: delays before a failed pair
|
|
7
|
+
* that outranks the selection is checked again (`retryOutrankingPair`), one
|
|
8
|
+
* per retry. As libwebrtc keeps pinging a connection until it has heard
|
|
9
|
+
* nothing for 30 s, the retries end about 31 s after the failure.
|
|
10
|
+
*/
|
|
11
|
+
export declare const OUTRANKING_RETRY_DELAYS_MS: readonly [1000, 2000, 4000, 8000, 16000];
|
|
12
|
+
/** What the agent supplies to its `SelectionReplacement`. */
|
|
13
|
+
export type SelectionHost = {
|
|
14
|
+
/** The live checklist, highest priority first. */
|
|
15
|
+
checkList: () => readonly CandidatePair[];
|
|
16
|
+
/** The selected pair (`Connection.nominated`). */
|
|
17
|
+
selected: () => CandidatePair | undefined;
|
|
18
|
+
controlling: () => boolean;
|
|
19
|
+
closed: () => boolean;
|
|
20
|
+
remoteGeneration: () => number;
|
|
21
|
+
usesRenomination: () => boolean;
|
|
22
|
+
usesSemiAggressiveNomination: () => boolean;
|
|
23
|
+
/** The controlling agent may move the selection to a higher-priority pair. */
|
|
24
|
+
replacesSelection: () => boolean;
|
|
25
|
+
/** A pair semi-aggressive nomination and renomination may select (not ICE-TCP, checked locally). */
|
|
26
|
+
replacesWith: (pair: CandidatePair) => boolean;
|
|
27
|
+
outranks: (pair: CandidatePair, other: CandidatePair) => boolean;
|
|
28
|
+
bestValidPair: (pairs: CandidatePair[]) => CandidatePair | undefined;
|
|
29
|
+
isTcpPair: (pair: CandidatePair) => boolean;
|
|
30
|
+
/** Start the ordinary check of `pair` (its handle is kept on the pair). */
|
|
31
|
+
check: (pair: CandidatePair) => void;
|
|
32
|
+
/** Apply the outcome of `pair` (`Connection.checkComplete`). */
|
|
33
|
+
complete: (pair: CandidatePair) => void;
|
|
34
|
+
/** Send the nominating check (USE-CANDIDATE, or NOMINATION `value`); never rejects. */
|
|
35
|
+
sendNomination: (pair: CandidatePair, signal: AbortSignal, value?: number) => Promise<NominationOutcome>;
|
|
36
|
+
/** A nomination of `pair` sent in remote `generation` no longer applies. */
|
|
37
|
+
isStaleNomination: (pair: CandidatePair, generation: number) => boolean;
|
|
38
|
+
/** 487: the peer is controlling and wins; the agent becomes controlled. */
|
|
39
|
+
roleConflict: () => void;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Semi-aggressive nomination and renomination (as libwebrtc): how a selection
|
|
43
|
+
* is replaced after the first one.
|
|
44
|
+
*
|
|
45
|
+
* - Controlling: the pairs that outrank the selection go on being checked
|
|
46
|
+
* (`checkOutrankingPairs`), a failed one again after
|
|
47
|
+
* `OUTRANKING_RETRY_DELAYS_MS` (`scheduleRetries`), and the best valid pair
|
|
48
|
+
* is nominated with a separate check when no check of it did
|
|
49
|
+
* (`evaluate`; renomination sends increasing NOMINATION values).
|
|
50
|
+
* - Controlled: between equal nominations the pair the peer sends data on
|
|
51
|
+
* wins (`controlledDataReceived`, `replaces`).
|
|
52
|
+
*/
|
|
53
|
+
export declare class SelectionReplacement {
|
|
54
|
+
/**
|
|
55
|
+
* Semi-aggressive nomination or renomination: the separate check that
|
|
56
|
+
* nominates a valid pair which outranks the selection (see
|
|
57
|
+
* `evaluate`). One at a time.
|
|
58
|
+
*/
|
|
59
|
+
private inFlight?;
|
|
60
|
+
/** The last NOMINATION value sent (renomination); it only increases. */
|
|
61
|
+
private nominationValue;
|
|
62
|
+
/** `checkOutrankingPairs` is running. */
|
|
63
|
+
private outrankingChecks;
|
|
64
|
+
/**
|
|
65
|
+
* Controlled agent: when each live pair last received application data
|
|
66
|
+
* (an increasing sequence, larger is more recent). Between nominated pairs
|
|
67
|
+
* of equal nomination, the one the peer sends on wins (`replaces`).
|
|
68
|
+
*/
|
|
69
|
+
private readonly lastData;
|
|
70
|
+
private dataSequence;
|
|
71
|
+
/**
|
|
72
|
+
* Retries of failed pairs that outrank the selection
|
|
73
|
+
* (`scheduleRetries`): how many ran, and the pending timer.
|
|
74
|
+
*/
|
|
75
|
+
private readonly retries;
|
|
76
|
+
/**
|
|
77
|
+
* Semi-aggressive nomination and renomination (controlling): a pair that
|
|
78
|
+
* outranks the selection but failed (a check or nomination that went
|
|
79
|
+
* unanswered, e.g. while the path was briefly down) is checked again after
|
|
80
|
+
* `OUTRANKING_RETRY_DELAYS_MS`, as libwebrtc keeps pinging its
|
|
81
|
+
* connections. Without it the agents stay on the lower path when the
|
|
82
|
+
* peer does not trigger a check on that pair either (e.g. its own check
|
|
83
|
+
* failed too). Each pair waits for one retry at a time.
|
|
84
|
+
*/
|
|
85
|
+
scheduleRetries(): void;
|
|
86
|
+
/** `pair` failed, outranks `selected` and may replace it. */
|
|
87
|
+
private retriesOutranking;
|
|
88
|
+
/** A retry of `scheduleRetries` is due: check `pair` again. */
|
|
89
|
+
private retryOutrankingPair;
|
|
90
|
+
/** `pair` succeeded: its retries of `scheduleRetries` are over. */
|
|
91
|
+
forgetRetry(pair: CandidatePair): void;
|
|
92
|
+
/** Stop the retries of `scheduleRetries` (restart, close, role change). */
|
|
93
|
+
clearRetries(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the nominated `pair` replaces the selected pair:
|
|
96
|
+
* - controlled: the peer's larger nomination (the NOMINATION value;
|
|
97
|
+
* USE-CANDIDATE counts as 1, as in libwebrtc), the higher-priority pair
|
|
98
|
+
* between equal ones (RFC 5245 §8.1.1.2: the highest-priority nominated
|
|
99
|
+
* pair is used). A controlling peer nominating once (regular nomination)
|
|
100
|
+
* never causes a switch.
|
|
101
|
+
* - controlling with renomination: the pair renominated last.
|
|
102
|
+
* - controlling, semi-aggressive: a higher-priority pair.
|
|
103
|
+
* - controlling, regular nomination or toward ICE-lite: never.
|
|
104
|
+
*/
|
|
105
|
+
replaces(pair: CandidatePair): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Controlled agent: application data arrived on the live pair of
|
|
108
|
+
* `protocol` and `addr`. Record it (`lastData`) and, when the pair is
|
|
109
|
+
* nominated but not selected, let it replace the selection if the peer
|
|
110
|
+
* now sends on it (`replaces`). ICE-TCP pairs only record:
|
|
111
|
+
* selecting one prunes the other TCP connections.
|
|
112
|
+
*/
|
|
113
|
+
controlledDataReceived(protocol: Protocol, addr: Address): void;
|
|
114
|
+
/**
|
|
115
|
+
* Semi-aggressive nomination and renomination: nominate the best valid
|
|
116
|
+
* pair with a separate check when it outranks the selection (or nothing is
|
|
117
|
+
* selected yet) and no check of it nominated it already. With renomination
|
|
118
|
+
* ordinary checks never nominate; with semi-aggressive nomination a pair
|
|
119
|
+
* whose check went without USE-CANDIDATE (sent while controlled) still
|
|
120
|
+
* needs one. One such check at a time; its outcome re-evaluates.
|
|
121
|
+
*/
|
|
122
|
+
evaluate(): void;
|
|
123
|
+
private nominateSelection;
|
|
124
|
+
abort(): void;
|
|
125
|
+
/**
|
|
126
|
+
* After the first selection (semi-aggressive nomination, renomination):
|
|
127
|
+
* check the pairs that outrank the selected one, paced like the ordinary
|
|
128
|
+
* schedule. A pair added later that outranks it (a trickled candidate, a
|
|
129
|
+
* late relay allocation) restarts it (`addPair`).
|
|
130
|
+
*/
|
|
131
|
+
checkOutrankingPairs(): Promise<void>;
|
|
132
|
+
private readonly host;
|
|
133
|
+
constructor(host: SelectionHost);
|
|
134
|
+
/** A nominating check of `evaluate` is in flight. */
|
|
135
|
+
get nominating(): boolean;
|
|
136
|
+
/** The next NOMINATION value (renomination); it only increases. */
|
|
137
|
+
nextNominationValue(): number;
|
|
138
|
+
}
|