werift 0.19.0 → 0.19.2
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/common/src/binary.js +1 -1
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/promise.js.map +1 -1
- package/lib/dtls/src/cipher/const.js +2 -2
- package/lib/dtls/src/cipher/const.js.map +1 -1
- package/lib/dtls/src/cipher/create.js +10 -10
- package/lib/dtls/src/cipher/create.js.map +1 -1
- package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
- package/lib/dtls/src/cipher/prf.js +1 -1
- package/lib/dtls/src/cipher/prf.js.map +1 -1
- package/lib/dtls/src/cipher/suites/aead.d.ts +1 -1
- package/lib/dtls/src/cipher/suites/aead.js +5 -4
- package/lib/dtls/src/cipher/suites/aead.js.map +1 -1
- package/lib/dtls/src/client.js.map +1 -1
- package/lib/dtls/src/context/cipher.js +3 -3
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/srtp.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +8 -6
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.js +1 -1
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight2.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/binary.d.ts +5 -5
- package/lib/dtls/src/handshake/binary.js +1 -1
- package/lib/dtls/src/handshake/binary.js.map +1 -1
- package/lib/dtls/src/handshake/const.js +1 -1
- package/lib/dtls/src/handshake/const.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/ellipticCurves.d.ts +1 -1
- package/lib/dtls/src/handshake/extensions/ellipticCurves.js +2 -2
- package/lib/dtls/src/handshake/extensions/ellipticCurves.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/extendedMasterSecret.js +1 -1
- package/lib/dtls/src/handshake/extensions/extendedMasterSecret.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.d.ts +2 -2
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.js +2 -2
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -1
- package/lib/dtls/src/handshake/extensions/signature.js +2 -2
- package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +1 -1
- package/lib/dtls/src/handshake/extensions/useSrtp.js +2 -2
- package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.d.ts +2 -2
- package/lib/dtls/src/handshake/message/alert.js +2 -2
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.js +2 -2
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.d.ts +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.js +2 -2
- package/lib/dtls/src/handshake/message/changeCipherSpec.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +1 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.js +2 -2
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.d.ts +3 -3
- package/lib/dtls/src/handshake/message/client/hello.js +2 -2
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.js +2 -2
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.js +2 -2
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.d.ts +5 -5
- package/lib/dtls/src/handshake/message/server/hello.js +2 -2
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.js +2 -2
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.d.ts +2 -2
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js +2 -2
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +6 -6
- package/lib/dtls/src/handshake/message/server/keyExchange.js +2 -2
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +1 -1
- package/lib/dtls/src/handshake/random.js +3 -3
- package/lib/dtls/src/handshake/random.js.map +1 -1
- package/lib/dtls/src/helper.d.ts +1 -1
- package/lib/dtls/src/helper.js.map +1 -1
- package/lib/dtls/src/record/const.js +2 -2
- package/lib/dtls/src/record/const.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.d.ts +6 -6
- package/lib/dtls/src/record/message/fragment.js +4 -4
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.d.ts +12 -12
- package/lib/dtls/src/record/message/header.js +3 -3
- package/lib/dtls/src/record/message/header.js.map +1 -1
- package/lib/dtls/src/record/message/plaintext.d.ts +12 -12
- package/lib/dtls/src/record/message/plaintext.js +2 -2
- package/lib/dtls/src/record/message/plaintext.js.map +1 -1
- package/lib/dtls/src/record/receive.js.map +1 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.js +1 -1
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/dtls/src/transport.js.map +1 -1
- package/lib/dtls/src/util/binary.js +1 -1
- package/lib/dtls/src/util/binary.js.map +1 -1
- package/lib/ice/src/candidate.js +1 -1
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/dns/lookup.d.ts +7 -0
- package/lib/ice/src/dns/lookup.js +47 -1
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.d.ts +2 -2
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/helper.d.ts +1 -1
- package/lib/ice/src/helper.js.map +1 -1
- package/lib/ice/src/ice.d.ts +10 -18
- package/lib/ice/src/ice.js +62 -159
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/index.d.ts +2 -0
- package/lib/ice/src/index.js +4 -0
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/stun/attributes.d.ts +2 -2
- package/lib/ice/src/stun/attributes.js +1 -1
- package/lib/ice/src/stun/attributes.js.map +1 -1
- package/lib/ice/src/stun/const.d.ts +1 -1
- package/lib/ice/src/stun/const.js +2 -2
- package/lib/ice/src/stun/const.js.map +1 -1
- package/lib/ice/src/stun/message.d.ts +1 -1
- package/lib/ice/src/stun/message.js +2 -2
- package/lib/ice/src/stun/message.js.map +1 -1
- package/lib/ice/src/stun/protocol.d.ts +5 -5
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.d.ts +2 -2
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/transport.d.ts +3 -3
- package/lib/ice/src/transport.js +1 -1
- package/lib/ice/src/transport.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +32 -13
- package/lib/ice/src/turn/protocol.js +120 -36
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +2 -2
- package/lib/ice/src/types/model.js.map +1 -1
- package/lib/ice/src/utils.d.ts +3 -2
- package/lib/ice/src/utils.js +72 -1
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/rtp/src/codec/av1.js +1 -1
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/index.js.map +1 -1
- package/lib/rtp/src/codec/opus.js.map +1 -1
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/exp-golomb.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.js +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/sps-parser.js +4 -4
- package/lib/rtp/src/extra/container/mp4/sps-parser.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/parser.js.map +1 -1
- package/lib/rtp/src/extra/container/webm/container.js.map +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/ebml.js.map +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/typedArrayUtils.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizerTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
- package/lib/rtp/src/extra/processor/interface.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsyncCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/lipsyncCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4Callback.js +1 -1
- package/lib/rtp/src/extra/processor/mp4Callback.js.map +1 -1
- package/lib/rtp/src/extra/processor/mute.js.map +1 -1
- package/lib/rtp/src/extra/processor/muteCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
- 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/extra/processor/webmStream.js.map +1 -1
- package/lib/rtp/src/index.d.ts +1 -0
- package/lib/rtp/src/rtcp/header.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js +1 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/index.js +1 -1
- package/lib/rtp/src/rtcp/psfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/pictureLossIndication.js +1 -1
- package/lib/rtp/src/rtcp/psfb/pictureLossIndication.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/remb.js +1 -1
- package/lib/rtp/src/rtcp/psfb/remb.js.map +1 -1
- package/lib/rtp/src/rtcp/rr.js +1 -1
- package/lib/rtp/src/rtcp/rr.js.map +1 -1
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/index.js +1 -1
- package/lib/rtp/src/rtcp/rtpfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/nack.js +2 -2
- package/lib/rtp/src/rtcp/rtpfb/nack.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +3 -3
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/sdes.js +1 -1
- package/lib/rtp/src/rtcp/sdes.js.map +1 -1
- package/lib/rtp/src/rtcp/sr.js +1 -1
- package/lib/rtp/src/rtcp/sr.js.map +1 -1
- package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
- package/lib/rtp/src/rtp/red/encoder.js.map +1 -1
- package/lib/rtp/src/rtp/red/handler.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.js +0 -1
- package/lib/rtp/src/rtp/red/packet.js.map +1 -1
- package/lib/rtp/src/rtp/rtp.js +3 -2
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.js +1 -1
- package/lib/rtp/src/rtp/rtx.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.d.ts +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.js +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.d.ts +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js +1 -1
- package/lib/rtp/src/srtp/cipher/gcm.js.map +1 -1
- package/lib/rtp/src/srtp/const.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.js +1 -1
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
- package/lib/sctp/src/chunk.js +18 -18
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/const.js +2 -2
- package/lib/sctp/src/const.js.map +1 -1
- package/lib/sctp/src/param.js +6 -6
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.js +6 -2
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +1 -1
- package/lib/webrtc/src/dataChannel.js +1 -1
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/helper.js.map +1 -1
- package/lib/webrtc/src/media/parameters.d.ts +1 -2
- package/lib/webrtc/src/media/parameters.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/receiver/statistics.js.map +1 -1
- package/lib/webrtc/src/media/router.js +4 -2
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +1 -1
- package/lib/webrtc/src/media/rtpReceiver.js +1 -1
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.js +2 -2
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/cumulativeResult.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +3 -2
- package/lib/webrtc/src/peerConnection.js +14 -8
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/sdp.d.ts +1 -1
- package/lib/webrtc/src/sdp.js +47 -37
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.js +10 -8
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.js +1 -1
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +14 -22
- package/src/dataChannel.ts +1 -1
- package/src/media/parameters.ts +2 -2
- package/src/media/receiver/nack.ts +4 -7
- package/src/media/router.ts +36 -40
- package/src/media/rtpReceiver.ts +12 -15
- package/src/media/rtpSender.ts +70 -83
- package/src/nonstandard/recorder/writer/index.ts +1 -1
- package/src/nonstandard/recorder/writer/webm.ts +3 -3
- package/src/nonstandard/userMedia.ts +1 -3
- package/src/peerConnection.ts +32 -24
- package/src/sdp.ts +50 -56
- package/src/transport/dtls.ts +3 -6
- package/src/transport/ice.ts +1 -1
- package/src/transport/sctp.ts +61 -67
- package/src/utils.ts +1 -1
- package/src/typings/jspack.d.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../../ice/src/dns/lookup.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAY3C,MAAa,SAAS;IAIpB;QAHA;;;;;WAA6B;QAC7B;;;;mBAAQ,IAAI,GAAG,EAA2B;WAAC;QAGzC,MAAM,oBAAoB,GAAG,GAAG,EAAE;YAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YACvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAEzC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACjC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAU,EAAE,OAAe,EAAE,MAAc,EAAE,EAAE;gBAC3D,MAAM,GAAG,GAAoB;oBAC3B,GAAG,EAAE,GAAG,EAAE,OAAO;oBACjB,OAAO;oBACP,MAAM;oBACN,IAAI;iBACL,CAAC;gBACF,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;gBAC3C,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;YAEL,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,OAAyB,EAAE,EAAE;gBACpE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;gBACzB,SAAS,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,oBAAoB,KAAK,CAAC;QAEjD,IAAI,CAAC,MAAM,GAAG,IAAI,wBAAa,CAAC,MAAM,CA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AAM,CAAC,WAAW,CAAC;gBACtB,IAAI;aACe,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;CACF;AAzED,8BAyEC","sourcesContent":["import mdns from \"multicast-dns\";\nimport worker_thread from \"worker_threads\";\n\ninterface DnsLookupRequest {\n host: string;\n}\n\ninterface DnsLookupResult extends DnsLookupRequest {\n err?: string;\n address?: string;\n family?: number;\n}\n\nexport class MdnsLookup {\n cache = new Map<string, Promise<string>>();\n mdnsInstance = mdns();\n\n lookup(host: string): Promise<string> {\n return new Promise((r, f) => {\n const cleanup = () => {\n this.mdnsInstance.removeListener(\"response\", l);\n clearTimeout(timeout);\n };\n\n const timeout = setTimeout(() => {\n cleanup();\n f(new Error(\"No mDNS response\"));\n }, 10000);\n\n const l = (response: mdns.ResponsePacket) => {\n const a = response.answers?.[0];\n if (a?.type !== \"A\") {\n return;\n }\n if (a.name !== host) {\n return;\n }\n\n cleanup();\n r(a.data);\n };\n this.mdnsInstance.on(\"response\", l);\n\n this.mdnsInstance.query(host, \"A\");\n });\n }\n\n close() {\n this.mdnsInstance.destroy();\n }\n}\n\nexport class DnsLookup {\n thread: worker_thread.Worker;\n cache = new Map<string, Promise<string>>();\n\n constructor() {\n const lookupWorkerFunction = () => {\n const worker_thread = global.require(\"worker_threads\");\n const { lookup } = global.require(\"dns\");\n\n const dnsLookup = (host: string) =>\n lookup(host, (err: Error, address: string, family: number) => {\n const res: DnsLookupResult = {\n err: err?.message,\n address,\n family,\n host,\n };\n worker_thread.parentPort?.postMessage(res);\n process.exit();\n });\n\n worker_thread.parentPort?.on(\"message\", (message: DnsLookupRequest) => {\n const { host } = message;\n dnsLookup(host);\n });\n };\n\n const lookupEval = `(${lookupWorkerFunction})()`;\n\n this.thread = new worker_thread.Worker(lookupEval, {\n eval: true,\n });\n\n this.thread.setMaxListeners(100);\n }\n\n async lookup(host: string): Promise<string> {\n let cached = this.cache.get(host);\n if (cached) {\n return cached;\n }\n cached = new Promise((r, f) => {\n const exitListener = (exitCode: number) =>\n f(new Error(`dns.lookup thread exited unexpectedly: ${exitCode}`));\n\n const threadMessageListener = (result: DnsLookupResult) => {\n if (result.host !== host) {\n return;\n }\n\n this.thread.removeListener(\"message\", threadMessageListener);\n this.thread.removeListener(\"exit\", exitListener);\n\n if (!result.address)\n return f(new Error(result.err || \"dns.lookup thread unknown error\"));\n r(result.address);\n };\n\n this.thread.on(\"message\", threadMessageListener);\n this.thread.on(\"exit\", exitListener);\n\n this.thread.postMessage({\n host,\n } as DnsLookupRequest);\n });\n\n this.cache.set(host, cached);\n return cached;\n }\n\n close() {\n return this.thread.terminate();\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from "./stun/message";
|
|
2
|
-
import { Address } from "./types/model";
|
|
1
|
+
import type { Message } from "./stun/message";
|
|
2
|
+
import type { Address } from "./types/model";
|
|
3
3
|
export declare class TransactionError extends Error {
|
|
4
4
|
response?: Message;
|
|
5
5
|
addr?: Address;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../../ice/src/exceptions.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAiB,SAAQ,KAAK;IAA3C;;QACE;;;;;WAAmB;QACnB;;;;;WAAe;IACjB,CAAC;CAAA;AAHD,4CAGC;AAED,MAAa,iBAAkB,SAAQ,gBAAgB;IACrD,
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../../ice/src/exceptions.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAiB,SAAQ,KAAK;IAA3C;;QACE;;;;;WAAmB;QACnB;;;;;WAAe;IACjB,CAAC;CAAA;AAHD,4CAGC;AAED,MAAa,iBAAkB,SAAQ,gBAAgB;IACrD,YAAmB,QAAiB,EAAS,IAAa;QACxD,KAAK,EAAE,CAAC;QADE;;;;mBAAO,QAAQ;WAAS;QAAE;;;;mBAAO,IAAI;WAAS;IAE1D,CAAC;IAED,IAAI,GAAG;QACL,IAAI,GAAG,GAAG,yBAAyB,CAAC;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAChE,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;YAC9B,GAAG,IAAI,KAAK,IAAI,MAAM,GAAG,GAAG,CAAC;QAC/B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAdD,8CAcC;AAED,MAAa,kBAAmB,SAAQ,gBAAgB;IACtD,IAAI,GAAG;QACL,OAAO,4BAA4B,CAAC;IACtC,CAAC;CACF;AAJD,gDAIC","sourcesContent":["import type { Message } from \"./stun/message\";\nimport type { Address } from \"./types/model\";\n\nexport class TransactionError extends Error {\n response?: Message;\n addr?: Address;\n}\n\nexport class TransactionFailed extends TransactionError {\n constructor(public response: Message, public addr: Address) {\n super();\n }\n\n get str() {\n let out = \"STUN transaction failed\";\n const attribute = this.response.getAttributeValue(\"ERROR-CODE\");\n if (attribute) {\n const [code, msg] = attribute;\n out += ` (${code} - ${msg})`;\n }\n return out;\n }\n}\n\nexport class TransactionTimeout extends TransactionError {\n get str() {\n return \"STUN transaction timed out\";\n }\n}\n"]}
|
package/lib/ice/src/helper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import PCancelable from "p-cancelable";
|
|
2
|
+
import type PCancelable from "p-cancelable";
|
|
3
3
|
export declare function randomString(length: number): string;
|
|
4
4
|
export declare function randomTransactionId(): Buffer;
|
|
5
5
|
export declare function bufferXor(a: Buffer, b: Buffer): Buffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../ice/src/helper.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAqC;AACrC,kDAA0B;AAE1B,qCAAgC;AAEhC,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,uCAAuC,CAAC,CAAC;AAE3D,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAClE,CAAC;AAFD,oCAEC;AAED,SAAgB,mBAAmB;IACjC,OAAO,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAFD,kDAEC;AAED,SAAgB,SAAS,CAAC,CAAS,EAAE,CAAS;IAC5C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../ice/src/helper.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAqC;AACrC,kDAA0B;AAE1B,qCAAgC;AAEhC,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,uCAAuC,CAAC,CAAC;AAE3D,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAClE,CAAC;AAFD,oCAEC;AAED,SAAgB,mBAAmB;IACjC,OAAO,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAFD,kDAEC;AAED,SAAgB,SAAS,CAAC,CAAS,EAAE,CAAS;IAC5C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CACjB,kEAAkE,CACnE,CAAC;IACJ,CA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AAC;oBACnB,CAAC,CAAC,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAE,CAAC;IACZ,CAAC;CACF;AAvBD,wBAuBC;AAEM,MAAM,MAAM,GAAG,CAAC,OAAyB,EAAE,EAAE;IAClD,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAE9B,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAEtC,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,GAAG,EAAE;QACT,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5C,CAAC,CAAC;AAlBW,QAAA,MAAM,UAkBjB","sourcesContent":["import { randomBytes } from \"crypto\";\nimport debug from \"debug\";\nimport type PCancelable from \"p-cancelable\";\nimport { Event } from \"rx.mini\";\n\nconst log = debug(\"werift-ice:packages/ice/src/helper.ts\");\n\nexport function randomString(length: number) {\n return randomBytes(length).toString(\"hex\").substring(0, length);\n}\n\nexport function randomTransactionId() {\n return randomBytes(12);\n}\n\nexport function bufferXor(a: Buffer, b: Buffer): Buffer {\n if (a.length !== b.length) {\n throw new TypeError(\n \"[webrtc-stun] You can not XOR buffers which length are different\",\n );\n }\n\n const length = a.length;\n const buffer = Buffer.allocUnsafe(length);\n\n for (let i = 0; i < length; i++) {\n buffer[i] = a[i] ^ b[i];\n }\n\n return buffer;\n}\n\nexport function difference<T>(x: Set<T>, y: Set<T>) {\n return new Set([...x].filter((e) => !y.has(e)));\n}\n\n// infinite size queue\nexport class PQueue<T> {\n private queue: Promise<T>[] = [];\n private wait = new Event<[Promise<T>]>();\n\n put(v: Promise<T>) {\n this.queue.push(v);\n if (this.queue.length === 1) {\n this.wait.execute(v);\n }\n }\n\n get(): Promise<T> {\n const v = this.queue.shift();\n if (!v) {\n return new Promise((r) => {\n this.wait.subscribe((v) => {\n this.queue.shift();\n r(v);\n });\n });\n }\n return v!;\n }\n}\n\nexport const future = (pCancel: PCancelable<any>) => {\n const state = { done: false };\n\n const cancel = () => pCancel.cancel();\n\n const done = () => state.done;\n\n pCancel\n .then(() => {\n state.done = true;\n })\n .catch((error) => {\n if (error !== \"cancel\") {\n log(\"future\", error);\n }\n });\n\n return { cancel, promise: pCancel, done };\n};\n\nexport type Future = ReturnType<typeof future>;\n"]}
|
package/lib/ice/src/ice.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import PCancelable from "p-cancelable";
|
|
3
3
|
import { Event } from "rx.mini";
|
|
4
|
-
import { InterfaceAddresses } from "../../common/src/network";
|
|
4
|
+
import type { InterfaceAddresses } from "../../common/src/network";
|
|
5
5
|
import { Candidate } from "./candidate";
|
|
6
|
-
import {
|
|
7
|
-
import { Future } from "./helper";
|
|
6
|
+
import { MdnsLookup } from "./dns/lookup";
|
|
7
|
+
import { type Future } from "./helper";
|
|
8
8
|
import { Message } from "./stun/message";
|
|
9
|
-
import { Address, Protocol } from "./types/model";
|
|
9
|
+
import type { Address, Protocol } from "./types/model";
|
|
10
10
|
export declare class Connection {
|
|
11
11
|
iceControlling: boolean;
|
|
12
12
|
localUserName: string;
|
|
@@ -22,20 +22,15 @@ export declare class Connection {
|
|
|
22
22
|
useIpv6: boolean;
|
|
23
23
|
options: IceOptions;
|
|
24
24
|
remoteCandidatesEnd: boolean;
|
|
25
|
-
/**コンポーネントはデータストリームの一部です. データストリームには複数のコンポーネントが必要な場合があり、
|
|
26
|
-
* データストリーム全体が機能するには、それぞれが機能する必要があります.
|
|
27
|
-
* RTP / RTCPデータストリームの場合、RTPとRTCPが同じポートで多重化されていない限り、データストリームごとに2つのコンポーネントがあります.
|
|
28
|
-
* 1つはRTP用、もう1つはRTCP用です. コンポーネントには候補ペアがあり、他のコンポーネントでは使用できません. */
|
|
29
|
-
_components: Set<number>;
|
|
30
25
|
_localCandidatesEnd: boolean;
|
|
31
|
-
_tieBreaker:
|
|
26
|
+
_tieBreaker: bigint;
|
|
32
27
|
state: IceState;
|
|
33
|
-
|
|
28
|
+
lookup?: MdnsLookup;
|
|
29
|
+
restarted: boolean;
|
|
34
30
|
readonly onData: Event<[Buffer, number]>;
|
|
35
31
|
readonly stateChanged: Event<[IceState]>;
|
|
36
32
|
private _remoteCandidates;
|
|
37
|
-
private nominated
|
|
38
|
-
get nominatedKeys(): string[];
|
|
33
|
+
private nominated?;
|
|
39
34
|
private nominating;
|
|
40
35
|
private checkListDone;
|
|
41
36
|
private checkListState;
|
|
@@ -51,7 +46,7 @@ export declare class Connection {
|
|
|
51
46
|
password: string;
|
|
52
47
|
}): void;
|
|
53
48
|
gatherCandidates(cb?: (candidate: Candidate) => void): Promise<void>;
|
|
54
|
-
private
|
|
49
|
+
private getCandidates;
|
|
55
50
|
connect(): Promise<void>;
|
|
56
51
|
private unfreezeInitial;
|
|
57
52
|
private schedulingChecks;
|
|
@@ -61,12 +56,11 @@ export declare class Connection {
|
|
|
61
56
|
addRemoteCandidate(remoteCandidate: Candidate | undefined): Promise<void>;
|
|
62
57
|
send: (data: Buffer) => Promise<void>;
|
|
63
58
|
private sendTo;
|
|
64
|
-
getDefaultCandidate(
|
|
59
|
+
getDefaultCandidate(): Candidate;
|
|
65
60
|
requestReceived(message: Message, addr: Address, protocol: Protocol, rawData: Buffer): void;
|
|
66
61
|
dataReceived(data: Buffer, component: number): void;
|
|
67
62
|
set remoteCandidates(value: Candidate[]);
|
|
68
63
|
get remoteCandidates(): Candidate[];
|
|
69
|
-
private pruneComponents;
|
|
70
64
|
private sortCheckList;
|
|
71
65
|
private findPair;
|
|
72
66
|
private setPairState;
|
|
@@ -106,7 +100,6 @@ export declare enum CandidatePairState {
|
|
|
106
100
|
}
|
|
107
101
|
type IceState = "disconnected" | "closed" | "completed" | "new" | "connected";
|
|
108
102
|
export interface IceOptions {
|
|
109
|
-
components: number;
|
|
110
103
|
stunServer?: Address;
|
|
111
104
|
turnServer?: Address;
|
|
112
105
|
turnUsername?: string;
|
|
@@ -125,7 +118,6 @@ export interface IceOptions {
|
|
|
125
118
|
export declare function validateRemoteCandidate(candidate: Candidate): Candidate;
|
|
126
119
|
export declare function sortCandidatePairs(pairs: CandidatePair[], iceControlling: boolean): void;
|
|
127
120
|
export declare function candidatePairPriority(local: Candidate, remote: Candidate, iceControlling: boolean): number;
|
|
128
|
-
export declare function getHostAddresses(useIpv4: boolean, useIpv6: boolean): string[];
|
|
129
121
|
export declare function serverReflexiveCandidate(protocol: Protocol, stunServer: Address): Promise<Candidate | undefined>;
|
|
130
122
|
export declare function validateAddress(addr?: Address): Address | undefined;
|
|
131
123
|
export {};
|
package/lib/ice/src/ice.js
CHANGED
|
@@ -1,40 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.validateAddress = exports.serverReflexiveCandidate = exports.
|
|
6
|
+
exports.validateAddress = exports.serverReflexiveCandidate = exports.candidatePairPriority = exports.sortCandidatePairs = exports.validateRemoteCandidate = exports.CandidatePairState = exports.CandidatePair = exports.Connection = void 0;
|
|
30
7
|
const crypto_1 = require("crypto");
|
|
8
|
+
const net_1 = require("net");
|
|
31
9
|
const debug_1 = __importDefault(require("debug"));
|
|
32
10
|
const int64_buffer_1 = require("int64-buffer");
|
|
33
|
-
const nodeIp = __importStar(require("ip"));
|
|
34
11
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
35
|
-
const range_1 = __importDefault(require("lodash/range"));
|
|
36
|
-
const net_1 = require("net");
|
|
37
|
-
const os_1 = __importDefault(require("os"));
|
|
38
12
|
const p_cancelable_1 = __importDefault(require("p-cancelable"));
|
|
39
13
|
const rx_mini_1 = require("rx.mini");
|
|
40
14
|
const promises_1 = __importDefault(require("timers/promises"));
|
|
@@ -48,9 +22,6 @@ const protocol_2 = require("./turn/protocol");
|
|
|
48
22
|
const utils_1 = require("./utils");
|
|
49
23
|
const log = (0, debug_1.default)("werift-ice : packages/ice/src/ice.ts : log");
|
|
50
24
|
class Connection {
|
|
51
|
-
get nominatedKeys() {
|
|
52
|
-
return Object.keys(this.nominated).map((v) => v.toString());
|
|
53
|
-
}
|
|
54
25
|
constructor(iceControlling, options) {
|
|
55
26
|
Object.defineProperty(this, "iceControlling", {
|
|
56
27
|
enumerable: true,
|
|
@@ -136,16 +107,6 @@ class Connection {
|
|
|
136
107
|
writable: true,
|
|
137
108
|
value: false
|
|
138
109
|
});
|
|
139
|
-
/**コンポーネントはデータストリームの一部です. データストリームには複数のコンポーネントが必要な場合があり、
|
|
140
|
-
* データストリーム全体が機能するには、それぞれが機能する必要があります.
|
|
141
|
-
* RTP / RTCPデータストリームの場合、RTPとRTCPが同じポートで多重化されていない限り、データストリームごとに2つのコンポーネントがあります.
|
|
142
|
-
* 1つはRTP用、もう1つはRTCP用です. コンポーネントには候補ペアがあり、他のコンポーネントでは使用できません. */
|
|
143
|
-
Object.defineProperty(this, "_components", {
|
|
144
|
-
enumerable: true,
|
|
145
|
-
configurable: true,
|
|
146
|
-
writable: true,
|
|
147
|
-
value: void 0
|
|
148
|
-
});
|
|
149
110
|
Object.defineProperty(this, "_localCandidatesEnd", {
|
|
150
111
|
enumerable: true,
|
|
151
112
|
configurable: true,
|
|
@@ -164,12 +125,18 @@ class Connection {
|
|
|
164
125
|
writable: true,
|
|
165
126
|
value: "new"
|
|
166
127
|
});
|
|
167
|
-
Object.defineProperty(this, "
|
|
128
|
+
Object.defineProperty(this, "lookup", {
|
|
168
129
|
enumerable: true,
|
|
169
130
|
configurable: true,
|
|
170
131
|
writable: true,
|
|
171
132
|
value: void 0
|
|
172
133
|
});
|
|
134
|
+
Object.defineProperty(this, "restarted", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
configurable: true,
|
|
137
|
+
writable: true,
|
|
138
|
+
value: false
|
|
139
|
+
});
|
|
173
140
|
Object.defineProperty(this, "onData", {
|
|
174
141
|
enumerable: true,
|
|
175
142
|
configurable: true,
|
|
@@ -193,13 +160,13 @@ class Connection {
|
|
|
193
160
|
enumerable: true,
|
|
194
161
|
configurable: true,
|
|
195
162
|
writable: true,
|
|
196
|
-
value:
|
|
163
|
+
value: void 0
|
|
197
164
|
});
|
|
198
165
|
Object.defineProperty(this, "nominating", {
|
|
199
166
|
enumerable: true,
|
|
200
167
|
configurable: true,
|
|
201
168
|
writable: true,
|
|
202
|
-
value:
|
|
169
|
+
value: false
|
|
203
170
|
});
|
|
204
171
|
Object.defineProperty(this, "checkListDone", {
|
|
205
172
|
enumerable: true,
|
|
@@ -263,29 +230,30 @@ class Connection {
|
|
|
263
230
|
while (!this.remoteIsLite && this.state !== "closed") {
|
|
264
231
|
// # randomize between 0.8 and 1.2 times CONSENT_INTERVAL
|
|
265
232
|
await promises_1.default.setTimeout(CONSENT_INTERVAL * (0.8 + 0.4 * Math.random()) * 1000, undefined, { signal: cancelEvent.signal });
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
catch (error) {
|
|
277
|
-
log("no stun response");
|
|
278
|
-
failures++;
|
|
279
|
-
this.setState("disconnected");
|
|
280
|
-
}
|
|
281
|
-
if (failures >= CONSENT_FAILURES) {
|
|
282
|
-
log("Consent to send expired");
|
|
283
|
-
this.queryConsentHandle = undefined;
|
|
284
|
-
// 切断検知
|
|
285
|
-
r(await this.close());
|
|
286
|
-
return;
|
|
233
|
+
const pair = this.nominated;
|
|
234
|
+
if (!pair) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
const request = this.buildRequest(pair, false);
|
|
238
|
+
try {
|
|
239
|
+
const [msg, addr] = await pair.protocol.request(request, pair.remoteAddr, Buffer.from(this.remotePassword, "utf8"), 0);
|
|
240
|
+
failures = 0;
|
|
241
|
+
if (this.state === "disconnected") {
|
|
242
|
+
this.setState("connected");
|
|
287
243
|
}
|
|
288
244
|
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
log("no stun response");
|
|
247
|
+
failures++;
|
|
248
|
+
this.setState("disconnected");
|
|
249
|
+
}
|
|
250
|
+
if (failures >= CONSENT_FAILURES) {
|
|
251
|
+
log("Consent to send expired");
|
|
252
|
+
this.queryConsentHandle = undefined;
|
|
253
|
+
// 切断検知
|
|
254
|
+
r(await this.close());
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
289
257
|
}
|
|
290
258
|
}
|
|
291
259
|
catch (error) { }
|
|
@@ -301,7 +269,7 @@ class Connection {
|
|
|
301
269
|
// If the connection is not established, a `ConnectionError` is raised.
|
|
302
270
|
// :param data: The data to be sent.
|
|
303
271
|
// """
|
|
304
|
-
await this.sendTo(data
|
|
272
|
+
await this.sendTo(data);
|
|
305
273
|
}
|
|
306
274
|
});
|
|
307
275
|
// 3. Terminology : Check
|
|
@@ -361,9 +329,9 @@ class Connection {
|
|
|
361
329
|
// # nominated by agressive nomination or the remote party
|
|
362
330
|
pair.nominated = true;
|
|
363
331
|
}
|
|
364
|
-
else if (this.iceControlling && !this.nominating
|
|
332
|
+
else if (this.iceControlling && !this.nominating) {
|
|
365
333
|
// # perform regular nomination
|
|
366
|
-
this.nominating
|
|
334
|
+
this.nominating = true;
|
|
367
335
|
const request = this.buildRequest(pair, true);
|
|
368
336
|
try {
|
|
369
337
|
await pair.protocol.request(request, pair.remoteAddr, Buffer.from(this.remotePassword, "utf8"));
|
|
@@ -403,12 +371,11 @@ class Connection {
|
|
|
403
371
|
...defaultOptions,
|
|
404
372
|
...options,
|
|
405
373
|
};
|
|
406
|
-
const {
|
|
374
|
+
const { stunServer, turnServer, useIpv4, useIpv6 } = this.options;
|
|
407
375
|
this.stunServer = validateAddress(stunServer);
|
|
408
376
|
this.turnServer = validateAddress(turnServer);
|
|
409
377
|
this.useIpv4 = useIpv4;
|
|
410
378
|
this.useIpv6 = useIpv6;
|
|
411
|
-
this._components = new Set((0, range_1.default)(1, components + 1));
|
|
412
379
|
}
|
|
413
380
|
setRemoteParams({ iceLite, usernameFragment, password, }) {
|
|
414
381
|
log("setRemoteParams", { iceLite, usernameFragment, password });
|
|
@@ -421,7 +388,7 @@ class Connection {
|
|
|
421
388
|
if (!this.localCandidatesStart) {
|
|
422
389
|
this.localCandidatesStart = true;
|
|
423
390
|
this.promiseGatherCandidates = new rx_mini_1.Event();
|
|
424
|
-
let address = getHostAddresses(this.useIpv4, this.useIpv6);
|
|
391
|
+
let address = (0, utils_1.getHostAddresses)(this.useIpv4, this.useIpv6);
|
|
425
392
|
const { interfaceAddresses } = this.options;
|
|
426
393
|
if (interfaceAddresses) {
|
|
427
394
|
const filteredAddresses = address.filter((check) => Object.values(interfaceAddresses).includes(check));
|
|
@@ -432,16 +399,14 @@ class Connection {
|
|
|
432
399
|
if (this.options.additionalHostAddresses) {
|
|
433
400
|
address = Array.from(new Set([...this.options.additionalHostAddresses, ...address]));
|
|
434
401
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
this.localCandidates = [...this.localCandidates, ...candidates];
|
|
438
|
-
}
|
|
402
|
+
const candidates = await this.getCandidates(address, 5, cb);
|
|
403
|
+
this.localCandidates = [...this.localCandidates, ...candidates];
|
|
439
404
|
this._localCandidatesEnd = true;
|
|
440
405
|
this.promiseGatherCandidates.execute();
|
|
441
406
|
}
|
|
442
407
|
this.setState("completed");
|
|
443
408
|
}
|
|
444
|
-
async
|
|
409
|
+
async getCandidates(addresses, timeout = 5, cb) {
|
|
445
410
|
let candidates = [];
|
|
446
411
|
await Promise.allSettled(addresses.map(async (address) => {
|
|
447
412
|
// # create transport
|
|
@@ -457,7 +422,7 @@ class Connection {
|
|
|
457
422
|
this.protocols.push(protocol);
|
|
458
423
|
// # add host candidate
|
|
459
424
|
const candidateAddress = [address, protocol.getExtraInfo()[1]];
|
|
460
|
-
protocol.localCandidate = new candidate_1.Candidate((0, candidate_1.candidateFoundation)("host", "udp", candidateAddress[0]),
|
|
425
|
+
protocol.localCandidate = new candidate_1.Candidate((0, candidate_1.candidateFoundation)("host", "udp", candidateAddress[0]), 1, "udp", (0, candidate_1.candidatePriority)(1, "host"), candidateAddress[0], candidateAddress[1], "host");
|
|
461
426
|
candidates.push(protocol.localCandidate);
|
|
462
427
|
if (cb) {
|
|
463
428
|
cb(protocol.localCandidate);
|
|
@@ -497,7 +462,7 @@ class Connection {
|
|
|
497
462
|
const candidateAddress = protocol.turn.relayedAddress;
|
|
498
463
|
const relatedAddress = protocol.turn.mappedAddress;
|
|
499
464
|
log("turn candidateAddress", candidateAddress);
|
|
500
|
-
protocol.localCandidate = new candidate_1.Candidate((0, candidate_1.candidateFoundation)("relay", "udp", candidateAddress[0]),
|
|
465
|
+
protocol.localCandidate = new candidate_1.Candidate((0, candidate_1.candidateFoundation)("relay", "udp", candidateAddress[0]), 1, "udp", (0, candidate_1.candidatePriority)(1, "relay"), candidateAddress[0], candidateAddress[1], "relay", relatedAddress[0], relatedAddress[1]);
|
|
501
466
|
if (cb) {
|
|
502
467
|
cb(protocol.localCandidate);
|
|
503
468
|
}
|
|
@@ -568,7 +533,7 @@ class Connection {
|
|
|
568
533
|
}
|
|
569
534
|
unfreezeInitial() {
|
|
570
535
|
// # unfreeze first pair for the first component
|
|
571
|
-
const firstPair = this.checkList
|
|
536
|
+
const [firstPair] = this.checkList;
|
|
572
537
|
if (!firstPair)
|
|
573
538
|
return;
|
|
574
539
|
if (firstPair.state === CandidatePairState.FROZEN) {
|
|
@@ -637,7 +602,7 @@ class Connection {
|
|
|
637
602
|
r(ICE_FAILED);
|
|
638
603
|
}));
|
|
639
604
|
}
|
|
640
|
-
this.nominated =
|
|
605
|
+
this.nominated = undefined;
|
|
641
606
|
for (const protocol of this.protocols) {
|
|
642
607
|
if (protocol.close) {
|
|
643
608
|
await protocol.close();
|
|
@@ -645,7 +610,7 @@ class Connection {
|
|
|
645
610
|
}
|
|
646
611
|
this.protocols = [];
|
|
647
612
|
this.localCandidates = [];
|
|
648
|
-
await this.
|
|
613
|
+
await this.lookup?.close();
|
|
649
614
|
}
|
|
650
615
|
setState(state) {
|
|
651
616
|
this.state = state;
|
|
@@ -658,7 +623,6 @@ class Connection {
|
|
|
658
623
|
// :param remote_candidate: A :class:`Candidate` instance or `None`.
|
|
659
624
|
// """
|
|
660
625
|
if (!remoteCandidate) {
|
|
661
|
-
this.pruneComponents();
|
|
662
626
|
this.remoteCandidatesEnd = true;
|
|
663
627
|
return;
|
|
664
628
|
}
|
|
@@ -666,10 +630,10 @@ class Connection {
|
|
|
666
630
|
try {
|
|
667
631
|
if (this.state === "closed")
|
|
668
632
|
return;
|
|
669
|
-
if (!this.
|
|
670
|
-
this.
|
|
633
|
+
if (!this.lookup) {
|
|
634
|
+
this.lookup = new lookup_1.MdnsLookup();
|
|
671
635
|
}
|
|
672
|
-
const host = await this.
|
|
636
|
+
const host = await this.lookup.lookup(remoteCandidate.host);
|
|
673
637
|
remoteCandidate.host = host;
|
|
674
638
|
}
|
|
675
639
|
catch (error) {
|
|
@@ -687,14 +651,14 @@ class Connection {
|
|
|
687
651
|
this.pairRemoteCandidate(remoteCandidate);
|
|
688
652
|
this.sortCheckList();
|
|
689
653
|
}
|
|
690
|
-
async sendTo(data
|
|
654
|
+
async sendTo(data) {
|
|
691
655
|
// """
|
|
692
656
|
// Send a datagram on the specified component.
|
|
693
657
|
// If the connection is not established, a `ConnectionError` is raised.
|
|
694
658
|
// :param data: The data to be sent.
|
|
695
659
|
// :param component: The component on which to send the data.
|
|
696
660
|
// """
|
|
697
|
-
const activePair = this.nominated
|
|
661
|
+
const activePair = this.nominated;
|
|
698
662
|
if (activePair) {
|
|
699
663
|
await activePair.protocol.sendData(data, activePair.remoteAddr);
|
|
700
664
|
}
|
|
@@ -703,9 +667,9 @@ class Connection {
|
|
|
703
667
|
return;
|
|
704
668
|
}
|
|
705
669
|
}
|
|
706
|
-
getDefaultCandidate(
|
|
670
|
+
getDefaultCandidate() {
|
|
707
671
|
const candidates = this.localCandidates.sort((a, b) => a.priority - b.priority);
|
|
708
|
-
const candidate = candidates
|
|
672
|
+
const [candidate] = candidates;
|
|
709
673
|
return candidate;
|
|
710
674
|
}
|
|
711
675
|
requestReceived(message, addr, protocol, rawData) {
|
|
@@ -790,19 +754,11 @@ class Connection {
|
|
|
790
754
|
}
|
|
791
755
|
this.remoteCandidates.push(remoteCandidate);
|
|
792
756
|
}
|
|
793
|
-
this.pruneComponents();
|
|
794
757
|
this.remoteCandidatesEnd = true;
|
|
795
758
|
}
|
|
796
759
|
get remoteCandidates() {
|
|
797
760
|
return this._remoteCandidates;
|
|
798
761
|
}
|
|
799
|
-
pruneComponents() {
|
|
800
|
-
const seenComponents = new Set(this.remoteCandidates.map((v) => v.component));
|
|
801
|
-
const missingComponents = [...(0, helper_1.difference)(this._components, seenComponents)];
|
|
802
|
-
if (missingComponents.length > 0) {
|
|
803
|
-
this._components = seenComponents;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
762
|
sortCheckList() {
|
|
807
763
|
sortCandidatePairs(this.checkList, this.iceControlling);
|
|
808
764
|
}
|
|
@@ -822,8 +778,8 @@ class Connection {
|
|
|
822
778
|
}
|
|
823
779
|
resetNominatedPair() {
|
|
824
780
|
log("resetNominatedPair");
|
|
825
|
-
this.nominated =
|
|
826
|
-
this.nominating
|
|
781
|
+
this.nominated = undefined;
|
|
782
|
+
this.nominating = false;
|
|
827
783
|
}
|
|
828
784
|
checkComplete(pair) {
|
|
829
785
|
pair.handle = undefined;
|
|
@@ -833,10 +789,10 @@ class Connection {
|
|
|
833
789
|
// Once the nominated flag is set for a component of a data stream, it
|
|
834
790
|
// concludes the ICE processing for that component. See Section 8.
|
|
835
791
|
// So disallow overwriting of the pair nominated for that component
|
|
836
|
-
if (pair.nominated && this.nominated
|
|
792
|
+
if (pair.nominated && this.nominated == undefined) {
|
|
837
793
|
log("nominated", pair.toJSON());
|
|
838
|
-
this.nominated
|
|
839
|
-
this.nominating
|
|
794
|
+
this.nominated = pair;
|
|
795
|
+
this.nominating = false;
|
|
840
796
|
// 8.1.2. Updating States
|
|
841
797
|
// The agent MUST remove all Waiting and Frozen pairs in the check
|
|
842
798
|
// list and triggered check queue for the same component as the
|
|
@@ -851,7 +807,7 @@ class Connection {
|
|
|
851
807
|
// Once there is at least one nominated pair in the valid list for
|
|
852
808
|
// every component of at least one media stream and the state of the
|
|
853
809
|
// check list is Running:
|
|
854
|
-
if (this.
|
|
810
|
+
if (this.nominated) {
|
|
855
811
|
if (!this.checkListDone) {
|
|
856
812
|
log("ICE completed");
|
|
857
813
|
this.checkListState.put(new Promise((r) => r(ICE_COMPLETED)));
|
|
@@ -893,25 +849,18 @@ class Connection {
|
|
|
893
849
|
// """
|
|
894
850
|
// Handle a successful incoming check.
|
|
895
851
|
// """
|
|
896
|
-
const component = protocol.localCandidate?.component;
|
|
897
|
-
if (component == undefined) {
|
|
898
|
-
throw new Error("component not exist");
|
|
899
|
-
}
|
|
900
852
|
// find remote candidate
|
|
901
853
|
let remoteCandidate;
|
|
902
854
|
const [host, port] = addr;
|
|
903
855
|
for (const c of this.remoteCandidates) {
|
|
904
856
|
if (c.host === host && c.port === port) {
|
|
905
857
|
remoteCandidate = c;
|
|
906
|
-
if (remoteCandidate.component !== component) {
|
|
907
|
-
throw new Error("checkIncoming");
|
|
908
|
-
}
|
|
909
858
|
break;
|
|
910
859
|
}
|
|
911
860
|
}
|
|
912
861
|
if (!remoteCandidate) {
|
|
913
862
|
// 7.2.1.3. Learning Peer Reflexive Candidates
|
|
914
|
-
remoteCandidate = new candidate_1.Candidate((0, helper_1.randomString)(10),
|
|
863
|
+
remoteCandidate = new candidate_1.Candidate((0, helper_1.randomString)(10), 1, "udp", message.getAttributeValue("PRIORITY"), host, port, "prflx");
|
|
915
864
|
this.remoteCandidates.push(remoteCandidate);
|
|
916
865
|
}
|
|
917
866
|
// find pair
|
|
@@ -1044,9 +993,8 @@ var CandidatePairState;
|
|
|
1044
993
|
CandidatePairState[CandidatePairState["IN_PROGRESS"] = 2] = "IN_PROGRESS";
|
|
1045
994
|
CandidatePairState[CandidatePairState["SUCCEEDED"] = 3] = "SUCCEEDED";
|
|
1046
995
|
CandidatePairState[CandidatePairState["FAILED"] = 4] = "FAILED";
|
|
1047
|
-
})(CandidatePairState
|
|
996
|
+
})(CandidatePairState || (exports.CandidatePairState = CandidatePairState = {}));
|
|
1048
997
|
const defaultOptions = {
|
|
1049
|
-
components: 1,
|
|
1050
998
|
useIpv4: true,
|
|
1051
999
|
useIpv6: true,
|
|
1052
1000
|
};
|
|
@@ -1072,51 +1020,6 @@ function candidatePairPriority(local, remote, iceControlling) {
|
|
|
1072
1020
|
return (1 << 32) * Math.min(G, D) + 2 * Math.max(G, D) + (G > D ? 1 : 0);
|
|
1073
1021
|
}
|
|
1074
1022
|
exports.candidatePairPriority = candidatePairPriority;
|
|
1075
|
-
function isAutoconfigurationAddress(info) {
|
|
1076
|
-
return ((0, utils_1.normalizeFamilyNodeV18)(info.family) === 4 &&
|
|
1077
|
-
info.address?.startsWith("169.254."));
|
|
1078
|
-
}
|
|
1079
|
-
function nodeIpAddress(family) {
|
|
1080
|
-
// https://chromium.googlesource.com/external/webrtc/+/master/rtc_base/network.cc#236
|
|
1081
|
-
const costlyNetworks = ["ipsec", "tun", "utun", "tap"];
|
|
1082
|
-
const banNetworks = ["vmnet", "veth"];
|
|
1083
|
-
const interfaces = os_1.default.networkInterfaces();
|
|
1084
|
-
const all = Object.keys(interfaces)
|
|
1085
|
-
.map((nic) => {
|
|
1086
|
-
for (const word of [...costlyNetworks, ...banNetworks]) {
|
|
1087
|
-
if (nic.startsWith(word)) {
|
|
1088
|
-
return {
|
|
1089
|
-
nic,
|
|
1090
|
-
addresses: [],
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
const addresses = interfaces[nic].filter((details) => (0, utils_1.normalizeFamilyNodeV18)(details.family) === family &&
|
|
1095
|
-
!nodeIp.isLoopback(details.address) &&
|
|
1096
|
-
!isAutoconfigurationAddress(details));
|
|
1097
|
-
return {
|
|
1098
|
-
nic,
|
|
1099
|
-
addresses: addresses.map((address) => address.address),
|
|
1100
|
-
};
|
|
1101
|
-
})
|
|
1102
|
-
.filter((address) => !!address);
|
|
1103
|
-
// os.networkInterfaces doesn't actually return addresses in a good order.
|
|
1104
|
-
// have seen instances where en0 (ethernet) is after en1 (wlan), etc.
|
|
1105
|
-
// eth0 > eth1
|
|
1106
|
-
all.sort((a, b) => a.nic.localeCompare(b.nic));
|
|
1107
|
-
return Object.values(all)
|
|
1108
|
-
.map((entry) => entry.addresses)
|
|
1109
|
-
.flat();
|
|
1110
|
-
}
|
|
1111
|
-
function getHostAddresses(useIpv4, useIpv6) {
|
|
1112
|
-
const address = [];
|
|
1113
|
-
if (useIpv4)
|
|
1114
|
-
address.push(...nodeIpAddress(4));
|
|
1115
|
-
if (useIpv6)
|
|
1116
|
-
address.push(...nodeIpAddress(6));
|
|
1117
|
-
return address;
|
|
1118
|
-
}
|
|
1119
|
-
exports.getHostAddresses = getHostAddresses;
|
|
1120
1023
|
async function serverReflexiveCandidate(protocol, stunServer) {
|
|
1121
1024
|
// """
|
|
1122
1025
|
// Query STUN server to obtain a server-reflexive candidate.
|
|
@@ -1137,7 +1040,7 @@ async function serverReflexiveCandidate(protocol, stunServer) {
|
|
|
1137
1040
|
}
|
|
1138
1041
|
exports.serverReflexiveCandidate = serverReflexiveCandidate;
|
|
1139
1042
|
function validateAddress(addr) {
|
|
1140
|
-
if (addr && isNaN(addr[1])) {
|
|
1043
|
+
if (addr && Number.isNaN(addr[1])) {
|
|
1141
1044
|
return [addr[0], 443];
|
|
1142
1045
|
}
|
|
1143
1046
|
return addr;
|