werift 0.28.0 → 0.29.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.
Files changed (492) hide show
  1. package/README.md +182 -2
  2. package/lib/common/src/transport.d.ts +39 -5
  3. package/lib/common/src/transport.js +32 -7
  4. package/lib/common/src/transport.js.map +1 -1
  5. package/lib/dtls/src/carrier/direct.d.ts +67 -0
  6. package/lib/dtls/src/carrier/direct.js +226 -0
  7. package/lib/dtls/src/carrier/direct.js.map +1 -0
  8. package/lib/dtls/src/carrier/types.d.ts +81 -0
  9. package/lib/dtls/src/carrier/types.js +7 -0
  10. package/lib/dtls/src/carrier/types.js.map +1 -0
  11. package/lib/dtls/src/cipher/const.d.ts +6 -0
  12. package/lib/dtls/src/cipher/const.js +13 -2
  13. package/lib/dtls/src/cipher/const.js.map +1 -1
  14. package/lib/dtls/src/cipher/prf.js +11 -2
  15. package/lib/dtls/src/cipher/prf.js.map +1 -1
  16. package/lib/dtls/src/cipher/tls13/aead.d.ts +41 -0
  17. package/lib/dtls/src/cipher/tls13/aead.js +128 -0
  18. package/lib/dtls/src/cipher/tls13/aead.js.map +1 -0
  19. package/lib/dtls/src/cipher/tls13/hkdf.d.ts +30 -0
  20. package/lib/dtls/src/cipher/tls13/hkdf.js +76 -0
  21. package/lib/dtls/src/cipher/tls13/hkdf.js.map +1 -0
  22. package/lib/dtls/src/cipher/tls13/keySchedule.d.ts +70 -0
  23. package/lib/dtls/src/cipher/tls13/keySchedule.js +114 -0
  24. package/lib/dtls/src/cipher/tls13/keySchedule.js.map +1 -0
  25. package/lib/dtls/src/cipher/tls13/signature.d.ts +30 -0
  26. package/lib/dtls/src/cipher/tls13/signature.js +149 -0
  27. package/lib/dtls/src/cipher/tls13/signature.js.map +1 -0
  28. package/lib/dtls/src/client.d.ts +253 -0
  29. package/lib/dtls/src/client.js +1257 -16
  30. package/lib/dtls/src/client.js.map +1 -1
  31. package/lib/dtls/src/context/dtls.d.ts +45 -0
  32. package/lib/dtls/src/context/dtls.js +114 -0
  33. package/lib/dtls/src/context/dtls.js.map +1 -1
  34. package/lib/dtls/src/context/transport.d.ts +13 -0
  35. package/lib/dtls/src/context/transport.js +29 -1
  36. package/lib/dtls/src/context/transport.js.map +1 -1
  37. package/lib/dtls/src/engine/v1_3/connection-base.d.ts +520 -0
  38. package/lib/dtls/src/engine/v1_3/connection-base.js +1644 -0
  39. package/lib/dtls/src/engine/v1_3/connection-base.js.map +1 -0
  40. package/lib/dtls/src/engine/v1_3/connection.d.ts +181 -0
  41. package/lib/dtls/src/engine/v1_3/connection.js +680 -0
  42. package/lib/dtls/src/engine/v1_3/connection.js.map +1 -0
  43. package/lib/dtls/src/engine/v1_3/early-data-buffer.d.ts +38 -0
  44. package/lib/dtls/src/engine/v1_3/early-data-buffer.js +166 -0
  45. package/lib/dtls/src/engine/v1_3/early-data-buffer.js.map +1 -0
  46. package/lib/dtls/src/engine/v1_3/flight/certificate.d.ts +4 -0
  47. package/lib/dtls/src/engine/v1_3/flight/certificate.js +62 -0
  48. package/lib/dtls/src/engine/v1_3/flight/certificate.js.map +1 -0
  49. package/lib/dtls/src/engine/v1_3/flight/client/flight1.d.ts +8 -0
  50. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js +119 -0
  51. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js.map +1 -0
  52. package/lib/dtls/src/engine/v1_3/flight/client/flight4.d.ts +8 -0
  53. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js +251 -0
  54. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js.map +1 -0
  55. package/lib/dtls/src/engine/v1_3/flight/client/flight5.d.ts +5 -0
  56. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js +99 -0
  57. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js.map +1 -0
  58. package/lib/dtls/src/engine/v1_3/flight/dispatch.d.ts +12 -0
  59. package/lib/dtls/src/engine/v1_3/flight/dispatch.js +138 -0
  60. package/lib/dtls/src/engine/v1_3/flight/dispatch.js.map +1 -0
  61. package/lib/dtls/src/engine/v1_3/flight/extensions.d.ts +13 -0
  62. package/lib/dtls/src/engine/v1_3/flight/extensions.js +46 -0
  63. package/lib/dtls/src/engine/v1_3/flight/extensions.js.map +1 -0
  64. package/lib/dtls/src/engine/v1_3/flight/finished.d.ts +6 -0
  65. package/lib/dtls/src/engine/v1_3/flight/finished.js +16 -0
  66. package/lib/dtls/src/engine/v1_3/flight/finished.js.map +1 -0
  67. package/lib/dtls/src/engine/v1_3/flight/post-hs.d.ts +12 -0
  68. package/lib/dtls/src/engine/v1_3/flight/post-hs.js +94 -0
  69. package/lib/dtls/src/engine/v1_3/flight/post-hs.js.map +1 -0
  70. package/lib/dtls/src/engine/v1_3/flight/server/flight2.d.ts +21 -0
  71. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js +227 -0
  72. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js.map +1 -0
  73. package/lib/dtls/src/engine/v1_3/flight/server/flight4.d.ts +6 -0
  74. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js +455 -0
  75. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js.map +1 -0
  76. package/lib/dtls/src/engine/v1_3/flight/server/flight5.d.ts +5 -0
  77. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js +48 -0
  78. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js.map +1 -0
  79. package/lib/dtls/src/engine/v1_3/flight-tx.d.ts +119 -0
  80. package/lib/dtls/src/engine/v1_3/flight-tx.js +782 -0
  81. package/lib/dtls/src/engine/v1_3/flight-tx.js.map +1 -0
  82. package/lib/dtls/src/engine/v1_3/host.d.ts +86 -0
  83. package/lib/dtls/src/engine/v1_3/host.js +11 -0
  84. package/lib/dtls/src/engine/v1_3/host.js.map +1 -0
  85. package/lib/dtls/src/engine/v1_3/record-rx.d.ts +77 -0
  86. package/lib/dtls/src/engine/v1_3/record-rx.js +818 -0
  87. package/lib/dtls/src/engine/v1_3/record-rx.js.map +1 -0
  88. package/lib/dtls/src/engine/v1_3/transcript.d.ts +22 -0
  89. package/lib/dtls/src/engine/v1_3/transcript.js +65 -0
  90. package/lib/dtls/src/engine/v1_3/transcript.js.map +1 -0
  91. package/lib/dtls/src/engine/v1_3/types.d.ts +169 -0
  92. package/lib/dtls/src/engine/v1_3/types.js +113 -0
  93. package/lib/dtls/src/engine/v1_3/types.js.map +1 -0
  94. package/lib/dtls/src/flight/client/flight1.d.ts +7 -1
  95. package/lib/dtls/src/flight/client/flight1.js +9 -3
  96. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  97. package/lib/dtls/src/flight/client/flight3.d.ts +8 -0
  98. package/lib/dtls/src/flight/client/flight3.js +24 -4
  99. package/lib/dtls/src/flight/client/flight3.js.map +1 -1
  100. package/lib/dtls/src/flight/client/flight5.js +13 -1
  101. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  102. package/lib/dtls/src/flight/flight.d.ts +16 -0
  103. package/lib/dtls/src/flight/flight.js +109 -8
  104. package/lib/dtls/src/flight/flight.js.map +1 -1
  105. package/lib/dtls/src/flight/server/commitClientHello.d.ts +35 -0
  106. package/lib/dtls/src/flight/server/commitClientHello.js +149 -0
  107. package/lib/dtls/src/flight/server/commitClientHello.js.map +1 -0
  108. package/lib/dtls/src/flight/server/flight2.d.ts +12 -3
  109. package/lib/dtls/src/flight/server/flight2.js +29 -105
  110. package/lib/dtls/src/flight/server/flight2.js.map +1 -1
  111. package/lib/dtls/src/flight/server/flight4.js +14 -2
  112. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  113. package/lib/dtls/src/flight/server/flight6.js +8 -0
  114. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  115. package/lib/dtls/src/handshake/const.d.ts +10 -0
  116. package/lib/dtls/src/handshake/const.js +10 -0
  117. package/lib/dtls/src/handshake/const.js.map +1 -1
  118. package/lib/dtls/src/handshake/extensions/cookie.d.ts +113 -0
  119. package/lib/dtls/src/handshake/extensions/cookie.js +326 -0
  120. package/lib/dtls/src/handshake/extensions/cookie.js.map +1 -0
  121. package/lib/dtls/src/handshake/extensions/ids.d.ts +7 -0
  122. package/lib/dtls/src/handshake/extensions/ids.js +11 -0
  123. package/lib/dtls/src/handshake/extensions/ids.js.map +1 -0
  124. package/lib/dtls/src/handshake/extensions/keyShare.d.ts +28 -0
  125. package/lib/dtls/src/handshake/extensions/keyShare.js +156 -0
  126. package/lib/dtls/src/handshake/extensions/keyShare.js.map +1 -0
  127. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.d.ts +27 -0
  128. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js +67 -0
  129. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js.map +1 -0
  130. package/lib/dtls/src/handshake/extensions/supportedVersions.d.ts +20 -0
  131. package/lib/dtls/src/handshake/extensions/supportedVersions.js +90 -0
  132. package/lib/dtls/src/handshake/extensions/supportedVersions.js.map +1 -0
  133. package/lib/dtls/src/handshake/extensions/unique.d.ts +7 -0
  134. package/lib/dtls/src/handshake/extensions/unique.js +19 -0
  135. package/lib/dtls/src/handshake/extensions/unique.js.map +1 -0
  136. package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +26 -3
  137. package/lib/dtls/src/handshake/extensions/useSrtp.js +68 -12
  138. package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
  139. package/lib/dtls/src/handshake/message/tls13/ack.d.ts +50 -0
  140. package/lib/dtls/src/handshake/message/tls13/ack.js +107 -0
  141. package/lib/dtls/src/handshake/message/tls13/ack.js.map +1 -0
  142. package/lib/dtls/src/handshake/message/tls13/certificate.d.ts +17 -0
  143. package/lib/dtls/src/handshake/message/tls13/certificate.js +112 -0
  144. package/lib/dtls/src/handshake/message/tls13/certificate.js.map +1 -0
  145. package/lib/dtls/src/handshake/message/tls13/certificateRequest.d.ts +17 -0
  146. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js +99 -0
  147. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js.map +1 -0
  148. package/lib/dtls/src/handshake/message/tls13/certificateVerify.d.ts +21 -0
  149. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js +77 -0
  150. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js.map +1 -0
  151. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.d.ts +19 -0
  152. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js +56 -0
  153. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js.map +1 -0
  154. package/lib/dtls/src/handshake/message/tls13/keyUpdate.d.ts +13 -0
  155. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js +54 -0
  156. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js.map +1 -0
  157. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.d.ts +33 -0
  158. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js +158 -0
  159. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js.map +1 -0
  160. package/lib/dtls/src/handshake/random.d.ts +14 -0
  161. package/lib/dtls/src/handshake/random.js +24 -0
  162. package/lib/dtls/src/handshake/random.js.map +1 -1
  163. package/lib/dtls/src/handshake/validation.d.ts +26 -0
  164. package/lib/dtls/src/handshake/validation.js +32 -0
  165. package/lib/dtls/src/handshake/validation.js.map +1 -0
  166. package/lib/dtls/src/index.d.ts +6 -1
  167. package/lib/dtls/src/index.js +116 -44
  168. package/lib/dtls/src/index.js.map +1 -1
  169. package/lib/dtls/src/internal.d.ts +7 -0
  170. package/lib/dtls/src/internal.js +57 -0
  171. package/lib/dtls/src/internal.js.map +1 -0
  172. package/lib/dtls/src/peer.d.ts +49 -0
  173. package/lib/dtls/src/peer.js +54 -0
  174. package/lib/dtls/src/peer.js.map +1 -0
  175. package/lib/dtls/src/record/antiReplayWindow.d.ts +33 -0
  176. package/lib/dtls/src/record/antiReplayWindow.js +119 -0
  177. package/lib/dtls/src/record/antiReplayWindow.js.map +1 -0
  178. package/lib/dtls/src/record/const.d.ts +6 -0
  179. package/lib/dtls/src/record/const.js +6 -0
  180. package/lib/dtls/src/record/const.js.map +1 -1
  181. package/lib/dtls/src/record/message/fragment.d.ts +0 -2
  182. package/lib/dtls/src/record/message/fragment.js +36 -17
  183. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  184. package/lib/dtls/src/record/message/reassembler.d.ts +62 -0
  185. package/lib/dtls/src/record/message/reassembler.js +249 -0
  186. package/lib/dtls/src/record/message/reassembler.js.map +1 -0
  187. package/lib/dtls/src/record/receive.js +24 -16
  188. package/lib/dtls/src/record/receive.js.map +1 -1
  189. package/lib/dtls/src/record/v1_3/header.d.ts +34 -0
  190. package/lib/dtls/src/record/v1_3/header.js +95 -0
  191. package/lib/dtls/src/record/v1_3/header.js.map +1 -0
  192. package/lib/dtls/src/record/v1_3/record.d.ts +133 -0
  193. package/lib/dtls/src/record/v1_3/record.js +370 -0
  194. package/lib/dtls/src/record/v1_3/record.js.map +1 -0
  195. package/lib/dtls/src/retransmission.d.ts +26 -0
  196. package/lib/dtls/src/retransmission.js +39 -0
  197. package/lib/dtls/src/retransmission.js.map +1 -0
  198. package/lib/dtls/src/server.d.ts +38 -0
  199. package/lib/dtls/src/server.js +367 -20
  200. package/lib/dtls/src/server.js.map +1 -1
  201. package/lib/dtls/src/socket.d.ts +379 -35
  202. package/lib/dtls/src/socket.js +1105 -132
  203. package/lib/dtls/src/socket.js.map +1 -1
  204. package/lib/dtls/src/version.d.ts +89 -0
  205. package/lib/dtls/src/version.js +204 -0
  206. package/lib/dtls/src/version.js.map +1 -0
  207. package/lib/ice/src/consent.d.ts +78 -1
  208. package/lib/ice/src/consent.js +236 -24
  209. package/lib/ice/src/consent.js.map +1 -1
  210. package/lib/ice/src/dns/lookup.d.ts +10 -0
  211. package/lib/ice/src/dns/lookup.js +130 -3
  212. package/lib/ice/src/dns/lookup.js.map +1 -1
  213. package/lib/ice/src/exceptions.d.ts +9 -0
  214. package/lib/ice/src/exceptions.js +14 -1
  215. package/lib/ice/src/exceptions.js.map +1 -1
  216. package/lib/ice/src/failover.d.ts +270 -0
  217. package/lib/ice/src/failover.js +674 -0
  218. package/lib/ice/src/failover.js.map +1 -0
  219. package/lib/ice/src/gatheringError.d.ts +28 -0
  220. package/lib/ice/src/gatheringError.js +17 -0
  221. package/lib/ice/src/gatheringError.js.map +1 -0
  222. package/lib/ice/src/ice.d.ts +265 -9
  223. package/lib/ice/src/ice.js +1624 -236
  224. package/lib/ice/src/ice.js.map +1 -1
  225. package/lib/ice/src/iceBase.d.ts +197 -6
  226. package/lib/ice/src/iceBase.js +157 -7
  227. package/lib/ice/src/iceBase.js.map +1 -1
  228. package/lib/ice/src/index.d.ts +2 -0
  229. package/lib/ice/src/index.js +4 -1
  230. package/lib/ice/src/index.js.map +1 -1
  231. package/lib/ice/src/internal/datagram.d.ts +37 -0
  232. package/lib/ice/src/internal/datagram.js +45 -0
  233. package/lib/ice/src/internal/datagram.js.map +1 -0
  234. package/lib/ice/src/internal/hostInterfaces.d.ts +13 -2
  235. package/lib/ice/src/internal/hostInterfaces.js +16 -4
  236. package/lib/ice/src/internal/hostInterfaces.js.map +1 -1
  237. package/lib/ice/src/internal/sped-bind.d.ts +44 -0
  238. package/lib/ice/src/internal/sped-bind.js +53 -0
  239. package/lib/ice/src/internal/sped-bind.js.map +1 -0
  240. package/lib/ice/src/internal/sped-binding-cache.d.ts +27 -0
  241. package/lib/ice/src/internal/sped-binding-cache.js +102 -0
  242. package/lib/ice/src/internal/sped-binding-cache.js.map +1 -0
  243. package/lib/ice/src/internal/sped.d.ts +15 -0
  244. package/lib/ice/src/internal/sped.js +62 -0
  245. package/lib/ice/src/internal/sped.js.map +1 -0
  246. package/lib/ice/src/nomination/selectionController.d.ts +111 -0
  247. package/lib/ice/src/nomination/selectionController.js +172 -0
  248. package/lib/ice/src/nomination/selectionController.js.map +1 -0
  249. package/lib/ice/src/nomination/selectionReplacement.d.ts +40 -0
  250. package/lib/ice/src/nomination/selectionReplacement.js +65 -7
  251. package/lib/ice/src/nomination/selectionReplacement.js.map +1 -1
  252. package/lib/ice/src/sped/draft00/codec.d.ts +20 -0
  253. package/lib/ice/src/sped/draft00/codec.js +59 -0
  254. package/lib/ice/src/sped/draft00/codec.js.map +1 -0
  255. package/lib/ice/src/sped/draft00/constants.d.ts +14 -0
  256. package/lib/ice/src/sped/draft00/constants.js +18 -0
  257. package/lib/ice/src/sped/draft00/constants.js.map +1 -0
  258. package/lib/ice/src/sped/draft00/index.d.ts +6 -0
  259. package/lib/ice/src/sped/draft00/index.js +26 -0
  260. package/lib/ice/src/sped/draft00/index.js.map +1 -0
  261. package/lib/ice/src/sped/draft00/mtu.d.ts +38 -0
  262. package/lib/ice/src/sped/draft00/mtu.js +96 -0
  263. package/lib/ice/src/sped/draft00/mtu.js.map +1 -0
  264. package/lib/ice/src/sped/draft00/session.d.ts +86 -0
  265. package/lib/ice/src/sped/draft00/session.js +353 -0
  266. package/lib/ice/src/sped/draft00/session.js.map +1 -0
  267. package/lib/ice/src/sped/draft00/types.d.ts +16 -0
  268. package/lib/ice/src/sped/draft00/types.js +3 -0
  269. package/lib/ice/src/sped/draft00/types.js.map +1 -0
  270. package/lib/ice/src/sped/runtime.d.ts +188 -0
  271. package/lib/ice/src/sped/runtime.js +643 -0
  272. package/lib/ice/src/sped/runtime.js.map +1 -0
  273. package/lib/ice/src/stun/protocol.d.ts +29 -0
  274. package/lib/ice/src/stun/protocol.js +91 -4
  275. package/lib/ice/src/stun/protocol.js.map +1 -1
  276. package/lib/ice/src/stun/rawAttributeValue.d.ts +1 -0
  277. package/lib/ice/src/stun/rawAttributeValue.js +6 -0
  278. package/lib/ice/src/stun/rawAttributeValue.js.map +1 -0
  279. package/lib/ice/src/stun/tcpProtocol.d.ts +1 -0
  280. package/lib/ice/src/stun/tcpProtocol.js +14 -2
  281. package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
  282. package/lib/ice/src/stun/transaction.d.ts +4 -0
  283. package/lib/ice/src/stun/transaction.js +23 -0
  284. package/lib/ice/src/stun/transaction.js.map +1 -1
  285. package/lib/ice/src/turn/protocol.d.ts +21 -2
  286. package/lib/ice/src/turn/protocol.js +93 -8
  287. package/lib/ice/src/turn/protocol.js.map +1 -1
  288. package/lib/ice/src/types/model.d.ts +9 -0
  289. package/lib/ice/src/types/model.js.map +1 -1
  290. package/lib/ice/src/utils.d.ts +13 -0
  291. package/lib/ice/src/utils.js +13 -0
  292. package/lib/ice/src/utils.js.map +1 -1
  293. package/lib/ice-server/src/stun/message.d.ts +15 -2
  294. package/lib/ice-server/src/stun/message.js +156 -25
  295. package/lib/ice-server/src/stun/message.js.map +1 -1
  296. package/lib/ice-server/src/stun/rawAttributeValue.d.ts +6 -0
  297. package/lib/ice-server/src/stun/rawAttributeValue.js +12 -0
  298. package/lib/ice-server/src/stun/rawAttributeValue.js.map +1 -0
  299. package/lib/index.mjs +19568 -3106
  300. package/lib/nonstandard/index.mjs +2539 -1175
  301. package/lib/polyfill/dom.mjs +33210 -16872
  302. package/lib/polyfill/index.mjs +33345 -17013
  303. package/lib/rtp/src/extra/processor/fsRetry.d.ts +20 -0
  304. package/lib/rtp/src/extra/processor/fsRetry.js +73 -0
  305. package/lib/rtp/src/extra/processor/fsRetry.js.map +1 -0
  306. package/lib/rtp/src/extra/processor/webm.d.ts +6 -0
  307. package/lib/rtp/src/extra/processor/webm.js +6 -2
  308. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  309. package/lib/rtp/src/extra/processor/webmCallback.d.ts +11 -0
  310. package/lib/rtp/src/extra/processor/webmCallback.js +23 -31
  311. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  312. package/lib/rtp/src/extra/processor/webmFileWriter.d.ts +24 -0
  313. package/lib/rtp/src/extra/processor/webmFileWriter.js +94 -0
  314. package/lib/rtp/src/extra/processor/webmFileWriter.js.map +1 -0
  315. package/lib/sctp/src/chunk.d.ts +5 -0
  316. package/lib/sctp/src/chunk.js +10 -0
  317. package/lib/sctp/src/chunk.js.map +1 -1
  318. package/lib/sctp/src/index.d.ts +1 -1
  319. package/lib/sctp/src/index.js +4 -1
  320. package/lib/sctp/src/index.js.map +1 -1
  321. package/lib/sctp/src/sctp.d.ts +81 -5
  322. package/lib/sctp/src/sctp.js +273 -28
  323. package/lib/sctp/src/sctp.js.map +1 -1
  324. package/lib/webrtc/src/api/compatibilityOptions.d.ts +11 -1
  325. package/lib/webrtc/src/api/compatibilityOptions.js +11 -1
  326. package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -1
  327. package/lib/webrtc/src/api/peerConfig.d.ts +210 -13
  328. package/lib/webrtc/src/api/peerConfig.js +100 -5
  329. package/lib/webrtc/src/api/peerConfig.js.map +1 -1
  330. package/lib/webrtc/src/api/peerConnectionEvents.d.ts +10 -1
  331. package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
  332. package/lib/webrtc/src/dataChannel.d.ts +122 -10
  333. package/lib/webrtc/src/dataChannel.js +214 -20
  334. package/lib/webrtc/src/dataChannel.js.map +1 -1
  335. package/lib/webrtc/src/media/domEventTarget.d.ts +55 -0
  336. package/lib/webrtc/src/media/domEventTarget.js +216 -0
  337. package/lib/webrtc/src/media/domEventTarget.js.map +1 -0
  338. package/lib/webrtc/src/media/index.d.ts +2 -0
  339. package/lib/webrtc/src/media/index.js +1 -0
  340. package/lib/webrtc/src/media/index.js.map +1 -1
  341. package/lib/webrtc/src/media/parameters.d.ts +5 -0
  342. package/lib/webrtc/src/media/parameters.js +10 -0
  343. package/lib/webrtc/src/media/parameters.js.map +1 -1
  344. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +10 -0
  345. package/lib/webrtc/src/media/receiver/receiverTwcc.js +4 -10
  346. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  347. package/lib/webrtc/src/media/router.d.ts +6 -0
  348. package/lib/webrtc/src/media/router.js +39 -1
  349. package/lib/webrtc/src/media/router.js.map +1 -1
  350. package/lib/webrtc/src/media/rtpReceiver.d.ts +56 -6
  351. package/lib/webrtc/src/media/rtpReceiver.js +165 -15
  352. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  353. package/lib/webrtc/src/media/rtpSender.d.ts +1 -1
  354. package/lib/webrtc/src/media/rtpSender.js +4 -3
  355. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  356. package/lib/webrtc/src/media/rtpTransceiver.d.ts +29 -11
  357. package/lib/webrtc/src/media/rtpTransceiver.js +31 -9
  358. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  359. package/lib/webrtc/src/media/stats.d.ts +13 -0
  360. package/lib/webrtc/src/media/stats.js.map +1 -1
  361. package/lib/webrtc/src/media/track.d.ts +103 -11
  362. package/lib/webrtc/src/media/track.js +241 -19
  363. package/lib/webrtc/src/media/track.js.map +1 -1
  364. package/lib/webrtc/src/media/trackConstraints.d.ts +80 -0
  365. package/lib/webrtc/src/media/trackConstraints.js +141 -0
  366. package/lib/webrtc/src/media/trackConstraints.js.map +1 -0
  367. package/lib/webrtc/src/negotiation/internalState.d.ts +0 -4
  368. package/lib/webrtc/src/negotiation/internalState.js +0 -11
  369. package/lib/webrtc/src/negotiation/internalState.js.map +1 -1
  370. package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +20 -1
  371. package/lib/webrtc/src/negotiation/remoteCandidates.js +29 -1
  372. package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
  373. package/lib/webrtc/src/negotiation/transportActivation.d.ts +4 -0
  374. package/lib/webrtc/src/negotiation/transportActivation.js +112 -11
  375. package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
  376. package/lib/webrtc/src/negotiationTransaction.d.ts +25 -4
  377. package/lib/webrtc/src/negotiationTransaction.js +27 -6
  378. package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
  379. package/lib/webrtc/src/nonstandard/dummyMedia.d.ts +6 -0
  380. package/lib/webrtc/src/nonstandard/dummyMedia.js +14 -19
  381. package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
  382. package/lib/webrtc/src/nonstandard/navigator.d.ts +1 -1
  383. package/lib/webrtc/src/nonstandard/recorder/index.js +5 -1
  384. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  385. package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +6 -1
  386. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +31 -2
  387. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  388. package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +16 -0
  389. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js +25 -0
  390. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
  391. package/lib/webrtc/src/nonstandard/userMedia.js +6 -13
  392. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  393. package/lib/webrtc/src/peerConnection.d.ts +44 -8
  394. package/lib/webrtc/src/peerConnection.js +88 -9
  395. package/lib/webrtc/src/peerConnection.js.map +1 -1
  396. package/lib/webrtc/src/polyfill/api.d.ts +2 -1
  397. package/lib/webrtc/src/polyfill/api.js +3 -3
  398. package/lib/webrtc/src/polyfill/api.js.map +1 -1
  399. package/lib/webrtc/src/polyfill/dom.d.ts +21 -7
  400. package/lib/webrtc/src/polyfill/dom.js +15 -0
  401. package/lib/webrtc/src/polyfill/dom.js.map +1 -1
  402. package/lib/webrtc/src/polyfill/globals.d.ts +6 -2
  403. package/lib/webrtc/src/polyfill/globals.js.map +1 -1
  404. package/lib/webrtc/src/polyfill/index.d.ts +1 -1
  405. package/lib/webrtc/src/polyfill/index.js +1 -1
  406. package/lib/webrtc/src/polyfill/index.js.map +1 -1
  407. package/lib/webrtc/src/polyfill/install.d.ts +5 -1
  408. package/lib/webrtc/src/polyfill/install.js +2 -2
  409. package/lib/webrtc/src/polyfill/install.js.map +1 -1
  410. package/lib/webrtc/src/polyfill/mediaDevices.js +28 -4
  411. package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
  412. package/lib/webrtc/src/polyfill/peerConnectionConfig.d.ts +6 -0
  413. package/lib/webrtc/src/polyfill/peerConnectionConfig.js +15 -4
  414. package/lib/webrtc/src/polyfill/peerConnectionConfig.js.map +1 -1
  415. package/lib/webrtc/src/polyfill/selectSettings.d.ts +4 -14
  416. package/lib/webrtc/src/polyfill/selectSettings.js +10 -106
  417. package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
  418. package/lib/webrtc/src/polyfill/sourceIo.d.ts +1 -2
  419. package/lib/webrtc/src/polyfill/sourceIo.js +6 -6
  420. package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
  421. package/lib/webrtc/src/sctpManager.d.ts +31 -18
  422. package/lib/webrtc/src/sctpManager.js +158 -38
  423. package/lib/webrtc/src/sctpManager.js.map +1 -1
  424. package/lib/webrtc/src/sdp.d.ts +38 -2
  425. package/lib/webrtc/src/sdp.js +84 -3
  426. package/lib/webrtc/src/sdp.js.map +1 -1
  427. package/lib/webrtc/src/sdpManager.d.ts +19 -9
  428. package/lib/webrtc/src/sdpManager.js +26 -4
  429. package/lib/webrtc/src/sdpManager.js.map +1 -1
  430. package/lib/webrtc/src/secureTransportManager.d.ts +11 -2
  431. package/lib/webrtc/src/secureTransportManager.js +84 -5
  432. package/lib/webrtc/src/secureTransportManager.js.map +1 -1
  433. package/lib/webrtc/src/transceiverManager.d.ts +5 -2
  434. package/lib/webrtc/src/transceiverManager.js +42 -14
  435. package/lib/webrtc/src/transceiverManager.js.map +1 -1
  436. package/lib/webrtc/src/transport/dtls-application-gate.d.ts +1 -0
  437. package/lib/webrtc/src/transport/dtls-application-gate.js +143 -0
  438. package/lib/webrtc/src/transport/dtls-application-gate.js.map +1 -0
  439. package/lib/webrtc/src/transport/dtls-attempt.d.ts +1 -0
  440. package/lib/webrtc/src/transport/dtls-attempt.js +79 -0
  441. package/lib/webrtc/src/transport/dtls-attempt.js.map +1 -0
  442. package/lib/webrtc/src/transport/dtls-certificate.d.ts +24 -0
  443. package/lib/webrtc/src/transport/dtls-certificate.js +98 -0
  444. package/lib/webrtc/src/transport/dtls-certificate.js.map +1 -0
  445. package/lib/webrtc/src/transport/dtls-fingerprint.d.ts +7 -0
  446. package/lib/webrtc/src/transport/dtls-fingerprint.js +66 -0
  447. package/lib/webrtc/src/transport/dtls-fingerprint.js.map +1 -0
  448. package/lib/webrtc/src/transport/dtls-ice-transport.d.ts +1 -0
  449. package/lib/webrtc/src/transport/dtls-ice-transport.js +123 -0
  450. package/lib/webrtc/src/transport/dtls-ice-transport.js.map +1 -0
  451. package/lib/webrtc/src/transport/dtls-media-queue.d.ts +1 -0
  452. package/lib/webrtc/src/transport/dtls-media-queue.js +95 -0
  453. package/lib/webrtc/src/transport/dtls-media-queue.js.map +1 -0
  454. package/lib/webrtc/src/transport/dtls-readiness.d.ts +1 -0
  455. package/lib/webrtc/src/transport/dtls-readiness.js +173 -0
  456. package/lib/webrtc/src/transport/dtls-readiness.js.map +1 -0
  457. package/lib/webrtc/src/transport/dtls-sped-handshake.d.ts +1 -0
  458. package/lib/webrtc/src/transport/dtls-sped-handshake.js +146 -0
  459. package/lib/webrtc/src/transport/dtls-sped-handshake.js.map +1 -0
  460. package/lib/webrtc/src/transport/dtls-srtp.d.ts +1 -0
  461. package/lib/webrtc/src/transport/dtls-srtp.js +133 -0
  462. package/lib/webrtc/src/transport/dtls-srtp.js.map +1 -0
  463. package/lib/webrtc/src/transport/dtls-stats.d.ts +1 -0
  464. package/lib/webrtc/src/transport/dtls-stats.js +134 -0
  465. package/lib/webrtc/src/transport/dtls-stats.js.map +1 -0
  466. package/lib/webrtc/src/transport/dtls-types.d.ts +23 -0
  467. package/lib/webrtc/src/transport/dtls-types.js +11 -0
  468. package/lib/webrtc/src/transport/dtls-types.js.map +1 -0
  469. package/lib/webrtc/src/transport/dtls.d.ts +150 -55
  470. package/lib/webrtc/src/transport/dtls.js +1017 -556
  471. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  472. package/lib/webrtc/src/transport/ice.d.ts +35 -2
  473. package/lib/webrtc/src/transport/ice.js +147 -14
  474. package/lib/webrtc/src/transport/ice.js.map +1 -1
  475. package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +4 -2
  476. package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -1
  477. package/lib/webrtc/src/transport/sctp.d.ts +126 -2
  478. package/lib/webrtc/src/transport/sctp.js +747 -134
  479. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  480. package/lib/webrtc/src/transport/sped.d.ts +139 -0
  481. package/lib/webrtc/src/transport/sped.js +757 -0
  482. package/lib/webrtc/src/transport/sped.js.map +1 -0
  483. package/lib/webrtc/src/types/util.d.ts +6 -0
  484. package/lib/webrtc/src/types/util.js.map +1 -1
  485. package/lib/webrtc/src/utils.d.ts +1 -1
  486. package/lib/webrtc/src/webidl.d.ts +15 -0
  487. package/lib/webrtc/src/webidl.js +34 -0
  488. package/lib/webrtc/src/webidl.js.map +1 -0
  489. package/package.json +7 -3
  490. package/lib/webrtc/src/polyfill/rtcSessionDescription.d.ts +0 -18
  491. package/lib/webrtc/src/polyfill/rtcSessionDescription.js +0 -36
  492. package/lib/webrtc/src/polyfill/rtcSessionDescription.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"peerConfig.js","sourceRoot":"","sources":["../../../../src/api/peerConfig.ts"],"names":[],"mappings":";;;AAodA,8DAoDC;AA6ED,wDAkCC;AAaD,wDAqNC;AAz1BD,yEAAyE;AACzE,6EAA6E;AAC7E,wDAAwD;AACxD,2CAAsE;AACtE,sCAA4E;AAC5E,sCAAsC;AAYtC,0CAA+C;AAC/C,oEAAqE;AASrE,8CAIuB;AAEvB,4CAA6D;AAC7D,oCAAqC;AACrC,iEAIgC;AAwRnB,QAAA,qBAAqB,GAChC,gDAAyB,CAAC,gBAAgB,CAAC;AAE7C,yFAAyF;AAC5E,QAAA,eAAe,GAC1B,gDAAyB,CAAC,UAAU,CAAC;AAI1B,QAAA,uBAAuB,GAClC,gDAAyB,CAAC,kBAAkB,CAAC;AAIlC,QAAA,o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AAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// RTCPeerConnection configuration: the public configuration types, their\n// defaults, input normalization (W3C RTCConfiguration compatibility) and the\n// validation `setConfiguration` applies before merging.\nimport { DEFAULT_SCTP_MTU, validateSctpMtu } from \"../../../sctp/src\";\nimport { createWebRtcDomException, createWebRtcTypeError } from \"../errors\";\nimport { enumerate } from \"../helper\";\nimport type {\n Address,\n InterfaceAddresses,\n TlsConnectionOptions,\n} from \"../imports/common\";\nimport type {\n CandidatePair,\n Message,\n MessageIntegrityMode,\n Protocol,\n} from \"../imports/ice\";\nimport { defaultCodecs } from \"../media/codec\";\nimport { normalizeCodecMimeType } from \"../media/codecCompatibility\";\nimport type {\n RTCRtpCodecParameters,\n RTCRtpHeaderExtensionParameters,\n} from \"../media/parameters\";\nimport type { KeyFrameRequestRouting } from \"../media/router\";\nimport type { RTCRtpSenderOptions } from \"../media/rtpSender\";\nimport type { BandwidthEstimatorOption } from \"../media/sender/createBandwidthEstimator\";\nimport type { BundlePolicy } from \"../sdp\";\nimport {\n type BundleCandidates,\n BundleCandidatesModes,\n type MLineReuse,\n} from \"../sdpManager\";\nimport type { DtlsKeys, RTCCertificate } from \"../transport/dtls\";\nimport { DEFAULT_MAX_MESSAGE_SIZE } from \"../transport/sctp\";\nimport { deepMerge } from \"../utils\";\nimport {\n type CompatibilityOption,\n type CompatibilityOptionValue,\n CompatibilityOptionValues,\n} from \"./compatibilityOptions\";\n\nexport type DebugConfig = Partial<{\n /**% */\n inboundPacketLoss: number;\n /**% */\n outboundPacketLoss: number;\n /**ms */\n receiverReportDelay: number;\n disableSendNack: boolean;\n disableRecvRetransmit: boolean;\n}>;\n\nexport interface PeerConfig {\n codecs: Partial<{\n /**\n * When specifying a codec with a fixed payloadType such as PCMU,\n * it is necessary to set the correct PayloadType in RTCRtpCodecParameters in advance.\n */\n audio: RTCRtpCodecParameters[];\n video: RTCRtpCodecParameters[];\n }>;\n headerExtensions: Partial<{\n audio: RTCRtpHeaderExtensionParameters[];\n video: RTCRtpHeaderExtensionParameters[];\n }>;\n iceTransportPolicy: \"all\" | \"relay\";\n /** Advertise local ICE lite and operate in the controlled role. */\n iceLite: boolean;\n iceServers: RTCIceServer[];\n /**\n * Fall back to the built-in public STUN server (`stun.l.google.com:19302`)\n * when `iceServers` contains no STUN URL (empty or TURN-only).\n * Set to false to gather server-reflexive candidates only from the STUN\n * servers given in `iceServers`. Defaults to true.\n */\n iceUseDefaultStunServer: boolean;\n /**Minimum port and Maximum port must not be the same value */\n icePortRange: [number, number] | undefined;\n /**\n * Local addresses to bind the ICE UDP host sockets to, per family\n * (`udp4` / `udp6`).\n *\n * The address given for a family is the only host address of that family:\n * its host candidate advertises the address the socket is actually bound\n * to, even when it is not an enumerated interface address (loopback, tun,\n * VPN, ...). If the bind fails, the family has no UDP host candidate.\n * A family left unspecified while the other one is set gathers no\n * enumerated addresses (only its `iceAdditionalHostAddresses`).\n *\n * When unset, each enumerated interface address gets a UDP host socket\n * bound to that address, so connectivity checks leave from the advertised\n * candidate on multi-NIC hosts. An address whose bind fails is not\n * advertised. VPN / tunnel interfaces (`tun`, `utun`, `ipsec`, `tap`) are\n * gathered with a low priority and the default-route address with the\n * highest: the source address of the route to the configured STUN / TURN\n * server (without one, no address is preferred and nothing else is probed).\n * With a STUN server, one more socket per family is bound to the\n * wildcard address: it advertises no host candidate but maps the route the\n * OS picks (server-reflexive candidate with `raddr 0.0.0.0`).\n * `setLocalDescription()` waits only for that socket and the\n * default-route one; the other interfaces' server-reflexive candidates\n * trickle through `onicecandidate` before the end-of-candidates `null`.\n * Set a family to `0.0.0.0` / `::` to gather its enumerated addresses over\n * wildcard sockets instead.\n */\n iceInterfaceAddresses: InterfaceAddresses | undefined;\n /** Add additional host (local) addresses to use for candidate gathering.\n * Notably, you can include hosts that are normally excluded, such as loopback, vmnet / veth interfaces, etc.\n * For a family bound by `iceInterfaceAddresses`, addresses other than the bound one are ignored.\n * An address assigned to a local interface is bound like an enumerated one; any other address\n * (a 1:1 NAT public address, for example) is gathered over a wildcard socket.\n */\n iceAdditionalHostAddresses: string[] | undefined;\n iceUseIpv4: boolean;\n iceUseIpv6: boolean;\n iceUseTcp: boolean;\n /** Gather passive (listening) TCP host candidates. Defaults to true. */\n iceTcpPassive: boolean;\n /**\n * Seconds to wait for server-reflexive candidates while gathering.\n * Defaults to 5 when undefined. `setLocalDescription()` waits for it only\n * on the wildcard and default-route sockets (see `iceInterfaceAddresses`).\n */\n iceStunGatherTimeout: number | undefined;\n /**\n * Seconds to wait for a TURN TCP/TLS connection to be established.\n * Defaults to 8 when undefined.\n */\n iceTurnConnectTimeout: number | undefined;\n /**\n * werift extension. With `iceNomination: \"regular\"`: milliseconds the\n * controlling ICE agent keeps checking before it nominates a candidate pair,\n * so a higher-priority candidate trickled shortly after a lower-priority one\n * succeeded can still be selected. Maps to `IceOptions.nominationDelayMs`:\n * 300 when undefined, 0 nominates the first valid pair at once.\n */\n iceNominationDelayMs: number | undefined;\n /**\n * werift extension. How the controlling ICE agent nominates toward a full\n * ICE peer (`IceOptions.nomination`). `\"semi-aggressive\"` (default when\n * undefined, as Chrome): the first pair whose check succeeds is selected at\n * once and a higher-priority pair that succeeds later replaces it.\n * `\"regular\"`: RFC 8445 regular nomination, one nomination after\n * `iceNominationDelayMs`.\n */\n iceNomination: \"semi-aggressive\" | \"regular\" | undefined;\n /**\n * werift extension. Enable ICE renomination\n * (draft-thatcher-ice-renomination, as libwebrtc implements it): every\n * description advertises `a=ice-options:trickle renomination`. When the\n * remote description advertises `renomination` too, the controlling agent\n * nominates with the NOMINATION STUN attribute and an increasing value, so\n * a later, better pair reliably replaces the selection on both sides\n * (`IceOptions.renomination`). Chrome advertises it only when its SDP is\n * modified before `setLocalDescription`; as the controlled side it honours\n * the attribute regardless. Defaults to false.\n */\n iceRenomination: boolean;\n turnTransport: \"udp\" | \"tcp\" | \"tls\" | undefined;\n turnTlsOptions: TlsConnectionOptions | undefined;\n /**\n * Preferred IP family of the TURN/UDP socket, applied only when the TURN\n * server is a hostname. Ignored for an IP literal server, whose own family\n * always selects the socket. Defaults to 4 when undefined.\n */\n turnUdpFamily: 4 | 6 | undefined;\n /** @deprecated Prefer turn URL transport parameters or turnTransport. */\n forceTurnTCP: boolean;\n /** such as google cloud run */\n iceUseLinkLocalAddress: boolean | undefined;\n /** If provided, is called on each STUN request.\n * Return `true` if a STUN response should be sent, false if it should be skipped. */\n iceFilterStunResponse:\n | ((message: Message, addr: Address, protocol: Protocol) => boolean)\n | undefined;\n iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;\n /**\n * Integrity attributes of the ICE connectivity checks and consent requests\n * werift sends (RFC 8489 short-term credentials). Applies to ICE transports\n * created after it is set.\n * - `undefined` / `\"sha1\"` (default): MESSAGE-INTEGRITY only. Browsers\n * (libwebrtc, Firefox) accept this.\n * - `\"sha256\"`: MESSAGE-INTEGRITY-SHA256 only. Only for peers known to\n * support it: a peer that does not know the attribute rejects the checks.\n * - `\"both\"`: MESSAGE-INTEGRITY followed by MESSAGE-INTEGRITY-SHA256.\n *\n * Checks and responses from the peer are accepted with either algorithm,\n * and responses are always signed with the algorithm of the request.\n */\n iceMessageIntegrity: MessageIntegrityMode | undefined;\n /**\n * Advertise the `ice2` ice-option (`a=ice-options:trickle ice2`, RFC 8445\n * §10 / RFC 8839) to declare an RFC 8445 agent. Defaults to false\n * (`a=ice-options:trickle`). It is only a declaration: werift runs the\n * RFC 8445 procedures either way. Cannot be changed after construction.\n */\n iceOptionIce2: boolean;\n dtls: Partial<{\n keys: DtlsKeys;\n }>;\n icePasswordPrefix: string | undefined;\n bundlePolicy: BundlePolicy;\n rtcpMuxPolicy: \"require\";\n iceCandidatePoolSize: number;\n certificates: RTCCertificate[];\n /**\n * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given\n * (see {@link CompatibilityOptionValues}). Cannot be changed after construction.\n * - `\"process\"` (default): one certificate shared by every RTCPeerConnection in the process,\n * so their `a=fingerprint` values are identical.\n * - `\"standard\"`: each RTCPeerConnection generates its own certificate, as browsers do.\n * All DTLS transports of that connection share it.\n *\n * Also accepts the v0.27.0 name `\"peerConnection\"` (= `\"standard\"`).\n */\n certificateScope: CertificateScope;\n debug: DebugConfig;\n midSuffix: boolean;\n /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */\n maxMessageSize: number;\n /**\n * When true, padding-only RTP is omitted from onReceiveRtp and later media\n * sequence numbers are compacted. Default false preserves wire RTP events.\n */\n filterProbePaddingOnReceiveRtp: boolean;\n /** Send-side estimator used by each new sender; defaults to `\"lightweight\"`. */\n bandwidthEstimator: BandwidthEstimatorOption;\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. */\n sctp: { mtu: number };\n /**\n * Queue outbound RTP on each sender until DTLS is connected.\n * Disabled by default. Pass `true` or `{ enabled: true, maxLength }` to buffer.\n */\n pendingRtp: NonNullable<RTCRtpSenderOptions[\"pendingRtp\"]>;\n /**\n * How local SDP marks inactive / stopped m-lines (see {@link CompatibilityOptionValues}).\n * Cannot be changed after construction.\n * - `\"standard\"` (default): an accepted `inactive` m-line keeps a non-zero port, as JSEP\n * and browsers do. Only rejected (no common codec / remote port 0) or stopped m-lines\n * use port 0, and only those negotiated port 0 positions are reused by new transceivers.\n * - `\"aggressive\"`: behavior before v0.25.0. `inactive` m-lines are also written with\n * port 0, so the remote side treats them as rejected and their positions are reused.\n *\n * Also accepts the v0.27.0 name `\"compatible\"` (= `\"standard\"`).\n */\n mLineReuse: MLineReuse;\n /**\n * How a remote offer's m-sections are paired with local transceivers that\n * have no MID yet (see {@link CompatibilityOptionValues}). Cannot be changed\n * after construction.\n * - `\"byKind\"` (default): behavior up to v0.27.0. Any unassociated,\n * non-stopped transceiver of the same kind is paired (the one at the same\n * m-line index first), whatever created it. In glare (perfect negotiation)\n * the remote offer can take over a transceiver created with\n * `addTransceiver(kind, { direction: \"sendonly\" })` and its direction\n * becomes `sendrecv`.\n * - `\"standard\"`: RFC 8829 (JSEP) section 5.10, as browsers do. An\n * m-section whose MID no transceiver has is associated only with an\n * unassociated, non-stopped transceiver of the same kind that\n * `addTrack()` created (or one a rollback promoted to that, JSEP 4.1.8.2),\n * and only when the m-section is `sendrecv` or `recvonly`. A transceiver\n * created by `addTransceiver()` (with or without a track, also after\n * `replaceTrack()` or a later `addTrack()` reusing it) is never paired:\n * the offer gets a new transceiver, and the local one keeps its direction\n * and `mid === null` until a local offer negotiates it. Use it for the\n * perfect negotiation pattern and for code written for browsers.\n */\n transceiverPairing: TransceiverPairing;\n /**\n * Where a PLI / FIR goes when no route has its target SSRC (see\n * {@link CompatibilityOptionValues} and {@link KeyFrameRequestRouting}).\n * `setConfiguration()` may change it.\n * - `\"fallback\"` (default): the sender whose RTX SSRC it is, else the only video sender.\n * - `\"standard\"`: not delivered, as RFC 4585 / RFC 5104 define the target.\n *\n * Also accepts the names up to v0.27.0: `\"compatible\"` (= `\"fallback\"`) and\n * `\"strict\"` (= `\"standard\"`).\n */\n keyFrameRequestRouting: KeyFrameRequestRouting;\n /**\n * Which m-lines of a BUNDLE group carry the local ICE candidates.\n * Cannot be changed after construction. See {@link BundleCandidates}.\n * - `\"legacy\"` (default): every m-line repeats its transport's candidates and\n * `a=end-of-candidates` (werift's earlier output).\n * - `\"compatible\"`: as Chrome writes them, only the BUNDLE tag m-line carries\n * them, so renegotiation with more m-lines no longer repeats the candidate list.\n */\n bundleCandidates: BundleCandidates;\n /**\n * Sets every compatibility option (`certificateScope`, `mLineReuse`,\n * `transceiverPairing`, `keyFrameRequestRouting`, see\n * {@link CompatibilityOptionValues}) to the specification / browser behavior\n * at once. Cannot be changed after construction.\n * - `undefined` (default): each option keeps its own default.\n * - `\"standard\"`: every compatibility option not given in the same\n * configuration is `\"standard\"`.\n *\n * An option given explicitly always takes precedence over `compatibility`:\n * a value given in the same configuration (an old name included) is kept,\n * and `setConfiguration()` treats the options as if `compatibility` were\n * not set (`keyFrameRequestRouting` may change, the others cannot). An\n * option given as `undefined` counts as not given.\n *\n * ```ts\n * new RTCPeerConnection({ compatibility: \"standard\" });\n * // certificateScope, mLineReuse, transceiverPairing and\n * // keyFrameRequestRouting are all \"standard\"\n * new RTCPeerConnection({ compatibility: \"standard\", certificateScope: \"process\" });\n * // certificateScope is \"process\", the other three are \"standard\"\n * ```\n *\n * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not\n * compatibility options.\n */\n compatibility: CompatibilityPreset | undefined;\n}\n\n/** Which default DTLS certificate is used. See {@link PeerConfig.certificateScope}. */\nexport type CertificateScope = CompatibilityOptionValue<\"certificateScope\">;\nexport const CertificateScopeModes: readonly CertificateScope[] =\n CompatibilityOptionValues.certificateScope;\n\n/** How local SDP marks inactive / stopped m-lines. See {@link PeerConfig.mLineReuse}. */\nexport const MLineReuseModes: readonly MLineReuse[] =\n CompatibilityOptionValues.mLineReuse;\n\n/** How a remote offer pairs m-sections with local transceivers. See {@link PeerConfig.transceiverPairing}. */\nexport type TransceiverPairing = CompatibilityOptionValue<\"transceiverPairing\">;\nexport const TransceiverPairingModes: readonly TransceiverPairing[] =\n CompatibilityOptionValues.transceiverPairing;\n\n/** The values of {@link PeerConfig.compatibility}. */\nexport type CompatibilityPreset = \"standard\";\nexport const CompatibilityPresets: readonly CompatibilityPreset[] = [\n \"standard\",\n];\n\nconst COMPATIBILITY_OPTIONS = Object.keys(\n CompatibilityOptionValues,\n) as CompatibilityOption[];\n\n/**\n * The values the compatibility options used up to v0.27.0 that are not\n * values any more, and the value each one is read as. They are accepted on\n * input only: `getConfiguration()` returns the current name.\n */\nexport const DeprecatedCompatibilityValues = {\n certificateScope: { peerConnection: \"standard\" },\n mLineReuse: { compatible: \"standard\" },\n keyFrameRequestRouting: { compatible: \"fallback\", strict: \"standard\" },\n} as const satisfies {\n [K in CompatibilityOption]?: Readonly<\n Record<string, CompatibilityOptionValue<K>>\n >;\n};\n\n/** @deprecated Use `\"standard\"` (`\"peerConnection\"`). */\nexport type DeprecatedCertificateScope =\n keyof (typeof DeprecatedCompatibilityValues)[\"certificateScope\"];\n/** @deprecated Use `\"standard\"` (`\"compatible\"`). */\nexport type DeprecatedMLineReuse =\n keyof (typeof DeprecatedCompatibilityValues)[\"mLineReuse\"];\n/** @deprecated Use `\"fallback\"` (`\"compatible\"`) or `\"standard\"` (`\"strict\"`). */\nexport type DeprecatedKeyFrameRequestRouting =\n keyof (typeof DeprecatedCompatibilityValues)[\"keyFrameRequestRouting\"];\n\nconst MessageIntegrityModes: readonly MessageIntegrityMode[] = [\n \"sha1\",\n \"sha256\",\n \"both\",\n];\n\nexport const findCodecByMimeType = (\n codecs: RTCRtpCodecParameters[],\n target: RTCRtpCodecParameters,\n) =>\n codecs.find(\n (localCodec) =>\n normalizeCodecMimeType(localCodec.mimeType) ===\n normalizeCodecMimeType(target.mimeType),\n )\n ? target\n : undefined;\n\nfunction assignDynamicPayloadTypes(config: PeerConfig) {\n for (const [i, codecParams] of enumerate([\n ...(config.codecs.audio || []),\n ...(config.codecs.video || []),\n ])) {\n if (codecParams.payloadType != undefined) {\n continue;\n }\n\n codecParams.payloadType = 96 + i;\n switch (codecParams.name.toLowerCase()) {\n case \"rtx\":\n {\n codecParams.parameters = `apt=${codecParams.payloadType - 1}`;\n }\n break;\n case \"red\":\n {\n if (codecParams.contentType === \"audio\") {\n const redundant = codecParams.payloadType + 1;\n codecParams.parameters = `${redundant}/${redundant}`;\n codecParams.payloadType = 63;\n }\n }\n break;\n }\n }\n}\n\nexport type RTCIceServer = {\n urls: string | string[];\n username?: string;\n credential?: string;\n};\n\nexport type RTCBundlePolicy = \"balanced\" | \"max-compat\" | \"max-bundle\";\nexport type RTCRtcpMuxPolicy = \"require\";\n\nexport interface RTCSctpConfiguration {\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. Defaults to 1191. */\n mtu?: number;\n}\n\nexport interface RTCConfiguration {\n iceServers?: RTCIceServer[];\n iceTransportPolicy?: PeerConfig[\"iceTransportPolicy\"];\n bundlePolicy?: RTCBundlePolicy;\n rtcpMuxPolicy?: RTCRtcpMuxPolicy;\n iceCandidatePoolSize?: number;\n certificates?: RTCCertificate[];\n}\n\ntype RTCPeerConnectionRTCConfiguration = Omit<\n RTCConfiguration,\n \"bundlePolicy\"\n> & {\n bundlePolicy?: PeerConfig[\"bundlePolicy\"] | RTCBundlePolicy;\n};\n\nexport type RTCPeerConnectionConfig = Partial<\n Omit<\n PeerConfig,\n | \"bundlePolicy\"\n | \"rtcpMuxPolicy\"\n | \"iceCandidatePoolSize\"\n | \"certificates\"\n | \"sctp\"\n | \"certificateScope\"\n | \"mLineReuse\"\n | \"keyFrameRequestRouting\"\n >\n> &\n RTCPeerConnectionRTCConfiguration & {\n sctp?: RTCSctpConfiguration;\n /** See {@link PeerConfig.certificateScope}. */\n certificateScope?: CertificateScope | DeprecatedCertificateScope;\n /** See {@link PeerConfig.mLineReuse}. */\n mLineReuse?: MLineReuse | DeprecatedMLineReuse;\n /** See {@link PeerConfig.keyFrameRequestRouting}. */\n keyFrameRequestRouting?:\n | KeyFrameRequestRouting\n | DeprecatedKeyFrameRequestRouting;\n };\n\nexport function generateDefaultPeerConfig(): PeerConfig {\n return {\n codecs: defaultCodecs(),\n headerExtensions: {\n audio: [],\n video: [],\n },\n iceTransportPolicy: \"all\",\n iceLite: false,\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n iceUseDefaultStunServer: true,\n icePortRange: undefined,\n iceInterfaceAddresses: undefined,\n iceAdditionalHostAddresses: undefined,\n iceUseIpv4: true,\n iceUseIpv6: true,\n iceUseTcp: false,\n iceTcpPassive: true,\n iceStunGatherTimeout: undefined,\n iceTurnConnectTimeout: undefined,\n iceNominationDelayMs: undefined,\n iceNomination: undefined,\n iceRenomination: false,\n turnTransport: undefined,\n turnTlsOptions: undefined,\n turnUdpFamily: undefined,\n iceFilterStunResponse: undefined,\n iceFilterCandidatePair: undefined,\n iceMessageIntegrity: undefined,\n iceOptionIce2: false,\n icePasswordPrefix: undefined,\n iceUseLinkLocalAddress: undefined,\n dtls: {},\n bundlePolicy: \"max-compat\",\n rtcpMuxPolicy: \"require\",\n iceCandidatePoolSize: 0,\n certificates: [],\n certificateScope: \"process\",\n debug: {},\n midSuffix: false,\n forceTurnTCP: false,\n maxMessageSize: DEFAULT_MAX_MESSAGE_SIZE,\n filterProbePaddingOnReceiveRtp: false,\n bandwidthEstimator: \"lightweight\",\n sctp: { mtu: DEFAULT_SCTP_MTU },\n pendingRtp: false,\n mLineReuse: \"standard\",\n transceiverPairing: \"byKind\",\n keyFrameRequestRouting: \"fallback\",\n bundleCandidates: \"legacy\",\n compatibility: undefined,\n };\n}\nexport const defaultPeerConfig: PeerConfig = generateDefaultPeerConfig();\n\nfunction normalizePeerConfiguration(\n config: RTCPeerConnectionConfig,\n): Partial<PeerConfig> & { sctp?: RTCSctpConfiguration } {\n const input = Object(config ?? {}) as RTCPeerConnectionConfig;\n const normalizedConfig = { ...input } as Partial<PeerConfig> & {\n sctp?: RTCSctpConfiguration;\n };\n\n if (input.sctp !== undefined) {\n normalizedConfig.sctp = { ...input.sctp } as PeerConfig[\"sctp\"];\n }\n\n if (input.bundlePolicy === \"balanced\") {\n normalizedConfig.bundlePolicy = \"max-compat\";\n }\n\n for (const option of COMPATIBILITY_OPTIONS) {\n const value: unknown = input[option];\n if (option in DeprecatedCompatibilityValues && typeof value === \"string\") {\n const aliases: Readonly<Record<string, string>> =\n DeprecatedCompatibilityValues[\n option as keyof typeof DeprecatedCompatibilityValues\n ];\n if (Object.hasOwn(aliases, value)) {\n (normalizedConfig as Record<string, unknown>)[option] = aliases[value];\n }\n }\n }\n\n if (\"certificates\" in input) {\n if (input.certificates === undefined) {\n normalizedConfig.certificates = undefined;\n } else if (\n !Array.isArray(input.certificates) ||\n input.certificates.some((certificate) => certificate == null)\n ) {\n throw createWebRtcTypeError(\n \"certificates must be an array of RTCCertificate\",\n );\n } else {\n normalizedConfig.certificates = [...input.certificates];\n }\n }\n\n if (\"iceCandidatePoolSize\" in input) {\n normalizedConfig.iceCandidatePoolSize = coerceUnsignedShort(\n input.iceCandidatePoolSize,\n \"iceCandidatePoolSize\",\n );\n }\n\n return normalizedConfig;\n}\n\nfunction coerceUnsignedShort(value: unknown, name: string) {\n const coerced = Number(value);\n if (\n !Number.isFinite(coerced) ||\n !Number.isInteger(coerced) ||\n coerced < 0 ||\n coerced > 65535\n ) {\n throw createWebRtcTypeError(`${name} must be an unsigned short`);\n }\n return coerced;\n}\n\nfunction hasSameCertificates(left: RTCCertificate[], right: RTCCertificate[]) {\n return (\n left.length === right.length &&\n left.every((certificate, index) => certificate === right[index])\n );\n}\n\nexport function clonePeerConfiguration(config: PeerConfig) {\n return {\n ...config,\n codecs: {\n audio: config.codecs.audio ? [...config.codecs.audio] : undefined,\n video: config.codecs.video ? [...config.codecs.video] : undefined,\n },\n headerExtensions: {\n audio: config.headerExtensions.audio\n ? [...config.headerExtensions.audio]\n : undefined,\n video: config.headerExtensions.video\n ? [...config.headerExtensions.video]\n : undefined,\n },\n iceServers: config.iceServers.map((server) => ({\n ...server,\n urls: Array.isArray(server.urls) ? [...server.urls] : server.urls,\n })),\n icePortRange: config.icePortRange\n ? ([...config.icePortRange] as [number, number])\n : undefined,\n iceAdditionalHostAddresses: config.iceAdditionalHostAddresses\n ? [...config.iceAdditionalHostAddresses]\n : undefined,\n dtls: { ...config.dtls },\n certificates: [...config.certificates],\n debug: { ...config.debug },\n sctp: { ...config.sctp },\n pendingRtp:\n typeof config.pendingRtp === \"object\" && config.pendingRtp != undefined\n ? { ...config.pendingRtp }\n : config.pendingRtp,\n };\n}\n\n/**\n * `setConfiguration`: validate `input` against the current `config`, then\n * merge it in place. Returns the normalized input; side effects on live\n * transports (SCTP limits, ICE servers) stay with the caller.\n */\nconst CLEARABLE_TURN_KEYS = [\n \"turnTransport\",\n \"turnTlsOptions\",\n \"turnUdpFamily\",\n] as const;\n\nexport function mergePeerConfiguration(\n config: PeerConfig,\n input: RTCPeerConnectionConfig,\n {\n isReconfiguration,\n hasLocalDescription,\n hasSctpTransport,\n }: {\n isReconfiguration: boolean;\n hasLocalDescription: boolean;\n hasSctpTransport: boolean;\n },\n) {\n const normalizedConfig = normalizePeerConfiguration(input);\n\n if (\n normalizedConfig.rtcpMuxPolicy &&\n normalizedConfig.rtcpMuxPolicy !== \"require\"\n ) {\n throw new Error(\"rtcpMuxPolicy must be require\");\n }\n\n if (\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n (!Number.isInteger(normalizedConfig.iceCandidatePoolSize) ||\n normalizedConfig.iceCandidatePoolSize < 0)\n ) {\n throw new Error(\"iceCandidatePoolSize must be a non-negative integer\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundlePolicy !== undefined &&\n normalizedConfig.bundlePolicy !== config.bundlePolicy\n ) {\n throw new Error(\"bundlePolicy cannot be changed\");\n }\n\n if (\n normalizedConfig.compatibility !== undefined &&\n !CompatibilityPresets.includes(normalizedConfig.compatibility)\n ) {\n throw createWebRtcTypeError(\n `compatibility must be one of ${CompatibilityPresets.join(\", \")}`,\n );\n }\n if (isReconfiguration) {\n if (\n normalizedConfig.compatibility !== undefined &&\n normalizedConfig.compatibility !== config.compatibility\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"compatibility cannot be changed\",\n );\n }\n } else if (normalizedConfig.compatibility === \"standard\") {\n // 構築時だけ、明示されていない互換性オプションを standard にする。\n // 明示された値は常に compatibility より優先する (PeerConfig.compatibility)\n for (const option of COMPATIBILITY_OPTIONS) {\n if (normalizedConfig[option] === undefined) {\n (normalizedConfig as Record<string, unknown>)[option] = \"standard\";\n }\n }\n }\n\n for (const option of COMPATIBILITY_OPTIONS) {\n const value = normalizedConfig[option];\n if (value === undefined) continue;\n const values: readonly string[] = CompatibilityOptionValues[option];\n if (!values.includes(value)) {\n throw createWebRtcTypeError(\n `${option} must be one of ${values.join(\", \")}`,\n );\n }\n // keyFrameRequestRouting は接続中に切り替えられる (router が次の要求から使う)\n if (\n isReconfiguration &&\n option !== \"keyFrameRequestRouting\" &&\n value !== config[option]\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n `${option} cannot be changed`,\n );\n }\n }\n\n if (\n normalizedConfig.bundleCandidates !== undefined &&\n !BundleCandidatesModes.includes(normalizedConfig.bundleCandidates)\n ) {\n throw createWebRtcTypeError(\n `bundleCandidates must be one of ${BundleCandidatesModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundleCandidates !== undefined &&\n normalizedConfig.bundleCandidates !== config.bundleCandidates\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"bundleCandidates cannot be changed\",\n );\n }\n\n if (\n normalizedConfig.iceMessageIntegrity !== undefined &&\n !MessageIntegrityModes.includes(normalizedConfig.iceMessageIntegrity)\n ) {\n throw createWebRtcTypeError(\n `iceMessageIntegrity must be one of ${MessageIntegrityModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceOptionIce2 !== undefined &&\n normalizedConfig.iceOptionIce2 !== config.iceOptionIce2\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"iceOptionIce2 cannot be changed\",\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.rtcpMuxPolicy !== undefined &&\n normalizedConfig.rtcpMuxPolicy !== config.rtcpMuxPolicy\n ) {\n throw new Error(\"rtcpMuxPolicy cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.certificates !== undefined &&\n !hasSameCertificates(normalizedConfig.certificates, config.certificates)\n ) {\n throw new Error(\"certificates cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n hasLocalDescription &&\n normalizedConfig.iceCandidatePoolSize !== config.iceCandidatePoolSize\n ) {\n throw new Error(\n \"iceCandidatePoolSize cannot be changed after setLocalDescription\",\n );\n }\n\n if ((normalizedConfig.iceCandidatePoolSize ?? 0) > 0) {\n throw new Error(\"iceCandidatePoolSize > 0 is not supported\");\n }\n\n if (normalizedConfig.sctp !== undefined) {\n const requestedSctpMtu = normalizedConfig.sctp.mtu ?? DEFAULT_SCTP_MTU;\n validateSctpMtu(requestedSctpMtu);\n if (hasSctpTransport && requestedSctpMtu !== config.sctp.mtu) {\n throw new Error(\n \"sctp.mtu cannot be changed after SCTP transport creation\",\n );\n }\n }\n\n deepMerge(config, normalizedConfig as Partial<PeerConfig>);\n // Omitted keys keep their value, but an explicit `undefined` unsets these\n // optional TURN settings (deepMerge skips undefined).\n for (const key of CLEARABLE_TURN_KEYS) {\n if (Object.hasOwn(normalizedConfig, key) && normalizedConfig[key] == null) {\n // Union-key writes require the intersection of all indexed property\n // types. Narrow the key so each optional setting can be cleared safely.\n switch (key) {\n case \"turnTransport\":\n config.turnTransport = undefined;\n break;\n case \"turnTlsOptions\":\n config.turnTlsOptions = undefined;\n break;\n case \"turnUdpFamily\":\n config.turnUdpFamily = undefined;\n break;\n }\n }\n }\n config.sctp = {\n mtu: config.sctp?.mtu ?? DEFAULT_SCTP_MTU,\n };\n\n if (config.icePortRange) {\n const [min, max] = config.icePortRange;\n if (min === max) throw new Error(\"should not be same value\");\n if (min >= max) throw new Error(\"The min must be less than max\");\n }\n\n if (!Number.isInteger(config.maxMessageSize) || config.maxMessageSize < 0) {\n throw new Error(\"maxMessageSize must be a non-negative integer\");\n }\n\n assignDynamicPayloadTypes(config);\n\n [\n ...(config.headerExtensions.audio || []),\n ...(config.headerExtensions.video || []),\n ].forEach((v, i) => {\n v.id = 1 + i;\n });\n\n return normalizedConfig;\n}\n"]}
1
+ {"version":3,"file":"peerConfig.js","sourceRoot":"","sources":["../../../../src/api/peerConfig.ts"],"names":[],"mappings":";;;AA8cA,oEAIC;AAmJD,kDAMC;AAED,8DA8DC;AAkGD,wDAyCC;AAaD,wDAmRC;AAtlCD,yEAAyE;AACzE,6EAA6E;AAC7E,wDAAwD;AACxD,2CAAsE;AAEtE,sCAA4E;AAC5E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+B,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAElC;QACE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC;KACzC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACjB,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// RTCPeerConnection configuration: the public configuration types, their\n// defaults, input normalization (W3C RTCConfiguration compatibility) and the\n// validation `setConfiguration` applies before merging.\nimport { DEFAULT_SCTP_MTU, validateSctpMtu } from \"../../../sctp/src\";\nimport type { RTCDataChannelBinaryType } from \"../dataChannel\";\nimport { createWebRtcDomException, createWebRtcTypeError } from \"../errors\";\nimport { enumerate } from \"../helper\";\nimport type {\n Address,\n InterfaceAddresses,\n TlsConnectionOptions,\n} from \"../imports/common\";\nimport type { DtlsVersion } from \"../imports/dtls\";\nimport type {\n CandidatePair,\n IceFailoverOptions,\n Message,\n MessageIntegrityMode,\n Protocol,\n} from \"../imports/ice\";\nimport { defaultCodecs } from \"../media/codec\";\nimport { normalizeCodecMimeType } from \"../media/codecCompatibility\";\nimport type {\n RTCRtpCodecParameters,\n RTCRtpHeaderExtensionParameters,\n} from \"../media/parameters\";\nimport type { KeyFrameRequestRouting } from \"../media/router\";\nimport type { RTCRtpSenderOptions } from \"../media/rtpSender\";\nimport type { BandwidthEstimatorOption } from \"../media/sender/createBandwidthEstimator\";\nimport type { BundlePolicy } from \"../sdp\";\nimport {\n type BundleCandidates,\n BundleCandidatesModes,\n type MLineReuse,\n} from \"../sdpManager\";\nimport type { DtlsKeys, RTCCertificate } from \"../transport/dtls\";\nimport { DEFAULT_MAX_MESSAGE_SIZE } from \"../transport/sctp\";\nimport { deepMerge } from \"../utils\";\nimport {\n type CompatibilityOption,\n type CompatibilityOptionValue,\n CompatibilityOptionValues,\n} from \"./compatibilityOptions\";\n\nexport type DebugConfig = Partial<{\n /**% */\n inboundPacketLoss: number;\n /**% */\n outboundPacketLoss: number;\n /**ms */\n receiverReportDelay: number;\n disableSendNack: boolean;\n disableRecvRetransmit: boolean;\n}>;\n\nexport interface PeerConfig {\n codecs: Partial<{\n /**\n * When specifying a codec with a fixed payloadType such as PCMU,\n * it is necessary to set the correct PayloadType in RTCRtpCodecParameters in advance.\n */\n audio: RTCRtpCodecParameters[];\n video: RTCRtpCodecParameters[];\n }>;\n headerExtensions: Partial<{\n audio: RTCRtpHeaderExtensionParameters[];\n video: RTCRtpHeaderExtensionParameters[];\n }>;\n iceTransportPolicy: \"all\" | \"relay\";\n /** Advertise local ICE lite and operate in the controlled role. */\n iceLite: boolean;\n iceServers: RTCIceServer[];\n /**\n * Fall back to the built-in public STUN server (`stun.l.google.com:19302`)\n * when `iceServers` contains no STUN URL (empty or TURN-only).\n * Set to false to gather server-reflexive candidates only from the STUN\n * servers given in `iceServers`. Defaults to true.\n */\n iceUseDefaultStunServer: boolean;\n /**Minimum port and Maximum port must not be the same value */\n icePortRange: [number, number] | undefined;\n /**\n * Local addresses to bind the ICE UDP host sockets to, per family\n * (`udp4` / `udp6`).\n *\n * The address given for a family is the only host address of that family:\n * its host candidate advertises the address the socket is actually bound\n * to, even when it is not an enumerated interface address (loopback, tun,\n * VPN, ...). If the bind fails, the family has no UDP host candidate.\n * A family left unspecified while the other one is set gathers no\n * enumerated addresses (only its `iceAdditionalHostAddresses`).\n *\n * When unset, each enumerated interface address gets a UDP host socket\n * bound to that address, so connectivity checks leave from the advertised\n * candidate on multi-NIC hosts. An address whose bind fails is not\n * advertised. VPN / tunnel interfaces (`tun`, `utun`, `ipsec`, `tap`) are\n * gathered with a low priority and the default-route address with the\n * highest: the source address of the route to the configured STUN / TURN\n * server (without one, no address is preferred and nothing else is probed).\n * With a STUN server, one more socket per family is bound to the\n * wildcard address: it advertises no host candidate but maps the route the\n * OS picks (server-reflexive candidate with `raddr 0.0.0.0`).\n * `setLocalDescription()` waits only for that socket and the\n * default-route one; the other interfaces' server-reflexive candidates\n * trickle through `onicecandidate` before the end-of-candidates `null`.\n * Set a family to `0.0.0.0` / `::` to gather its enumerated addresses over\n * wildcard sockets instead.\n */\n iceInterfaceAddresses: InterfaceAddresses | undefined;\n /** Add additional host (local) addresses to use for candidate gathering.\n * Notably, you can include hosts that are normally excluded, such as loopback, vmnet / veth interfaces, etc.\n * For a family bound by `iceInterfaceAddresses`, addresses other than the bound one are ignored.\n * An address assigned to a local interface is bound like an enumerated one; any other address\n * (a 1:1 NAT public address, for example) is gathered over a wildcard socket.\n */\n iceAdditionalHostAddresses: string[] | undefined;\n iceUseIpv4: boolean;\n iceUseIpv6: boolean;\n iceUseTcp: boolean;\n /** Gather passive (listening) TCP host candidates. Defaults to true. */\n iceTcpPassive: boolean;\n /**\n * Seconds to wait for server-reflexive candidates while gathering.\n * Defaults to 5 when undefined. `setLocalDescription()` waits for it only\n * on the wildcard and default-route sockets (see `iceInterfaceAddresses`).\n */\n iceStunGatherTimeout: number | undefined;\n /**\n * Seconds to wait for a TURN TCP/TLS connection to be established.\n * Defaults to 8 when undefined.\n */\n iceTurnConnectTimeout: number | undefined;\n /**\n * Seconds ICE waits for a connectivity check from the peer when it has no\n * candidate pair of its own to check after both sides ended their\n * candidates (the peer offered only active TCP candidates, as Firefox does\n * for ICE-TCP, or none werift can reach). Without a check in that time the\n * ICE transport fails. With `iceLite`, which sends no checks, ICE waits the\n * same time whenever it has no candidate pair, also while it still\n * gathers. The deadline is fixed when the wait begins; once gathering ended\n * without a socket that could receive a check, ICE fails at once. Defaults\n * to 30 when undefined; 0 fails at once.\n */\n iceIncomingCheckTimeout: number | undefined;\n /**\n * werift extension. With `iceNomination: \"regular\"`: milliseconds the\n * controlling ICE agent keeps checking before it nominates a candidate pair,\n * so a higher-priority candidate trickled shortly after a lower-priority one\n * succeeded can still be selected. Maps to `IceOptions.nominationDelayMs`:\n * 300 when undefined, 0 nominates the first valid pair at once.\n */\n iceNominationDelayMs: number | undefined;\n /**\n * werift extension. How the controlling ICE agent nominates toward a full\n * ICE peer (`IceOptions.nomination`). `\"semi-aggressive\"` (default when\n * undefined, as Chrome): the first pair whose check succeeds is selected at\n * once and a higher-priority pair that succeeds later replaces it.\n * `\"regular\"`: RFC 8445 regular nomination, one nomination after\n * `iceNominationDelayMs`.\n */\n iceNomination: \"semi-aggressive\" | \"regular\" | undefined;\n /**\n * werift extension. Enable ICE renomination\n * (draft-thatcher-ice-renomination, as libwebrtc implements it): every\n * description advertises `a=ice-options:trickle renomination`. When the\n * remote description advertises `renomination` too, the controlling agent\n * nominates with the NOMINATION STUN attribute and an increasing value, so\n * a later, better pair reliably replaces the selection on both sides\n * (`IceOptions.renomination`). Chrome advertises it only when its SDP is\n * modified before `setLocalDescription`; as the controlled side it honours\n * the attribute regardless. Defaults to false.\n */\n iceRenomination: boolean;\n /**\n * werift extension. Thresholds of the failover of the selected candidate\n * pair without an ICE restart (with semi-aggressive nomination or\n * renomination): how soon a pair is unwritable (`unwritableMinChecks`,\n * `unwritableTimeout`) and how soon a selected pair that stopped receiving\n * moves to a backup (`receivingTimeout`, `receivingSwitchingDelay`). Maps\n * to `IceOptions.failover`; each unset or invalid value keeps its default\n * (libwebrtc's: 5 checks, 5000 ms, 2500 ms, 1000 ms).\n */\n iceFailover: IceFailoverOptions | undefined;\n turnTransport: \"udp\" | \"tcp\" | \"tls\" | undefined;\n turnTlsOptions: TlsConnectionOptions | undefined;\n /**\n * Preferred IP family of the TURN/UDP socket, applied only when the TURN\n * server is a hostname. Ignored for an IP literal server, whose own family\n * always selects the socket. Defaults to 4 when undefined.\n */\n turnUdpFamily: 4 | 6 | undefined;\n /** @deprecated Prefer turn URL transport parameters or turnTransport. */\n forceTurnTCP: boolean;\n /** such as google cloud run */\n iceUseLinkLocalAddress: boolean | undefined;\n /** If provided, is called on each STUN request.\n * Return `true` if a STUN response should be sent, false if it should be skipped. */\n iceFilterStunResponse:\n | ((message: Message, addr: Address, protocol: Protocol) => boolean)\n | undefined;\n iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;\n /**\n * Opt-in SPED (DTLS handshake embedded in ICE Binding).\n * Omit or false: ICE completes, then DTLS starts (current serial path).\n * true: this PeerConnection only overlaps ICE checks with DTLS 1.3 handshake.\n * Requires explicit DTLS 1.3 in `dtls.protocolVersions`\n * (`dtls.protocolVersions` defaults to empty / DTLS 1.2 only).\n * Cannot be combined with `dtls.helloRetryRequest: true`\n * (SPED uses ICE-authenticated address validation, not a DTLS cookie).\n * Both are validated by the constructor and `setConfiguration()`, which\n * throw synchronously and leave the configuration unchanged.\n */\n sped?: boolean;\n /**\n * WARP early outbound and encrypted-media buffering policy.\n * - `allowEarlyServerData` (default false): the DTLS server may send\n * application data / media before the SDP fingerprint is verified.\n * Requires {@link PeerConfig.sped} `true` and DTLS 1.3; the constructor\n * and `setConfiguration()` throw synchronously otherwise.\n * - `earlyMediaPolicy` (default `\"drop\"`): `\"buffer\"` retains inbound\n * encrypted media received before authentication (bounded) instead of\n * dropping it. Inbound data is never delivered before authentication.\n * - `sendBeforeNomination` (default false): once the DTLS handshake is\n * done on this side (the DTLS client right after its Finished) and the\n * peer is authenticated, send application data and media on a valid\n * candidate pair (its own connectivity check succeeded) instead of\n * waiting for ICE nomination and consent (RFC 8445 §12.1, SPED\n * draft-00 §3.1.2.2). Applies only until a selected pair exists; never\n * during an ICE restart or on relay pairs. A peer that drops data\n * arriving before its own nomination only loses it like any packet loss\n * (SCTP retransmits). Requires {@link PeerConfig.sped} `true`; the\n * constructor and `setConfiguration()` throw synchronously otherwise.\n * `setConfiguration()` merges these fields and applies them to every open\n * DTLS transport, including ones a pending description prepared.\n */\n warp?: {\n allowEarlyServerData?: boolean;\n earlyMediaPolicy?: \"drop\" | \"buffer\";\n sendBeforeNomination?: boolean;\n };\n /**\n * Integrity attributes of the ICE connectivity checks and consent requests\n * werift sends (RFC 8489 short-term credentials). Applies to ICE transports\n * created after it is set.\n * - `undefined` / `\"sha1\"` (default): MESSAGE-INTEGRITY only. Browsers\n * (libwebrtc, Firefox) accept this.\n * - `\"sha256\"`: MESSAGE-INTEGRITY-SHA256 only. Only for peers known to\n * support it: a peer that does not know the attribute rejects the checks.\n * - `\"both\"`: MESSAGE-INTEGRITY followed by MESSAGE-INTEGRITY-SHA256.\n *\n * Checks and responses from the peer are accepted with either algorithm,\n * and responses are always signed with the algorithm of the request.\n */\n iceMessageIntegrity: MessageIntegrityMode | undefined;\n /**\n * Advertise the `ice2` ice-option (`a=ice-options:trickle ice2`, RFC 8445\n * §10 / RFC 8839) to declare an RFC 8445 agent. Defaults to false\n * (`a=ice-options:trickle`). It is only a declaration: werift runs the\n * RFC 8445 procedures either way. Cannot be changed after construction.\n */\n iceOptionIce2: boolean;\n dtls: Partial<{\n keys: DtlsKeys;\n /**\n * DTLS protocol versions in preference order.\n * Unspecified / empty keeps DTLS 1.2 only. DTLS 1.3 requires explicit opt-in.\n * Independent of {@link PeerConfig.sped} (SPED also requires DTLS 1.3; validated by the constructor / setConfiguration()).\n */\n protocolVersions: readonly DtlsVersion[];\n /**\n * DTLS 1.3 HelloRetryRequest cookie exchange.\n * Default false: ICE-authenticated path omits cookie HRR and saves 1 RTT.\n * true: send a cookie-bearing HRR (mapped internally to addressValidation: \"dtls-cookie\").\n * Group-only HRR for key_share correction is independent of this option.\n * Cannot be combined with {@link PeerConfig.sped} `true`.\n */\n helloRetryRequest?: boolean;\n }>;\n icePasswordPrefix: string | undefined;\n bundlePolicy: BundlePolicy;\n rtcpMuxPolicy: \"require\";\n iceCandidatePoolSize: number;\n certificates: RTCCertificate[];\n /**\n * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given\n * (see {@link CompatibilityOptionValues}). Cannot be changed after construction.\n * - `\"process\"` (default): one certificate shared by every RTCPeerConnection in the process,\n * so their `a=fingerprint` values are identical.\n * - `\"standard\"`: each RTCPeerConnection generates its own certificate, as browsers do.\n * All DTLS transports of that connection share it.\n *\n * Also accepts the v0.27.0 name `\"peerConnection\"` (= `\"standard\"`).\n */\n certificateScope: CertificateScope;\n debug: DebugConfig;\n midSuffix: boolean;\n /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */\n maxMessageSize: number;\n /**\n * The initial `binaryType` of every data channel this connection creates,\n * by `createDataChannel()` or announced by the remote peer (a compatibility\n * option, see {@link CompatibilityOptionValues} and\n * {@link RTCDataChannelBinaryType}).\n * - `\"nodebuffer\"` (default, werift's own value): binary messages arrive as\n * a Node.js `Buffer`, as before this option existed.\n * - `\"standard\"`: the browser default, `\"arraybuffer\"` (W3C); the channel's\n * `binaryType` reads `\"arraybuffer\"`.\n * - `\"arraybuffer\"` / `\"blob\"`: binary messages arrive as an `ArrayBuffer`\n * / a `Blob` (`werift/polyfill` uses `\"arraybuffer\"`).\n *\n * Another value is a `TypeError`. `compatibility: \"standard\"` sets it to\n * `\"standard\"` when it is not given. `setConfiguration()` may change it; the\n * new value applies to channels created afterwards, and an existing\n * channel changes with its own `binaryType` setter.\n * @see tests/datachannel/binaryType.test.ts \"dataChannelBinaryType: standard gives channels the W3C default arraybuffer\"\n */\n dataChannelBinaryType: DataChannelBinaryTypeOption;\n /**\n * When true, padding-only RTP is omitted from onReceiveRtp and later media\n * sequence numbers are compacted. Default false preserves wire RTP events.\n */\n filterProbePaddingOnReceiveRtp: boolean;\n /** Send-side estimator used by each new sender; defaults to `\"lightweight\"`. */\n bandwidthEstimator: BandwidthEstimatorOption;\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. */\n sctp: { mtu: number };\n /**\n * Queue outbound RTP on each sender until DTLS is connected.\n * Disabled by default. Pass `true` or `{ enabled: true, maxLength }` to buffer.\n */\n pendingRtp: NonNullable<RTCRtpSenderOptions[\"pendingRtp\"]>;\n /**\n * How local SDP marks inactive / stopped m-lines (see {@link CompatibilityOptionValues}).\n * Cannot be changed after construction.\n * - `\"standard\"` (default): an accepted `inactive` m-line keeps a non-zero port, as JSEP\n * and browsers do. Only rejected (no common codec / remote port 0) or stopped m-lines\n * use port 0, and only those negotiated port 0 positions are reused by new transceivers.\n * - `\"aggressive\"`: behavior before v0.25.0. `inactive` m-lines are also written with\n * port 0, so the remote side treats them as rejected and their positions are reused.\n *\n * Also accepts the v0.27.0 name `\"compatible\"` (= `\"standard\"`).\n */\n mLineReuse: MLineReuse;\n /**\n * How a remote offer's m-sections are paired with local transceivers that\n * have no MID yet (see {@link CompatibilityOptionValues}). Cannot be changed\n * after construction.\n * - `\"byKind\"` (default): behavior up to v0.27.0. Any unassociated,\n * non-stopped transceiver of the same kind is paired (the one at the same\n * m-line index first), whatever created it. In glare (perfect negotiation)\n * the remote offer can take over a transceiver created with\n * `addTransceiver(kind, { direction: \"sendonly\" })` and its direction\n * becomes `sendrecv`.\n * - `\"standard\"`: RFC 8829 (JSEP) section 5.10, as browsers do. An\n * m-section whose MID no transceiver has is associated only with an\n * unassociated, non-stopped transceiver of the same kind that\n * `addTrack()` created (or one a rollback promoted to that, JSEP 4.1.8.2),\n * and only when the m-section is `sendrecv` or `recvonly`. A transceiver\n * created by `addTransceiver()` (with or without a track, also after\n * `replaceTrack()` or a later `addTrack()` reusing it) is never paired:\n * the offer gets a new transceiver, and the local one keeps its direction\n * and `mid === null` until a local offer negotiates it. Use it for the\n * perfect negotiation pattern and for code written for browsers.\n */\n transceiverPairing: TransceiverPairing;\n /**\n * Where a PLI / FIR goes when no route has its target SSRC (see\n * {@link CompatibilityOptionValues} and {@link KeyFrameRequestRouting}).\n * `setConfiguration()` may change it.\n * - `\"fallback\"` (default): the sender whose RTX SSRC it is, else the only video sender.\n * - `\"standard\"`: not delivered, as RFC 4585 / RFC 5104 define the target.\n *\n * Also accepts the names up to v0.27.0: `\"compatible\"` (= `\"fallback\"`) and\n * `\"strict\"` (= `\"standard\"`).\n */\n keyFrameRequestRouting: KeyFrameRequestRouting;\n /**\n * How strictly the DTLS 1.2 handshake validates the peer's messages (see\n * {@link CompatibilityOptionValues}). Cannot be changed after construction.\n * - `\"lenient\"` (default): a malformed `supported_versions` is ignored and\n * DTLS 1.2 negotiated, duplicate extensions are accepted and `use_srtp`\n * is read without length checks, as before the strict checks.\n * - `\"standard\"`: RFC-strict; these fail the handshake (a malformed\n * `supported_versions` with a `protocol_version` alert).\n *\n * A `supported_versions` without an overlapping version fails either way,\n * and DTLS 1.3 always validates strictly.\n */\n dtlsHandshakeValidation: DtlsHandshakeValidation;\n /**\n * Which m-lines of a BUNDLE group carry the local ICE candidates.\n * Cannot be changed after construction. See {@link BundleCandidates}.\n * - `\"legacy\"` (default): every m-line repeats its transport's candidates and\n * `a=end-of-candidates` (werift's earlier output).\n * - `\"compatible\"`: as Chrome writes them, only the BUNDLE tag m-line carries\n * them, so renegotiation with more m-lines no longer repeats the candidate list.\n */\n bundleCandidates: BundleCandidates;\n /**\n * Sets every compatibility option (`certificateScope`, `mLineReuse`,\n * `transceiverPairing`, `keyFrameRequestRouting`,\n * `dtlsHandshakeValidation`, `dataChannelBinaryType`, see\n * {@link CompatibilityOptionValues}) to the specification / browser behavior\n * at once. Cannot be changed after construction.\n * - `undefined` (default): each option keeps its own default.\n * - `\"standard\"`: every compatibility option not given in the same\n * configuration is `\"standard\"`.\n *\n * An option given explicitly always takes precedence over `compatibility`:\n * a value given in the same configuration (an old name included) is kept,\n * and `setConfiguration()` treats the options as if `compatibility` were\n * not set (`keyFrameRequestRouting` and `dataChannelBinaryType` may\n * change, the others cannot). An\n * option given as `undefined` counts as not given.\n *\n * ```ts\n * new RTCPeerConnection({ compatibility: \"standard\" });\n * // certificateScope, mLineReuse, transceiverPairing,\n * // keyFrameRequestRouting, dtlsHandshakeValidation and\n * // dataChannelBinaryType are all \"standard\"\n * new RTCPeerConnection({ compatibility: \"standard\", certificateScope: \"process\" });\n * // certificateScope is \"process\", the others are \"standard\"\n * ```\n *\n * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not\n * compatibility options.\n * @see tests/datachannel/binaryType.test.ts \"compatibility: standard makes data channels deliver ArrayBuffer unless dataChannelBinaryType is given\"\n */\n compatibility: CompatibilityPreset | undefined;\n}\n\n/** Which default DTLS certificate is used. See {@link PeerConfig.certificateScope}. */\nexport type CertificateScope = CompatibilityOptionValue<\"certificateScope\">;\nexport const CertificateScopeModes: readonly CertificateScope[] =\n CompatibilityOptionValues.certificateScope;\n\n/** How local SDP marks inactive / stopped m-lines. See {@link PeerConfig.mLineReuse}. */\nexport const MLineReuseModes: readonly MLineReuse[] =\n CompatibilityOptionValues.mLineReuse;\n\n/** How a remote offer pairs m-sections with local transceivers. See {@link PeerConfig.transceiverPairing}. */\nexport type TransceiverPairing = CompatibilityOptionValue<\"transceiverPairing\">;\nexport const TransceiverPairingModes: readonly TransceiverPairing[] =\n CompatibilityOptionValues.transceiverPairing;\n\n/** How strictly the DTLS 1.2 handshake validates the peer. See {@link PeerConfig.dtlsHandshakeValidation}. */\nexport type DtlsHandshakeValidation =\n CompatibilityOptionValue<\"dtlsHandshakeValidation\">;\nexport const DtlsHandshakeValidationModes: readonly DtlsHandshakeValidation[] =\n CompatibilityOptionValues.dtlsHandshakeValidation;\n\n/** The initial `binaryType` of new data channels. See {@link PeerConfig.dataChannelBinaryType}. */\nexport type DataChannelBinaryTypeOption =\n CompatibilityOptionValue<\"dataChannelBinaryType\">;\nexport const DataChannelBinaryTypeModes: readonly DataChannelBinaryTypeOption[] =\n CompatibilityOptionValues.dataChannelBinaryType;\n\n/**\n * @internal\n * The `binaryType` a {@link PeerConfig.dataChannelBinaryType} gives a new\n * channel: `\"standard\"` is the W3C default `\"arraybuffer\"`.\n */\nexport function resolveDataChannelBinaryType(\n option: DataChannelBinaryTypeOption,\n): RTCDataChannelBinaryType {\n return option === \"standard\" ? \"arraybuffer\" : option;\n}\n\n/** The compatibility options `setConfiguration()` may change. */\nconst CHANGEABLE_COMPATIBILITY_OPTIONS: readonly CompatibilityOption[] = [\n // the router uses the new value from the next request\n \"keyFrameRequestRouting\",\n // channels created afterwards take the new value\n \"dataChannelBinaryType\",\n];\n\n/** The values of {@link PeerConfig.compatibility}. */\nexport type CompatibilityPreset = \"standard\";\nexport const CompatibilityPresets: readonly CompatibilityPreset[] = [\n \"standard\",\n];\n\nconst COMPATIBILITY_OPTIONS = Object.keys(\n CompatibilityOptionValues,\n) as CompatibilityOption[];\n\n/**\n * The values the compatibility options used up to v0.27.0 that are not\n * values any more, and the value each one is read as. They are accepted on\n * input only: `getConfiguration()` returns the current name.\n */\nexport const DeprecatedCompatibilityValues = {\n certificateScope: { peerConnection: \"standard\" },\n mLineReuse: { compatible: \"standard\" },\n keyFrameRequestRouting: { compatible: \"fallback\", strict: \"standard\" },\n} as const satisfies {\n [K in CompatibilityOption]?: Readonly<\n Record<string, CompatibilityOptionValue<K>>\n >;\n};\n\n/** @deprecated Use `\"standard\"` (`\"peerConnection\"`). */\nexport type DeprecatedCertificateScope =\n keyof (typeof DeprecatedCompatibilityValues)[\"certificateScope\"];\n/** @deprecated Use `\"standard\"` (`\"compatible\"`). */\nexport type DeprecatedMLineReuse =\n keyof (typeof DeprecatedCompatibilityValues)[\"mLineReuse\"];\n/** @deprecated Use `\"fallback\"` (`\"compatible\"`) or `\"standard\"` (`\"strict\"`). */\nexport type DeprecatedKeyFrameRequestRouting =\n keyof (typeof DeprecatedCompatibilityValues)[\"keyFrameRequestRouting\"];\n\nconst MessageIntegrityModes: readonly MessageIntegrityMode[] = [\n \"sha1\",\n \"sha256\",\n \"both\",\n];\n\nexport const findCodecByMimeType = (\n codecs: RTCRtpCodecParameters[],\n target: RTCRtpCodecParameters,\n) =>\n codecs.find(\n (localCodec) =>\n normalizeCodecMimeType(localCodec.mimeType) ===\n normalizeCodecMimeType(target.mimeType),\n )\n ? target\n : undefined;\n\nfunction assignDynamicPayloadTypes(config: PeerConfig) {\n for (const [i, codecParams] of enumerate([\n ...(config.codecs.audio || []),\n ...(config.codecs.video || []),\n ])) {\n if (codecParams.payloadType != undefined) {\n continue;\n }\n\n codecParams.payloadType = 96 + i;\n switch (codecParams.name.toLowerCase()) {\n case \"rtx\":\n {\n codecParams.parameters = `apt=${codecParams.payloadType - 1}`;\n }\n break;\n case \"red\":\n {\n if (codecParams.contentType === \"audio\") {\n const redundant = codecParams.payloadType + 1;\n codecParams.parameters = `${redundant}/${redundant}`;\n codecParams.payloadType = 63;\n }\n }\n break;\n }\n }\n}\n\nexport type RTCIceServer = {\n urls: string | string[];\n username?: string;\n credential?: string;\n};\n\nexport type RTCBundlePolicy = \"balanced\" | \"max-compat\" | \"max-bundle\";\nexport type RTCRtcpMuxPolicy = \"require\";\n\nexport interface RTCSctpConfiguration {\n /** SCTP outbound packet MTU used for DATA chunk fragmentation. Defaults to 1191. */\n mtu?: number;\n}\n\nexport interface RTCConfiguration {\n iceServers?: RTCIceServer[];\n iceTransportPolicy?: PeerConfig[\"iceTransportPolicy\"];\n bundlePolicy?: RTCBundlePolicy;\n rtcpMuxPolicy?: RTCRtcpMuxPolicy;\n iceCandidatePoolSize?: number;\n certificates?: RTCCertificate[];\n}\n\ntype RTCPeerConnectionRTCConfiguration = Omit<\n RTCConfiguration,\n \"bundlePolicy\"\n> & {\n bundlePolicy?: PeerConfig[\"bundlePolicy\"] | RTCBundlePolicy;\n};\n\nexport type RTCPeerConnectionConfig = Partial<\n Omit<\n PeerConfig,\n | \"bundlePolicy\"\n | \"rtcpMuxPolicy\"\n | \"iceCandidatePoolSize\"\n | \"certificates\"\n | \"sctp\"\n | \"certificateScope\"\n | \"mLineReuse\"\n | \"keyFrameRequestRouting\"\n >\n> &\n RTCPeerConnectionRTCConfiguration & {\n sctp?: RTCSctpConfiguration;\n /** See {@link PeerConfig.certificateScope}. */\n certificateScope?: CertificateScope | DeprecatedCertificateScope;\n /** See {@link PeerConfig.mLineReuse}. */\n mLineReuse?: MLineReuse | DeprecatedMLineReuse;\n /** See {@link PeerConfig.keyFrameRequestRouting}. */\n keyFrameRequestRouting?:\n | KeyFrameRequestRouting\n | DeprecatedKeyFrameRequestRouting;\n };\n\nexport function peerConfigHasDtls13(config: PeerConfig): boolean {\n const versions = config.dtls.protocolVersions;\n if (!versions || versions.length === 0) {\n return false;\n }\n return versions.some((version) => version === \"1.3\");\n}\n\nexport function generateDefaultPeerConfig(): Required<PeerConfig> {\n return {\n codecs: defaultCodecs(),\n headerExtensions: {\n audio: [],\n video: [],\n },\n iceTransportPolicy: \"all\",\n iceLite: false,\n iceServers: [{ urls: \"stun:stun.l.google.com:19302\" }],\n iceUseDefaultStunServer: true,\n icePortRange: undefined,\n iceInterfaceAddresses: undefined,\n iceAdditionalHostAddresses: undefined,\n iceUseIpv4: true,\n iceUseIpv6: true,\n iceUseTcp: false,\n iceTcpPassive: true,\n iceStunGatherTimeout: undefined,\n iceTurnConnectTimeout: undefined,\n iceIncomingCheckTimeout: undefined,\n iceNominationDelayMs: undefined,\n iceNomination: undefined,\n iceRenomination: false,\n iceFailover: undefined,\n turnTransport: undefined,\n turnTlsOptions: undefined,\n turnUdpFamily: undefined,\n iceFilterStunResponse: undefined,\n iceFilterCandidatePair: undefined,\n iceMessageIntegrity: undefined,\n iceOptionIce2: false,\n icePasswordPrefix: undefined,\n iceUseLinkLocalAddress: undefined,\n dtls: {},\n sped: false,\n warp: {\n allowEarlyServerData: false,\n earlyMediaPolicy: \"drop\",\n sendBeforeNomination: false,\n },\n bundlePolicy: \"max-compat\",\n rtcpMuxPolicy: \"require\",\n iceCandidatePoolSize: 0,\n certificates: [],\n certificateScope: \"process\",\n debug: {},\n midSuffix: false,\n forceTurnTCP: false,\n maxMessageSize: DEFAULT_MAX_MESSAGE_SIZE,\n dataChannelBinaryType: \"nodebuffer\",\n filterProbePaddingOnReceiveRtp: false,\n bandwidthEstimator: \"lightweight\",\n sctp: { mtu: DEFAULT_SCTP_MTU },\n pendingRtp: false,\n mLineReuse: \"standard\",\n transceiverPairing: \"byKind\",\n keyFrameRequestRouting: \"fallback\",\n dtlsHandshakeValidation: \"lenient\",\n bundleCandidates: \"legacy\",\n compatibility: undefined,\n };\n}\nexport const defaultPeerConfig: PeerConfig = generateDefaultPeerConfig();\n\nfunction normalizePeerConfiguration(\n config: RTCPeerConnectionConfig,\n): Partial<PeerConfig> & { sctp?: RTCSctpConfiguration } {\n const input = Object(config ?? {}) as RTCPeerConnectionConfig;\n const normalizedConfig = { ...input } as Partial<PeerConfig> & {\n sctp?: RTCSctpConfiguration;\n };\n\n if (input.sctp !== undefined) {\n normalizedConfig.sctp = { ...input.sctp } as PeerConfig[\"sctp\"];\n }\n\n if (input.bundlePolicy === \"balanced\") {\n normalizedConfig.bundlePolicy = \"max-compat\";\n }\n\n for (const option of COMPATIBILITY_OPTIONS) {\n const value: unknown = input[option];\n if (option in DeprecatedCompatibilityValues && typeof value === \"string\") {\n const aliases: Readonly<Record<string, string>> =\n DeprecatedCompatibilityValues[\n option as keyof typeof DeprecatedCompatibilityValues\n ];\n if (Object.hasOwn(aliases, value)) {\n (normalizedConfig as Record<string, unknown>)[option] = aliases[value];\n }\n }\n }\n\n if (\"certificates\" in input) {\n if (input.certificates === undefined) {\n normalizedConfig.certificates = undefined;\n } else if (\n !Array.isArray(input.certificates) ||\n input.certificates.some((certificate) => certificate == null)\n ) {\n throw createWebRtcTypeError(\n \"certificates must be an array of RTCCertificate\",\n );\n } else {\n normalizedConfig.certificates = [...input.certificates];\n }\n }\n\n if (\"iceCandidatePoolSize\" in input) {\n normalizedConfig.iceCandidatePoolSize = coerceUnsignedShort(\n input.iceCandidatePoolSize,\n \"iceCandidatePoolSize\",\n );\n }\n\n if (\"sped\" in input) {\n normalizedConfig.sped = input.sped === true;\n }\n\n if (\"warp\" in input) {\n if (\n input.warp?.earlyMediaPolicy !== undefined &&\n input.warp.earlyMediaPolicy !== \"drop\" &&\n input.warp.earlyMediaPolicy !== \"buffer\"\n ) {\n throw createWebRtcTypeError(\n 'warp.earlyMediaPolicy must be \"drop\" or \"buffer\"',\n );\n }\n normalizedConfig.warp = input.warp ? { ...input.warp } : {};\n }\n\n return normalizedConfig;\n}\n\nfunction dtlsProtocolVersionsKey(versions: readonly DtlsVersion[] | undefined) {\n return (versions ?? []).join(\",\");\n}\n\nfunction coerceUnsignedShort(value: unknown, name: string) {\n const coerced = Number(value);\n if (\n !Number.isFinite(coerced) ||\n !Number.isInteger(coerced) ||\n coerced < 0 ||\n coerced > 65535\n ) {\n throw createWebRtcTypeError(`${name} must be an unsigned short`);\n }\n return coerced;\n}\n\nfunction hasSameCertificates(left: RTCCertificate[], right: RTCCertificate[]) {\n return (\n left.length === right.length &&\n left.every((certificate, index) => certificate === right[index])\n );\n}\n\nexport function clonePeerConfiguration(config: PeerConfig) {\n return {\n ...config,\n codecs: {\n audio: config.codecs.audio ? [...config.codecs.audio] : undefined,\n video: config.codecs.video ? [...config.codecs.video] : undefined,\n },\n headerExtensions: {\n audio: config.headerExtensions.audio\n ? [...config.headerExtensions.audio]\n : undefined,\n video: config.headerExtensions.video\n ? [...config.headerExtensions.video]\n : undefined,\n },\n iceServers: config.iceServers.map((server) => ({\n ...server,\n urls: Array.isArray(server.urls) ? [...server.urls] : server.urls,\n })),\n icePortRange: config.icePortRange\n ? ([...config.icePortRange] as [number, number])\n : undefined,\n iceAdditionalHostAddresses: config.iceAdditionalHostAddresses\n ? [...config.iceAdditionalHostAddresses]\n : undefined,\n dtls: {\n ...config.dtls,\n protocolVersions: config.dtls.protocolVersions\n ? [...config.dtls.protocolVersions]\n : undefined,\n helloRetryRequest: config.dtls.helloRetryRequest,\n },\n warp: config.warp ? { ...config.warp } : undefined,\n certificates: [...config.certificates],\n debug: { ...config.debug },\n sctp: { ...config.sctp },\n pendingRtp:\n typeof config.pendingRtp === \"object\" && config.pendingRtp != undefined\n ? { ...config.pendingRtp }\n : config.pendingRtp,\n };\n}\n\n/**\n * `setConfiguration`: validate `input` against the current `config`, then\n * merge it in place. Returns the normalized input; side effects on live\n * transports (SCTP limits, ICE servers) stay with the caller.\n */\nconst CLEARABLE_TURN_KEYS = [\n \"turnTransport\",\n \"turnTlsOptions\",\n \"turnUdpFamily\",\n] as const;\n\nexport function mergePeerConfiguration(\n config: PeerConfig,\n input: RTCPeerConnectionConfig,\n {\n isReconfiguration,\n hasLocalDescription,\n hasSctpTransport,\n dtlsTransportCreated,\n }: {\n isReconfiguration: boolean;\n hasLocalDescription: boolean;\n hasSctpTransport: boolean;\n dtlsTransportCreated: boolean;\n },\n) {\n const normalizedConfig = normalizePeerConfiguration(input);\n if (normalizedConfig.warp !== undefined) {\n normalizedConfig.warp = { ...config.warp, ...normalizedConfig.warp };\n }\n\n if (\n normalizedConfig.rtcpMuxPolicy &&\n normalizedConfig.rtcpMuxPolicy !== \"require\"\n ) {\n throw new Error(\"rtcpMuxPolicy must be require\");\n }\n\n if (\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n (!Number.isInteger(normalizedConfig.iceCandidatePoolSize) ||\n normalizedConfig.iceCandidatePoolSize < 0)\n ) {\n throw new Error(\"iceCandidatePoolSize must be a non-negative integer\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundlePolicy !== undefined &&\n normalizedConfig.bundlePolicy !== config.bundlePolicy\n ) {\n throw new Error(\"bundlePolicy cannot be changed\");\n }\n\n if (\n normalizedConfig.compatibility !== undefined &&\n !CompatibilityPresets.includes(normalizedConfig.compatibility)\n ) {\n throw createWebRtcTypeError(\n `compatibility must be one of ${CompatibilityPresets.join(\", \")}`,\n );\n }\n if (isReconfiguration) {\n if (\n normalizedConfig.compatibility !== undefined &&\n normalizedConfig.compatibility !== config.compatibility\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"compatibility cannot be changed\",\n );\n }\n } else if (normalizedConfig.compatibility === \"standard\") {\n // 構築時だけ、明示されていない互換性オプションを standard にする。\n // 明示された値は常に compatibility より優先する (PeerConfig.compatibility)\n for (const option of COMPATIBILITY_OPTIONS) {\n if (normalizedConfig[option] === undefined) {\n (normalizedConfig as Record<string, unknown>)[option] = \"standard\";\n }\n }\n }\n\n for (const option of COMPATIBILITY_OPTIONS) {\n const value = normalizedConfig[option];\n if (value === undefined) continue;\n const values: readonly string[] = CompatibilityOptionValues[option];\n if (!values.includes(value)) {\n throw createWebRtcTypeError(\n `${option} must be one of ${values.join(\", \")}`,\n );\n }\n if (\n isReconfiguration &&\n !CHANGEABLE_COMPATIBILITY_OPTIONS.includes(option) &&\n value !== config[option]\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n `${option} cannot be changed`,\n );\n }\n }\n\n if (\n normalizedConfig.bundleCandidates !== undefined &&\n !BundleCandidatesModes.includes(normalizedConfig.bundleCandidates)\n ) {\n throw createWebRtcTypeError(\n `bundleCandidates must be one of ${BundleCandidatesModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.bundleCandidates !== undefined &&\n normalizedConfig.bundleCandidates !== config.bundleCandidates\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"bundleCandidates cannot be changed\",\n );\n }\n\n if (\n normalizedConfig.iceMessageIntegrity !== undefined &&\n !MessageIntegrityModes.includes(normalizedConfig.iceMessageIntegrity)\n ) {\n throw createWebRtcTypeError(\n `iceMessageIntegrity must be one of ${MessageIntegrityModes.join(\", \")}`,\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceOptionIce2 !== undefined &&\n normalizedConfig.iceOptionIce2 !== config.iceOptionIce2\n ) {\n throw createWebRtcDomException(\n \"InvalidModificationError\",\n \"iceOptionIce2 cannot be changed\",\n );\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.rtcpMuxPolicy !== undefined &&\n normalizedConfig.rtcpMuxPolicy !== config.rtcpMuxPolicy\n ) {\n throw new Error(\"rtcpMuxPolicy cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.certificates !== undefined &&\n !hasSameCertificates(normalizedConfig.certificates, config.certificates)\n ) {\n throw new Error(\"certificates cannot be changed\");\n }\n\n if (\n isReconfiguration &&\n normalizedConfig.iceCandidatePoolSize !== undefined &&\n hasLocalDescription &&\n normalizedConfig.iceCandidatePoolSize !== config.iceCandidatePoolSize\n ) {\n throw new Error(\n \"iceCandidatePoolSize cannot be changed after setLocalDescription\",\n );\n }\n\n if ((normalizedConfig.iceCandidatePoolSize ?? 0) > 0) {\n throw new Error(\"iceCandidatePoolSize > 0 is not supported\");\n }\n\n // deepMerge skips undefined source values. Nested dtls must use the same\n // contract so `{ protocolVersions: undefined }` cannot drop DTLS 1.3.\n const nextDtls = { ...config.dtls };\n if (normalizedConfig.dtls !== undefined) {\n deepMerge(nextDtls, normalizedConfig.dtls);\n normalizedConfig.dtls = nextDtls;\n }\n const nextWarp = { ...config.warp, ...normalizedConfig.warp };\n const nextSped = normalizedConfig.sped ?? config.sped;\n const nextHasDtls13 = (nextDtls.protocolVersions ?? []).some(\n (version) => String(version) === \"1.3\",\n );\n if (nextSped === true && !nextHasDtls13) {\n throw new Error(\n \"PeerConfig.sped requires DTLS 1.3 in dtls.protocolVersions\",\n );\n }\n if (nextSped === true && nextDtls.helloRetryRequest) {\n throw new Error(\n \"PeerConfig.sped cannot be combined with dtls.helloRetryRequest\",\n );\n }\n if (\n nextWarp.allowEarlyServerData === true &&\n (nextSped !== true || !nextHasDtls13)\n ) {\n throw new Error(\n \"warp.allowEarlyServerData requires PeerConfig.sped and DTLS 1.3\",\n );\n }\n if (nextWarp.sendBeforeNomination === true && nextSped !== true) {\n throw new Error(\"warp.sendBeforeNomination requires PeerConfig.sped\");\n }\n\n if (dtlsTransportCreated) {\n if (\"sped\" in normalizedConfig && normalizedConfig.sped !== config.sped) {\n throw new Error(\n \"sped cannot be changed after a DTLS transport is created\",\n );\n }\n if (\n dtlsProtocolVersionsKey(nextDtls.protocolVersions) !==\n dtlsProtocolVersionsKey(config.dtls.protocolVersions)\n ) {\n throw new Error(\n \"dtls.protocolVersions cannot be changed after a DTLS transport is created\",\n );\n }\n if (\n Boolean(nextDtls.helloRetryRequest) !==\n Boolean(config.dtls.helloRetryRequest)\n ) {\n throw new Error(\n \"dtls.helloRetryRequest cannot be changed after a DTLS transport is created\",\n );\n }\n }\n\n if (normalizedConfig.sctp !== undefined) {\n const requestedSctpMtu = normalizedConfig.sctp.mtu ?? DEFAULT_SCTP_MTU;\n validateSctpMtu(requestedSctpMtu);\n if (hasSctpTransport && requestedSctpMtu !== config.sctp.mtu) {\n throw new Error(\n \"sctp.mtu cannot be changed after SCTP transport creation\",\n );\n }\n }\n\n deepMerge(config, normalizedConfig as Partial<PeerConfig>);\n // Omitted keys keep their value, but an explicit `undefined` unsets these\n // optional TURN settings (deepMerge skips undefined).\n for (const key of CLEARABLE_TURN_KEYS) {\n if (Object.hasOwn(normalizedConfig, key) && normalizedConfig[key] == null) {\n // Union-key writes require the intersection of all indexed property\n // types. Narrow the key so each optional setting can be cleared safely.\n switch (key) {\n case \"turnTransport\":\n config.turnTransport = undefined;\n break;\n case \"turnTlsOptions\":\n config.turnTlsOptions = undefined;\n break;\n case \"turnUdpFamily\":\n config.turnUdpFamily = undefined;\n break;\n }\n }\n }\n config.sctp = {\n mtu: config.sctp?.mtu ?? DEFAULT_SCTP_MTU,\n };\n\n if (config.icePortRange) {\n const [min, max] = config.icePortRange;\n if (min === max) throw new Error(\"should not be same value\");\n if (min >= max) throw new Error(\"The min must be less than max\");\n }\n\n if (!Number.isInteger(config.maxMessageSize) || config.maxMessageSize < 0) {\n throw new Error(\"maxMessageSize must be a non-negative integer\");\n }\n\n assignDynamicPayloadTypes(config);\n\n [\n ...(config.headerExtensions.audio || []),\n ...(config.headerExtensions.video || []),\n ].forEach((v, i) => {\n v.id = 1 + i;\n });\n\n return normalizedConfig;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { RTCDataChannel } from "../dataChannel";
2
2
  import type { MediaStream, MediaStreamTrack, RTCRtpReceiver, RTCRtpTransceiver } from "../media";
3
- import type { RTCIceCandidate } from "../transport/ice";
3
+ import type { IceGatheringErrorDetails, RTCIceCandidate, RTCIceTransport } from "../transport/ice";
4
4
  import type { Callback, CallbackWithValue } from "../types/util";
5
5
  export declare class RTCTrackEvent {
6
6
  readonly type = "track";
@@ -91,6 +91,15 @@ export declare class RTCPeerConnectionIceErrorEvent extends Event {
91
91
  readonly errorText: string;
92
92
  constructor(type: string, init: RTCPeerConnectionIceErrorEventInit);
93
93
  }
94
+ /**
95
+ * A gathering error of one ICE transport (`RTCPeerConnection.onIceGatheringError`,
96
+ * a werift extension, not W3C): see {@link IceGatheringErrorDetails}.
97
+ * @see packages/webrtc/tests/transport/iceGatheringError.test.ts「without STUN / TURN: gathering completes with end-of-candidates and both reasons are reported」
98
+ */
99
+ export type RTCIceGatheringErrorEvent = IceGatheringErrorDetails & {
100
+ /** The transport whose gathering reported it. */
101
+ readonly iceTransport: RTCIceTransport;
102
+ };
94
103
  export interface RTCDataChannelEvent {
95
104
  type?: "datachannel";
96
105
  channel: RTCDataChannel;
@@ -1 +1 @@
1
- {"version":3,"file":"peerConnectionEvents.js","sourceRoot":"","sources":["../../../../src/api/peerConnectionEvents.ts"],"names":[],"mappings":";;;AAUA,wEAAwE;AAExE,MAAa,aAAa;IAOxB,YAAY,IAKX;QAXQ;;;;mBAAO,OAAO;WAAC;QACf;;;;;WAAwB;QACxB;;;;;WAAuB;QACvB;;;;;WAA+B;QAC/B;;;;;WAAyB;QAQhC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;CACF;AAlBD,sCAkBC;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,8BAA+B,SAAQ,KAAK;IAOvD,YAAY,IAAY,EAAE,IAAwC;QAChE,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI,EAAE,OAAO;YACtB,UAAU,EAAE,IAAI,EAAE,UAAU;YAC5B,QAAQ,EAAE,IAAI,EAAE,QAAQ;SACzB,CAAC,CAAC;QAXI;;;;;WAAuB;QACvB;;;;;WAAoB;QACpB;;;;;WAAY;QACZ;;;;;WAAkB;QAClB;;;;;WAAkB;QAQzB,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,SAAS,CACjB,uDAAuD,CACxD,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IACxC,CAAC;CACF;AAxBD,wEAwBC","sourcesContent":["import type { RTCDataChannel } from \"../dataChannel\";\nimport type {\n MediaStream,\n MediaStreamTrack,\n RTCRtpReceiver,\n RTCRtpTransceiver,\n} from \"../media\";\nimport type { RTCIceCandidate } from \"../transport/ice\";\nimport type { Callback, CallbackWithValue } from \"../types/util\";\n\n// Events RTCPeerConnection dispatches and the `on*` handler attributes.\n\nexport class RTCTrackEvent {\n readonly type = \"track\";\n readonly track: MediaStreamTrack;\n readonly streams: MediaStream[];\n readonly transceiver: RTCRtpTransceiver;\n readonly receiver: RTCRtpReceiver;\n\n constructor(init: {\n track: MediaStreamTrack;\n streams: MediaStream[];\n transceiver: RTCRtpTransceiver;\n receiver: RTCRtpReceiver;\n }) {\n this.track = init.track;\n this.streams = [...init.streams];\n this.transceiver = init.transceiver;\n this.receiver = init.receiver;\n }\n}\n\n/** Members of {@link RTCPeerConnectionIceErrorEvent} (W3C RTCPeerConnectionIceErrorEventInit). */\nexport interface RTCPeerConnectionIceErrorEventInit {\n address?: string | null;\n port?: number | null;\n url?: string;\n errorCode: number;\n errorText?: string;\n /** Standard `EventInit` members. */\n bubbles?: boolean;\n cancelable?: boolean;\n composed?: boolean;\n}\n\n/**\n * `icecandidateerror` (W3C WebRTC §4.8.2): a configured STUN or TURN server\n * could not give a candidate while gathering. Never fired after `close()`.\n *\n * - A server that answered with an error response (300-699): fired at once,\n * once per local socket that asked it.\n * - 701 (server not reached, W3C: no host candidate could reach it): judged\n * once per gathering, when `iceGatheringState` leaves \"gathering\" (just\n * before that `icegatheringstatechange`), and fired once per URL that some\n * ICE transport of the gathering tried without reaching the server while\n * none reached it. Only transports still in use at that point count, with\n * the ICE generation they gathered in: one closed or discarded (rollback)\n * meanwhile, one that did not try the URL, and a generation an ICE restart\n * replaced do not count. The event carries the local address of the first\n * socket that failed (STUN). A new gathering (ICE restart, a new transport)\n * reports the URL again. A handler that closes the connection stops the\n * rest: no further 701 nor `icegatheringstatechange` is fired.\n *\n * While listeners run, `target` and `currentTarget` are the\n * `RTCPeerConnection` and `eventPhase` is 2 (`AT_TARGET`); afterwards\n * `currentTarget` is `null` and `eventPhase` 0. The event reaches\n * `pc.onIceCandidateError`, `onicecandidateerror` and the\n * `icecandidateerror` listeners in that order; `stopImmediatePropagation()`\n * stops the ones after the caller (also later `pc.onIceCandidateError`\n * subscribers), `stopPropagation()` does not (AT_TARGET). A listener\n * removed during the dispatch is not called, one added during it is not\n * called this time. The event is not cancelable (`preventDefault()` does\n * nothing) and, as fired by the connection, `isTrusted` is true. While a 701 is dispatched,\n * `iceGatheringState` still reads `\"gathering\"`.\n *\n * - `url`: the configured URL of the server, canonical: trimmed, lower-case\n * scheme, and `?transport=tcp` added to a `turns:` URL that names no\n * transport (`turns:h:5349` → `turns:h:5349?transport=tcp`, the Chrome /\n * WPT form). Several URLs naming one server each get their own event. The\n * built-in default STUN server (`iceUseDefaultStunServer`, used when no\n * STUN server is configured) is in no configuration; werift reports it\n * with the synthesized URL `stun:stun.l.google.com:19302`.\n * - `errorCode`: the STUN error code the server answered with (300-699),\n * or 701 when it was not reached (DNS, timeout, connect or socket error).\n * A server that answered without a STUN error code (an error response\n * without ERROR-CODE, a response failing MESSAGE-INTEGRITY, a success\n * without XOR-MAPPED-ADDRESS) was reached: it gives no event, and never\n * a 701.\n * - `errorText`: the reason phrase the server returned (W3C), with the\n * credential material werift knows replaced by `***` (the configured TURN\n * username and password, and the USERNAME / REALM / NONCE of the\n * response), control characters dropped and cut to 127 characters; the\n * registered phrase of the code (`\"Unauthorized\"`, `\"STUN error 499\"`)\n * when that is empty; a description of the cause for a 701.\n * - `address` / `port`: the local host address used to contact a STUN\n * server; both `null` when unknown (TURN) or hidden (the `\"relay\"` ICE\n * transport policy), as the W3C spec says (a null address has a null\n * port). Chrome gives `port: 0` instead and the upstream WPT tests\n * expect that; werift's WPT runner maps the `null` to 0, the API keeps\n * the spec value.\n */\nexport class RTCPeerConnectionIceErrorEvent extends Event {\n readonly address: string | null;\n readonly port: number | null;\n readonly url: string;\n readonly errorCode: number;\n readonly errorText: string;\n\n constructor(type: string, init: RTCPeerConnectionIceErrorEventInit) {\n super(type, {\n bubbles: init?.bubbles,\n cancelable: init?.cancelable,\n composed: init?.composed,\n });\n if (init == null || typeof init.errorCode !== \"number\") {\n throw new TypeError(\n \"RTCPeerConnectionIceErrorEvent: errorCode is required\",\n );\n }\n this.address = init.address ?? null;\n this.port = init.port ?? null;\n this.url = init.url ?? \"\";\n this.errorCode = init.errorCode;\n this.errorText = init.errorText ?? \"\";\n }\n}\n\nexport interface RTCDataChannelEvent {\n type?: \"datachannel\";\n channel: RTCDataChannel;\n}\n\nexport interface RTCPeerConnectionIceEvent {\n type?: \"icecandidate\";\n candidate?: RTCIceCandidate;\n}\n\nexport type PeerConnectionEventHandlers = {\n ondatachannel?: CallbackWithValue<RTCDataChannelEvent>;\n onicecandidate?: CallbackWithValue<RTCPeerConnectionIceEvent>;\n onicecandidateerror?: CallbackWithValue<RTCPeerConnectionIceErrorEvent>;\n onicegatheringstatechange?: CallbackWithValue<any>;\n onnegotiationneeded?: CallbackWithValue<any>;\n onsignalingstatechange?: CallbackWithValue<any>;\n ontrack?: CallbackWithValue<RTCTrackEvent>;\n onconnectionstatechange?: Callback;\n oniceconnectionstatechange?: Callback;\n};\n"]}
1
+ {"version":3,"file":"peerConnectionEvents.js","sourceRoot":"","sources":["../../../../src/api/peerConnectionEvents.ts"],"names":[],"mappings":";;;AAcA,wEAAwE;AAExE,MAAa,aAAa;IAOxB,YAAY,IAKX;QAXQ;;;;mBAAO,OAAO;WAAC;QACf;;;;;WAAwB;QACxB;;;;;WAAuB;QACvB;;;;;WAA+B;QAC/B;;;;;WAAyB;QAQhC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;CACF;AAlBD,sCAkBC;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,8BAA+B,SAAQ,KAAK;IAOvD,YAAY,IAAY,EAAE,IAAwC;QAChE,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI,EAAE,OAAO;YACtB,UAAU,EAAE,IAAI,EAAE,UAAU;YAC5B,QAAQ,EAAE,IAAI,EAAE,QAAQ;SACzB,CAAC,CAAC;QAXI;;;;;WAAuB;QACvB;;;;;WAAoB;QACpB;;;;;WAAY;QACZ;;;;;WAAkB;QAClB;;;;;WAAkB;QAQzB,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,SAAS,CACjB,uDAAuD,CACxD,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IACxC,CAAC;CACF;AAxBD,wEAwBC","sourcesContent":["import type { RTCDataChannel } from \"../dataChannel\";\nimport type {\n MediaStream,\n MediaStreamTrack,\n RTCRtpReceiver,\n RTCRtpTransceiver,\n} from \"../media\";\nimport type {\n IceGatheringErrorDetails,\n RTCIceCandidate,\n RTCIceTransport,\n} from \"../transport/ice\";\nimport type { Callback, CallbackWithValue } from \"../types/util\";\n\n// Events RTCPeerConnection dispatches and the `on*` handler attributes.\n\nexport class RTCTrackEvent {\n readonly type = \"track\";\n readonly track: MediaStreamTrack;\n readonly streams: MediaStream[];\n readonly transceiver: RTCRtpTransceiver;\n readonly receiver: RTCRtpReceiver;\n\n constructor(init: {\n track: MediaStreamTrack;\n streams: MediaStream[];\n transceiver: RTCRtpTransceiver;\n receiver: RTCRtpReceiver;\n }) {\n this.track = init.track;\n this.streams = [...init.streams];\n this.transceiver = init.transceiver;\n this.receiver = init.receiver;\n }\n}\n\n/** Members of {@link RTCPeerConnectionIceErrorEvent} (W3C RTCPeerConnectionIceErrorEventInit). */\nexport interface RTCPeerConnectionIceErrorEventInit {\n address?: string | null;\n port?: number | null;\n url?: string;\n errorCode: number;\n errorText?: string;\n /** Standard `EventInit` members. */\n bubbles?: boolean;\n cancelable?: boolean;\n composed?: boolean;\n}\n\n/**\n * `icecandidateerror` (W3C WebRTC §4.8.2): a configured STUN or TURN server\n * could not give a candidate while gathering. Never fired after `close()`.\n *\n * - A server that answered with an error response (300-699): fired at once,\n * once per local socket that asked it.\n * - 701 (server not reached, W3C: no host candidate could reach it): judged\n * once per gathering, when `iceGatheringState` leaves \"gathering\" (just\n * before that `icegatheringstatechange`), and fired once per URL that some\n * ICE transport of the gathering tried without reaching the server while\n * none reached it. Only transports still in use at that point count, with\n * the ICE generation they gathered in: one closed or discarded (rollback)\n * meanwhile, one that did not try the URL, and a generation an ICE restart\n * replaced do not count. The event carries the local address of the first\n * socket that failed (STUN). A new gathering (ICE restart, a new transport)\n * reports the URL again. A handler that closes the connection stops the\n * rest: no further 701 nor `icegatheringstatechange` is fired.\n *\n * While listeners run, `target` and `currentTarget` are the\n * `RTCPeerConnection` and `eventPhase` is 2 (`AT_TARGET`); afterwards\n * `currentTarget` is `null` and `eventPhase` 0. The event reaches\n * `pc.onIceCandidateError`, `onicecandidateerror` and the\n * `icecandidateerror` listeners in that order; `stopImmediatePropagation()`\n * stops the ones after the caller (also later `pc.onIceCandidateError`\n * subscribers), `stopPropagation()` does not (AT_TARGET). A listener\n * removed during the dispatch is not called, one added during it is not\n * called this time. The event is not cancelable (`preventDefault()` does\n * nothing) and, as fired by the connection, `isTrusted` is true. While a 701 is dispatched,\n * `iceGatheringState` still reads `\"gathering\"`.\n *\n * - `url`: the configured URL of the server, canonical: trimmed, lower-case\n * scheme, and `?transport=tcp` added to a `turns:` URL that names no\n * transport (`turns:h:5349` → `turns:h:5349?transport=tcp`, the Chrome /\n * WPT form). Several URLs naming one server each get their own event. The\n * built-in default STUN server (`iceUseDefaultStunServer`, used when no\n * STUN server is configured) is in no configuration; werift reports it\n * with the synthesized URL `stun:stun.l.google.com:19302`.\n * - `errorCode`: the STUN error code the server answered with (300-699),\n * or 701 when it was not reached (DNS, timeout, connect or socket error).\n * A server that answered without a STUN error code (an error response\n * without ERROR-CODE, a response failing MESSAGE-INTEGRITY, a success\n * without XOR-MAPPED-ADDRESS) was reached: it gives no event, and never\n * a 701.\n * - `errorText`: the reason phrase the server returned (W3C), with the\n * credential material werift knows replaced by `***` (the configured TURN\n * username and password, and the USERNAME / REALM / NONCE of the\n * response), control characters dropped and cut to 127 characters; the\n * registered phrase of the code (`\"Unauthorized\"`, `\"STUN error 499\"`)\n * when that is empty; a description of the cause for a 701.\n * - `address` / `port`: the local host address used to contact a STUN\n * server; both `null` when unknown (TURN) or hidden (the `\"relay\"` ICE\n * transport policy), as the W3C spec says (a null address has a null\n * port). Chrome gives `port: 0` instead and the upstream WPT tests\n * expect that; werift's WPT runner maps the `null` to 0, the API keeps\n * the spec value.\n */\nexport class RTCPeerConnectionIceErrorEvent extends Event {\n readonly address: string | null;\n readonly port: number | null;\n readonly url: string;\n readonly errorCode: number;\n readonly errorText: string;\n\n constructor(type: string, init: RTCPeerConnectionIceErrorEventInit) {\n super(type, {\n bubbles: init?.bubbles,\n cancelable: init?.cancelable,\n composed: init?.composed,\n });\n if (init == null || typeof init.errorCode !== \"number\") {\n throw new TypeError(\n \"RTCPeerConnectionIceErrorEvent: errorCode is required\",\n );\n }\n this.address = init.address ?? null;\n this.port = init.port ?? null;\n this.url = init.url ?? \"\";\n this.errorCode = init.errorCode;\n this.errorText = init.errorText ?? \"\";\n }\n}\n\n/**\n * A gathering error of one ICE transport (`RTCPeerConnection.onIceGatheringError`,\n * a werift extension, not W3C): see {@link IceGatheringErrorDetails}.\n * @see packages/webrtc/tests/transport/iceGatheringError.test.ts「without STUN / TURN: gathering completes with end-of-candidates and both reasons are reported」\n */\nexport type RTCIceGatheringErrorEvent = IceGatheringErrorDetails & {\n /** The transport whose gathering reported it. */\n readonly iceTransport: RTCIceTransport;\n};\n\nexport interface RTCDataChannelEvent {\n type?: \"datachannel\";\n channel: RTCDataChannel;\n}\n\nexport interface RTCPeerConnectionIceEvent {\n type?: \"icecandidate\";\n candidate?: RTCIceCandidate;\n}\n\nexport type PeerConnectionEventHandlers = {\n ondatachannel?: CallbackWithValue<RTCDataChannelEvent>;\n onicecandidate?: CallbackWithValue<RTCPeerConnectionIceEvent>;\n onicecandidateerror?: CallbackWithValue<RTCPeerConnectionIceErrorEvent>;\n onicegatheringstatechange?: CallbackWithValue<any>;\n onnegotiationneeded?: CallbackWithValue<any>;\n onsignalingstatechange?: CallbackWithValue<any>;\n ontrack?: CallbackWithValue<RTCTrackEvent>;\n onconnectionstatechange?: Callback;\n oniceconnectionstatechange?: Callback;\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import { EventTarget } from "./helper";
2
2
  import { Event } from "./imports/common";
3
3
  import type { RTCSctpTransport } from "./transport/sctp";
4
- import type { Callback, CallbackWithValue } from "./types/util";
4
+ import type { CallbackWithValue, EventHandler } from "./types/util";
5
5
  /**
6
6
  * Label / Protocol Length are 16-bit byte counts of the UTF-8 fields
7
7
  * (RFC 8832 5.1); W3C createDataChannel rejects longer values for both
@@ -18,6 +18,28 @@ export interface DataChannelStats {
18
18
  bytesReceived: number;
19
19
  }
20
20
  export declare function getDataChannelMessageSize(data: Buffer | string): number;
21
+ /**
22
+ * The form a received binary message takes in `onmessage` and the
23
+ * `"message"` event (W3C `RTCDataChannel.binaryType`).
24
+ * - `"nodebuffer"`: a Node.js `Buffer` (werift extension, the core default;
25
+ * named after the `ws` library's value).
26
+ * - `"arraybuffer"`: an `ArrayBuffer` (the W3C default, used by
27
+ * `werift/polyfill`).
28
+ * - `"blob"`: a `Blob`.
29
+ *
30
+ * Text messages are always strings. {@link RTCDataChannel.onMessage} always
31
+ * receives a `Buffer` or a string.
32
+ * @enum
33
+ */
34
+ export declare const RTCDataChannelBinaryType: {
35
+ readonly nodebuffer: "nodebuffer";
36
+ readonly arraybuffer: "arraybuffer";
37
+ readonly blob: "blob";
38
+ };
39
+ export type RTCDataChannelBinaryType = (typeof RTCDataChannelBinaryType)[keyof typeof RTCDataChannelBinaryType];
40
+ export declare const RTCDataChannelBinaryTypes: readonly RTCDataChannelBinaryType[];
41
+ /** What `onmessage` / the `"message"` event carries, by `binaryType`. */
42
+ export type RTCDataChannelMessageData = string | Buffer | ArrayBuffer | Blob;
21
43
  export declare class RTCDataChannel extends EventTarget implements DataChannelStats {
22
44
  readonly sctp: RTCSctpTransport;
23
45
  private readonly parameters;
@@ -27,34 +49,117 @@ export declare class RTCDataChannel extends EventTarget implements DataChannelSt
27
49
  readonly stateChanged: Event<[DCState]>;
28
50
  readonly onMessage: Event<[string | Buffer<ArrayBufferLike>]>;
29
51
  readonly error: Event<[Error]>;
52
+ /**
53
+ * W3C `bufferedamountlow`.
54
+ * @see tests/datachannel/bufferedAmount.test.ts "bufferedamountlow fires once per downward crossing, through every notification"
55
+ * @see tests/datachannel/bufferedAmount.test.ts "pc.close() keeps bufferedAmount and fires no bufferedamountlow"
56
+ */
30
57
  readonly bufferedAmountLow: Event<any[]>;
31
- onopen?: Callback;
32
- onclose?: Callback;
33
- onclosing?: Callback;
58
+ /** @see tests/datachannel/bufferedAmount.test.ts "every event handler receives the same Event object as the listeners" */
59
+ onopen?: EventHandler<globalThis.Event>;
60
+ /** @see tests/datachannel/bufferedAmount.test.ts "every event handler receives the same Event object as the listeners" */
61
+ onclose?: EventHandler<globalThis.Event>;
62
+ /** @see tests/datachannel/bufferedAmount.test.ts "every event handler receives the same Event object as the listeners" */
63
+ onclosing?: EventHandler<globalThis.Event>;
64
+ /**
65
+ * W3C `onbufferedamountlow`.
66
+ * @see tests/datachannel/bufferedAmount.test.ts "bufferedamountlow fires once per downward crossing, through every notification"
67
+ * @see tests/datachannel/bufferedAmount.test.ts "onbufferedamountlow receives the same Event object as the bufferedamountlow listeners"
68
+ */
69
+ onbufferedamountlow?: EventHandler<globalThis.Event>;
34
70
  onmessage?: CallbackWithValue<MessageEvent>;
35
71
  onerror?: CallbackWithValue<RTCErrorEvent>;
36
72
  isCreatedByRemote: boolean;
37
73
  id: number;
38
74
  readyState: DCState;
39
- bufferedAmount: number;
75
+ private _bufferedAmount;
40
76
  private _bufferedAmountLowThreshold;
77
+ private _binaryType;
41
78
  messagesSent: number;
42
79
  bytesSent: number;
43
80
  messagesReceived: number;
44
81
  bytesReceived: number;
45
- constructor(sctp: RTCSctpTransport, parameters: RTCDataChannelParameters, sendOpen?: boolean);
82
+ constructor(sctp: RTCSctpTransport, parameters: RTCDataChannelParameters, sendOpen?: boolean, binaryType?: RTCDataChannelBinaryType);
46
83
  get ordered(): boolean;
47
84
  get maxRetransmits(): number | null;
48
85
  get maxPacketLifeTime(): number | null;
49
86
  get label(): string;
50
87
  get protocol(): string;
51
88
  get negotiated(): boolean;
89
+ /**
90
+ * W3C `binaryType`. The initial value is the PeerConnection's
91
+ * `dataChannelBinaryType` (`"nodebuffer"` by default, `"arraybuffer"`
92
+ * through `werift/polyfill`). Assignment follows the WebIDL enum
93
+ * attribute setter: the value is converted with `ToString` first (an
94
+ * object's `toString()` is used, a Symbol is a `TypeError`), and a result
95
+ * that is not a {@link RTCDataChannelBinaryType} is ignored without an
96
+ * exception (WPT `RTCDataChannel-binaryType.window.js`).
97
+ */
98
+ get binaryType(): RTCDataChannelBinaryType;
99
+ set binaryType(value: RTCDataChannelBinaryType);
100
+ /**
101
+ * W3C webrtc-pc `bufferedAmount`.
102
+ * @see tests/datachannel/bufferedAmount.test.ts "is read-only"
103
+ * @see tests/datachannel/bufferedAmount.test.ts "send() adds the UTF-8 byte length synchronously"
104
+ * @see tests/datachannel/bufferedAmount.test.ts "with loss every message arrives and bufferedAmount reaches 0 before the ACK"
105
+ * @see tests/datachannel/bufferedAmount.test.ts "messages abandoned by maxPacketLifeTime before they were sent are subtracted and notified"
106
+ * @see tests/datachannel/bufferedAmount.test.ts "close() does not decrease bufferedAmount immediately; it drains while closing"
107
+ * @see tests/datachannel/bufferedAmount.test.ts "pc.close() keeps bufferedAmount and fires no bufferedamountlow"
108
+ * @see tests/transport/sctp.test.ts "stop discards unsent messages and keeps them in bufferedAmount"
109
+ */
110
+ get bufferedAmount(): number;
111
+ /**
112
+ * W3C webrtc-pc `bufferedAmountLowThreshold`.
113
+ * @see tests/datachannel/bufferedAmount.test.ts "a threshold reached exactly notifies once; a threshold raised above the amount does not notify"
114
+ * @see tests/datachannel/bufferedAmount.test.ts "bufferedAmountLowThreshold defaults to 0 and accepts only 0..2^32-1"
115
+ */
52
116
  get bufferedAmountLowThreshold(): number;
53
117
  set bufferedAmountLowThreshold(value: number);
54
- setId(id: number): void;
55
- setReadyState(state: DCState): void;
56
- addBufferedAmount(amount: number): void;
118
+ /**
119
+ * Internal: `undefined` gives a reserved stream ID back.
120
+ * @see tests/issue/815.test.ts "a rollback gives back the IDs a pranswer reserved"
121
+ */
122
+ setId(id: number | undefined): void;
123
+ /**
124
+ * Internal: W3C webrtc-pc 4.4.1.6 step 2.2.6, no stream ID could be
125
+ * generated: `closed`, then `error` and `close`, each listener isolated.
126
+ * @see tests/issue/815.test.ts "a channel waiting for an ID closes with OperationError when none is left"
127
+ * @see tests/issue/815.test.ts "close still fires when error listeners throw"
128
+ * @see tests/issue/815.test.ts "every error subscriber is notified even if one throws"
129
+ */
130
+ failWithError(error: Error): void;
131
+ /**
132
+ * Internal. Every listener is isolated (DOM event semantics).
133
+ * @see tests/datachannel/closeDelivery.test.ts "closing fires on the end the peer closed, not on the end calling close()"
134
+ * @see tests/issue/815.test.ts "a throwing close listener of a registered channel skips no listener, channel or teardown"
135
+ * @see tests/issue/815.test.ts "pc.close() closes every pending channel even if a close listener throws"
136
+ */
137
+ setReadyState(state: DCState, { notifyClosing }?: {
138
+ notifyClosing?: boolean;
139
+ }): void;
140
+ /**
141
+ * @see tests/datachannel/bufferedAmount.test.ts "every event handler receives the same Event object as the listeners"
142
+ * @see tests/datachannel/bufferedAmountLow.test.ts "onbufferedamountlow receives the same bufferedamountlow Event as the listeners"
143
+ */
144
+ private fireEvent;
145
+ /**
146
+ * Queue a message. While `connecting` it waits until the channel can send
147
+ * (werift convenience; W3C throws).
148
+ * @throws Error when the message is larger than the peer's max-message-size.
149
+ * @see tests/datachannel/closeDelivery.test.ts "messages sent before close() while connecting reach the peer, then both ends close"
150
+ * @see tests/datachannel/bufferedAmount.test.ts "send() adds the UTF-8 byte length synchronously"
151
+ * @see tests/datachannel/bufferedAmount.test.ts "send() on a closing or closed channel is ignored"
152
+ * @see tests/datachannel/bufferedAmount.test.ts "empty string and empty Buffer arrive in order, bufferedAmount stays 0, stats count them"
153
+ * @see tests/integrate/peerConnection.test.ts "respects remote max-message-size advertised in answer"
154
+ */
57
155
  send(data: Buffer | string): void;
156
+ /**
157
+ * Start the closing procedure (W3C webrtc-pc, RFC 8831 6.7).
158
+ * @see tests/datachannel/closeDelivery.test.ts "close() right after a burst (%o): every message arrives in order before close fires on the sender"
159
+ * @see tests/datachannel/closeDelivery.test.ts "messages sent before close() while connecting reach the peer, then both ends close"
160
+ * @see tests/datachannel/closeDelivery.test.ts "pc.close() before the association is established closes the channel and drops its messages"
161
+ * @see tests/datachannel/closeDelivery.test.ts "an in-band channel closed before its DATA_CHANNEL_OPEN is sent closes at once and sends nothing"
162
+ */
58
163
  close(): void;
59
164
  }
60
165
  export type DCState = "open" | "closed" | "connecting" | "closing";
@@ -70,7 +175,14 @@ export declare class RTCDataChannelParameters {
70
175
  constructor(props?: Partial<RTCDataChannelParameters>);
71
176
  }
72
177
  export interface MessageEvent {
73
- data: string | Buffer;
178
+ /** `"message"` on received messages. */
179
+ readonly type?: string;
180
+ /**
181
+ * A string for a text message; a binary message by the channel's
182
+ * `binaryType` (`Buffer` by default). Use {@link RTCDataChannel.onMessage}
183
+ * for code that always wants a `Buffer` or a string.
184
+ */
185
+ data: RTCDataChannelMessageData;
74
186
  }
75
187
  export interface RTCErrorEvent {
76
188
  error: any;