werift 0.27.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 (582) hide show
  1. package/README.md +299 -8
  2. package/lib/common/src/event.d.ts +26 -0
  3. package/lib/common/src/event.js +87 -2
  4. package/lib/common/src/event.js.map +1 -1
  5. package/lib/common/src/network.d.ts +6 -1
  6. package/lib/common/src/network.js +8 -2
  7. package/lib/common/src/network.js.map +1 -1
  8. package/lib/common/src/transport.d.ts +51 -10
  9. package/lib/common/src/transport.js +35 -9
  10. package/lib/common/src/transport.js.map +1 -1
  11. package/lib/dtls/src/alert.d.ts +49 -0
  12. package/lib/dtls/src/alert.js +103 -0
  13. package/lib/dtls/src/alert.js.map +1 -0
  14. package/lib/dtls/src/carrier/direct.d.ts +67 -0
  15. package/lib/dtls/src/carrier/direct.js +226 -0
  16. package/lib/dtls/src/carrier/direct.js.map +1 -0
  17. package/lib/dtls/src/carrier/types.d.ts +81 -0
  18. package/lib/dtls/src/carrier/types.js +7 -0
  19. package/lib/dtls/src/carrier/types.js.map +1 -0
  20. package/lib/dtls/src/cipher/const.d.ts +6 -0
  21. package/lib/dtls/src/cipher/const.js +13 -2
  22. package/lib/dtls/src/cipher/const.js.map +1 -1
  23. package/lib/dtls/src/cipher/prf.js +11 -2
  24. package/lib/dtls/src/cipher/prf.js.map +1 -1
  25. package/lib/dtls/src/cipher/tls13/aead.d.ts +41 -0
  26. package/lib/dtls/src/cipher/tls13/aead.js +128 -0
  27. package/lib/dtls/src/cipher/tls13/aead.js.map +1 -0
  28. package/lib/dtls/src/cipher/tls13/hkdf.d.ts +30 -0
  29. package/lib/dtls/src/cipher/tls13/hkdf.js +76 -0
  30. package/lib/dtls/src/cipher/tls13/hkdf.js.map +1 -0
  31. package/lib/dtls/src/cipher/tls13/keySchedule.d.ts +70 -0
  32. package/lib/dtls/src/cipher/tls13/keySchedule.js +114 -0
  33. package/lib/dtls/src/cipher/tls13/keySchedule.js.map +1 -0
  34. package/lib/dtls/src/cipher/tls13/signature.d.ts +30 -0
  35. package/lib/dtls/src/cipher/tls13/signature.js +149 -0
  36. package/lib/dtls/src/cipher/tls13/signature.js.map +1 -0
  37. package/lib/dtls/src/client.d.ts +253 -0
  38. package/lib/dtls/src/client.js +1269 -14
  39. package/lib/dtls/src/client.js.map +1 -1
  40. package/lib/dtls/src/context/dtls.d.ts +47 -0
  41. package/lib/dtls/src/context/dtls.js +121 -0
  42. package/lib/dtls/src/context/dtls.js.map +1 -1
  43. package/lib/dtls/src/context/transport.d.ts +30 -1
  44. package/lib/dtls/src/context/transport.js +67 -3
  45. package/lib/dtls/src/context/transport.js.map +1 -1
  46. package/lib/dtls/src/engine/v1_3/connection-base.d.ts +520 -0
  47. package/lib/dtls/src/engine/v1_3/connection-base.js +1644 -0
  48. package/lib/dtls/src/engine/v1_3/connection-base.js.map +1 -0
  49. package/lib/dtls/src/engine/v1_3/connection.d.ts +181 -0
  50. package/lib/dtls/src/engine/v1_3/connection.js +680 -0
  51. package/lib/dtls/src/engine/v1_3/connection.js.map +1 -0
  52. package/lib/dtls/src/engine/v1_3/early-data-buffer.d.ts +38 -0
  53. package/lib/dtls/src/engine/v1_3/early-data-buffer.js +166 -0
  54. package/lib/dtls/src/engine/v1_3/early-data-buffer.js.map +1 -0
  55. package/lib/dtls/src/engine/v1_3/flight/certificate.d.ts +4 -0
  56. package/lib/dtls/src/engine/v1_3/flight/certificate.js +62 -0
  57. package/lib/dtls/src/engine/v1_3/flight/certificate.js.map +1 -0
  58. package/lib/dtls/src/engine/v1_3/flight/client/flight1.d.ts +8 -0
  59. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js +119 -0
  60. package/lib/dtls/src/engine/v1_3/flight/client/flight1.js.map +1 -0
  61. package/lib/dtls/src/engine/v1_3/flight/client/flight4.d.ts +8 -0
  62. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js +251 -0
  63. package/lib/dtls/src/engine/v1_3/flight/client/flight4.js.map +1 -0
  64. package/lib/dtls/src/engine/v1_3/flight/client/flight5.d.ts +5 -0
  65. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js +99 -0
  66. package/lib/dtls/src/engine/v1_3/flight/client/flight5.js.map +1 -0
  67. package/lib/dtls/src/engine/v1_3/flight/dispatch.d.ts +12 -0
  68. package/lib/dtls/src/engine/v1_3/flight/dispatch.js +138 -0
  69. package/lib/dtls/src/engine/v1_3/flight/dispatch.js.map +1 -0
  70. package/lib/dtls/src/engine/v1_3/flight/extensions.d.ts +13 -0
  71. package/lib/dtls/src/engine/v1_3/flight/extensions.js +46 -0
  72. package/lib/dtls/src/engine/v1_3/flight/extensions.js.map +1 -0
  73. package/lib/dtls/src/engine/v1_3/flight/finished.d.ts +6 -0
  74. package/lib/dtls/src/engine/v1_3/flight/finished.js +16 -0
  75. package/lib/dtls/src/engine/v1_3/flight/finished.js.map +1 -0
  76. package/lib/dtls/src/engine/v1_3/flight/post-hs.d.ts +12 -0
  77. package/lib/dtls/src/engine/v1_3/flight/post-hs.js +94 -0
  78. package/lib/dtls/src/engine/v1_3/flight/post-hs.js.map +1 -0
  79. package/lib/dtls/src/engine/v1_3/flight/server/flight2.d.ts +21 -0
  80. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js +227 -0
  81. package/lib/dtls/src/engine/v1_3/flight/server/flight2.js.map +1 -0
  82. package/lib/dtls/src/engine/v1_3/flight/server/flight4.d.ts +6 -0
  83. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js +455 -0
  84. package/lib/dtls/src/engine/v1_3/flight/server/flight4.js.map +1 -0
  85. package/lib/dtls/src/engine/v1_3/flight/server/flight5.d.ts +5 -0
  86. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js +48 -0
  87. package/lib/dtls/src/engine/v1_3/flight/server/flight5.js.map +1 -0
  88. package/lib/dtls/src/engine/v1_3/flight-tx.d.ts +119 -0
  89. package/lib/dtls/src/engine/v1_3/flight-tx.js +782 -0
  90. package/lib/dtls/src/engine/v1_3/flight-tx.js.map +1 -0
  91. package/lib/dtls/src/engine/v1_3/host.d.ts +86 -0
  92. package/lib/dtls/src/engine/v1_3/host.js +11 -0
  93. package/lib/dtls/src/engine/v1_3/host.js.map +1 -0
  94. package/lib/dtls/src/engine/v1_3/record-rx.d.ts +77 -0
  95. package/lib/dtls/src/engine/v1_3/record-rx.js +818 -0
  96. package/lib/dtls/src/engine/v1_3/record-rx.js.map +1 -0
  97. package/lib/dtls/src/engine/v1_3/transcript.d.ts +22 -0
  98. package/lib/dtls/src/engine/v1_3/transcript.js +65 -0
  99. package/lib/dtls/src/engine/v1_3/transcript.js.map +1 -0
  100. package/lib/dtls/src/engine/v1_3/types.d.ts +169 -0
  101. package/lib/dtls/src/engine/v1_3/types.js +113 -0
  102. package/lib/dtls/src/engine/v1_3/types.js.map +1 -0
  103. package/lib/dtls/src/flight/client/flight1.d.ts +7 -1
  104. package/lib/dtls/src/flight/client/flight1.js +9 -3
  105. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  106. package/lib/dtls/src/flight/client/flight3.d.ts +8 -0
  107. package/lib/dtls/src/flight/client/flight3.js +24 -4
  108. package/lib/dtls/src/flight/client/flight3.js.map +1 -1
  109. package/lib/dtls/src/flight/client/flight5.js +17 -2
  110. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  111. package/lib/dtls/src/flight/flight.d.ts +21 -0
  112. package/lib/dtls/src/flight/flight.js +119 -9
  113. package/lib/dtls/src/flight/flight.js.map +1 -1
  114. package/lib/dtls/src/flight/server/commitClientHello.d.ts +35 -0
  115. package/lib/dtls/src/flight/server/commitClientHello.js +149 -0
  116. package/lib/dtls/src/flight/server/commitClientHello.js.map +1 -0
  117. package/lib/dtls/src/flight/server/flight2.d.ts +12 -3
  118. package/lib/dtls/src/flight/server/flight2.js +29 -105
  119. package/lib/dtls/src/flight/server/flight2.js.map +1 -1
  120. package/lib/dtls/src/flight/server/flight4.js +14 -2
  121. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  122. package/lib/dtls/src/flight/server/flight6.js +12 -1
  123. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  124. package/lib/dtls/src/handshake/const.d.ts +10 -0
  125. package/lib/dtls/src/handshake/const.js +10 -0
  126. package/lib/dtls/src/handshake/const.js.map +1 -1
  127. package/lib/dtls/src/handshake/extensions/cookie.d.ts +113 -0
  128. package/lib/dtls/src/handshake/extensions/cookie.js +326 -0
  129. package/lib/dtls/src/handshake/extensions/cookie.js.map +1 -0
  130. package/lib/dtls/src/handshake/extensions/ids.d.ts +7 -0
  131. package/lib/dtls/src/handshake/extensions/ids.js +11 -0
  132. package/lib/dtls/src/handshake/extensions/ids.js.map +1 -0
  133. package/lib/dtls/src/handshake/extensions/keyShare.d.ts +28 -0
  134. package/lib/dtls/src/handshake/extensions/keyShare.js +156 -0
  135. package/lib/dtls/src/handshake/extensions/keyShare.js.map +1 -0
  136. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.d.ts +27 -0
  137. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js +67 -0
  138. package/lib/dtls/src/handshake/extensions/signatureAlgorithms.js.map +1 -0
  139. package/lib/dtls/src/handshake/extensions/supportedVersions.d.ts +20 -0
  140. package/lib/dtls/src/handshake/extensions/supportedVersions.js +90 -0
  141. package/lib/dtls/src/handshake/extensions/supportedVersions.js.map +1 -0
  142. package/lib/dtls/src/handshake/extensions/unique.d.ts +7 -0
  143. package/lib/dtls/src/handshake/extensions/unique.js +19 -0
  144. package/lib/dtls/src/handshake/extensions/unique.js.map +1 -0
  145. package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +26 -3
  146. package/lib/dtls/src/handshake/extensions/useSrtp.js +68 -12
  147. package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
  148. package/lib/dtls/src/handshake/message/tls13/ack.d.ts +50 -0
  149. package/lib/dtls/src/handshake/message/tls13/ack.js +107 -0
  150. package/lib/dtls/src/handshake/message/tls13/ack.js.map +1 -0
  151. package/lib/dtls/src/handshake/message/tls13/certificate.d.ts +17 -0
  152. package/lib/dtls/src/handshake/message/tls13/certificate.js +112 -0
  153. package/lib/dtls/src/handshake/message/tls13/certificate.js.map +1 -0
  154. package/lib/dtls/src/handshake/message/tls13/certificateRequest.d.ts +17 -0
  155. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js +99 -0
  156. package/lib/dtls/src/handshake/message/tls13/certificateRequest.js.map +1 -0
  157. package/lib/dtls/src/handshake/message/tls13/certificateVerify.d.ts +21 -0
  158. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js +77 -0
  159. package/lib/dtls/src/handshake/message/tls13/certificateVerify.js.map +1 -0
  160. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.d.ts +19 -0
  161. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js +56 -0
  162. package/lib/dtls/src/handshake/message/tls13/encryptedExtensions.js.map +1 -0
  163. package/lib/dtls/src/handshake/message/tls13/keyUpdate.d.ts +13 -0
  164. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js +54 -0
  165. package/lib/dtls/src/handshake/message/tls13/keyUpdate.js.map +1 -0
  166. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.d.ts +33 -0
  167. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js +158 -0
  168. package/lib/dtls/src/handshake/message/tls13/newSessionTicket.js.map +1 -0
  169. package/lib/dtls/src/handshake/random.d.ts +14 -0
  170. package/lib/dtls/src/handshake/random.js +24 -0
  171. package/lib/dtls/src/handshake/random.js.map +1 -1
  172. package/lib/dtls/src/handshake/validation.d.ts +26 -0
  173. package/lib/dtls/src/handshake/validation.js +32 -0
  174. package/lib/dtls/src/handshake/validation.js.map +1 -0
  175. package/lib/dtls/src/index.d.ts +8 -1
  176. package/lib/dtls/src/index.js +125 -44
  177. package/lib/dtls/src/index.js.map +1 -1
  178. package/lib/dtls/src/internal.d.ts +7 -0
  179. package/lib/dtls/src/internal.js +57 -0
  180. package/lib/dtls/src/internal.js.map +1 -0
  181. package/lib/dtls/src/peer.d.ts +49 -0
  182. package/lib/dtls/src/peer.js +54 -0
  183. package/lib/dtls/src/peer.js.map +1 -0
  184. package/lib/dtls/src/record/antiReplayWindow.d.ts +33 -0
  185. package/lib/dtls/src/record/antiReplayWindow.js +119 -0
  186. package/lib/dtls/src/record/antiReplayWindow.js.map +1 -0
  187. package/lib/dtls/src/record/const.d.ts +15 -0
  188. package/lib/dtls/src/record/const.js +15 -1
  189. package/lib/dtls/src/record/const.js.map +1 -1
  190. package/lib/dtls/src/record/message/fragment.d.ts +0 -2
  191. package/lib/dtls/src/record/message/fragment.js +36 -17
  192. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  193. package/lib/dtls/src/record/message/reassembler.d.ts +62 -0
  194. package/lib/dtls/src/record/message/reassembler.js +249 -0
  195. package/lib/dtls/src/record/message/reassembler.js.map +1 -0
  196. package/lib/dtls/src/record/receive.d.ts +6 -0
  197. package/lib/dtls/src/record/receive.js +58 -19
  198. package/lib/dtls/src/record/receive.js.map +1 -1
  199. package/lib/dtls/src/record/v1_3/header.d.ts +34 -0
  200. package/lib/dtls/src/record/v1_3/header.js +95 -0
  201. package/lib/dtls/src/record/v1_3/header.js.map +1 -0
  202. package/lib/dtls/src/record/v1_3/record.d.ts +133 -0
  203. package/lib/dtls/src/record/v1_3/record.js +370 -0
  204. package/lib/dtls/src/record/v1_3/record.js.map +1 -0
  205. package/lib/dtls/src/retransmission.d.ts +26 -0
  206. package/lib/dtls/src/retransmission.js +39 -0
  207. package/lib/dtls/src/retransmission.js.map +1 -0
  208. package/lib/dtls/src/server.d.ts +38 -0
  209. package/lib/dtls/src/server.js +382 -17
  210. package/lib/dtls/src/server.js.map +1 -1
  211. package/lib/dtls/src/socket.d.ts +487 -11
  212. package/lib/dtls/src/socket.js +1359 -70
  213. package/lib/dtls/src/socket.js.map +1 -1
  214. package/lib/dtls/src/version.d.ts +89 -0
  215. package/lib/dtls/src/version.js +204 -0
  216. package/lib/dtls/src/version.js.map +1 -0
  217. package/lib/ice/src/candidateError.d.ts +155 -0
  218. package/lib/ice/src/candidateError.js +246 -0
  219. package/lib/ice/src/candidateError.js.map +1 -0
  220. package/lib/ice/src/candidateGatherer.d.ts +127 -0
  221. package/lib/ice/src/candidateGatherer.js +745 -0
  222. package/lib/ice/src/candidateGatherer.js.map +1 -0
  223. package/lib/ice/src/consent.d.ts +126 -0
  224. package/lib/ice/src/consent.js +470 -0
  225. package/lib/ice/src/consent.js.map +1 -0
  226. package/lib/ice/src/dns/lookup.d.ts +10 -0
  227. package/lib/ice/src/dns/lookup.js +130 -3
  228. package/lib/ice/src/dns/lookup.js.map +1 -1
  229. package/lib/ice/src/exceptions.d.ts +9 -0
  230. package/lib/ice/src/exceptions.js +14 -1
  231. package/lib/ice/src/exceptions.js.map +1 -1
  232. package/lib/ice/src/failover.d.ts +270 -0
  233. package/lib/ice/src/failover.js +674 -0
  234. package/lib/ice/src/failover.js.map +1 -0
  235. package/lib/ice/src/gatheringError.d.ts +28 -0
  236. package/lib/ice/src/gatheringError.js +17 -0
  237. package/lib/ice/src/gatheringError.js.map +1 -0
  238. package/lib/ice/src/ice.d.ts +486 -78
  239. package/lib/ice/src/ice.js +2415 -1129
  240. package/lib/ice/src/ice.js.map +1 -1
  241. package/lib/ice/src/iceBase.d.ts +404 -14
  242. package/lib/ice/src/iceBase.js +251 -38
  243. package/lib/ice/src/iceBase.js.map +1 -1
  244. package/lib/ice/src/index.d.ts +3 -0
  245. package/lib/ice/src/index.js +5 -1
  246. package/lib/ice/src/index.js.map +1 -1
  247. package/lib/ice/src/internal/checkMessages.d.ts +41 -0
  248. package/lib/ice/src/internal/checkMessages.js +63 -0
  249. package/lib/ice/src/internal/checkMessages.js.map +1 -0
  250. package/lib/ice/src/internal/datagram.d.ts +37 -0
  251. package/lib/ice/src/internal/datagram.js +45 -0
  252. package/lib/ice/src/internal/datagram.js.map +1 -0
  253. package/lib/ice/src/internal/defaultRoute.d.ts +20 -0
  254. package/lib/ice/src/internal/defaultRoute.js +134 -0
  255. package/lib/ice/src/internal/defaultRoute.js.map +1 -0
  256. package/lib/ice/src/internal/hostInterfaces.d.ts +28 -0
  257. package/lib/ice/src/internal/hostInterfaces.js +89 -0
  258. package/lib/ice/src/internal/hostInterfaces.js.map +1 -0
  259. package/lib/ice/src/internal/hostPreference.d.ts +24 -0
  260. package/lib/ice/src/internal/hostPreference.js +38 -0
  261. package/lib/ice/src/internal/hostPreference.js.map +1 -0
  262. package/lib/ice/src/internal/resolveHostAddresses.d.ts +56 -8
  263. package/lib/ice/src/internal/resolveHostAddresses.js +127 -24
  264. package/lib/ice/src/internal/resolveHostAddresses.js.map +1 -1
  265. package/lib/ice/src/internal/selectAddresses.d.ts +27 -0
  266. package/lib/ice/src/internal/selectAddresses.js +37 -18
  267. package/lib/ice/src/internal/selectAddresses.js.map +1 -1
  268. package/lib/ice/src/internal/sped-bind.d.ts +44 -0
  269. package/lib/ice/src/internal/sped-bind.js +53 -0
  270. package/lib/ice/src/internal/sped-bind.js.map +1 -0
  271. package/lib/ice/src/internal/sped-binding-cache.d.ts +27 -0
  272. package/lib/ice/src/internal/sped-binding-cache.js +102 -0
  273. package/lib/ice/src/internal/sped-binding-cache.js.map +1 -0
  274. package/lib/ice/src/internal/sped.d.ts +15 -0
  275. package/lib/ice/src/internal/sped.js +62 -0
  276. package/lib/ice/src/internal/sped.js.map +1 -0
  277. package/lib/ice/src/nomination/regularNomination.d.ts +200 -0
  278. package/lib/ice/src/nomination/regularNomination.js +311 -0
  279. package/lib/ice/src/nomination/regularNomination.js.map +1 -0
  280. package/lib/ice/src/nomination/selectionController.d.ts +111 -0
  281. package/lib/ice/src/nomination/selectionController.js +172 -0
  282. package/lib/ice/src/nomination/selectionController.js.map +1 -0
  283. package/lib/ice/src/nomination/selectionReplacement.d.ts +178 -0
  284. package/lib/ice/src/nomination/selectionReplacement.js +429 -0
  285. package/lib/ice/src/nomination/selectionReplacement.js.map +1 -0
  286. package/lib/ice/src/provisional.d.ts +139 -0
  287. package/lib/ice/src/provisional.js +468 -0
  288. package/lib/ice/src/provisional.js.map +1 -0
  289. package/lib/ice/src/sped/draft00/codec.d.ts +20 -0
  290. package/lib/ice/src/sped/draft00/codec.js +59 -0
  291. package/lib/ice/src/sped/draft00/codec.js.map +1 -0
  292. package/lib/ice/src/sped/draft00/constants.d.ts +14 -0
  293. package/lib/ice/src/sped/draft00/constants.js +18 -0
  294. package/lib/ice/src/sped/draft00/constants.js.map +1 -0
  295. package/lib/ice/src/sped/draft00/index.d.ts +6 -0
  296. package/lib/ice/src/sped/draft00/index.js +26 -0
  297. package/lib/ice/src/sped/draft00/index.js.map +1 -0
  298. package/lib/ice/src/sped/draft00/mtu.d.ts +38 -0
  299. package/lib/ice/src/sped/draft00/mtu.js +96 -0
  300. package/lib/ice/src/sped/draft00/mtu.js.map +1 -0
  301. package/lib/ice/src/sped/draft00/session.d.ts +86 -0
  302. package/lib/ice/src/sped/draft00/session.js +353 -0
  303. package/lib/ice/src/sped/draft00/session.js.map +1 -0
  304. package/lib/ice/src/sped/draft00/types.d.ts +16 -0
  305. package/lib/ice/src/sped/draft00/types.js +3 -0
  306. package/lib/ice/src/sped/draft00/types.js.map +1 -0
  307. package/lib/ice/src/sped/runtime.d.ts +188 -0
  308. package/lib/ice/src/sped/runtime.js +643 -0
  309. package/lib/ice/src/sped/runtime.js.map +1 -0
  310. package/lib/ice/src/stun/protocol.d.ts +38 -2
  311. package/lib/ice/src/stun/protocol.js +107 -21
  312. package/lib/ice/src/stun/protocol.js.map +1 -1
  313. package/lib/ice/src/stun/rawAttributeValue.d.ts +1 -0
  314. package/lib/ice/src/stun/rawAttributeValue.js +6 -0
  315. package/lib/ice/src/stun/rawAttributeValue.js.map +1 -0
  316. package/lib/ice/src/stun/tcpProtocol.d.ts +2 -1
  317. package/lib/ice/src/stun/tcpProtocol.js +21 -9
  318. package/lib/ice/src/stun/tcpProtocol.js.map +1 -1
  319. package/lib/ice/src/stun/transaction.d.ts +4 -0
  320. package/lib/ice/src/stun/transaction.js +27 -2
  321. package/lib/ice/src/stun/transaction.js.map +1 -1
  322. package/lib/ice/src/turn/protocol.d.ts +23 -4
  323. package/lib/ice/src/turn/protocol.js +99 -11
  324. package/lib/ice/src/turn/protocol.js.map +1 -1
  325. package/lib/ice/src/types/model.d.ts +25 -5
  326. package/lib/ice/src/types/model.js.map +1 -1
  327. package/lib/ice/src/utils.d.ts +13 -0
  328. package/lib/ice/src/utils.js +13 -0
  329. package/lib/ice/src/utils.js.map +1 -1
  330. package/lib/ice-server/src/stun/attributes.js +4 -0
  331. package/lib/ice-server/src/stun/attributes.js.map +1 -1
  332. package/lib/ice-server/src/stun/const.d.ts +20 -1
  333. package/lib/ice-server/src/stun/const.js +9 -1
  334. package/lib/ice-server/src/stun/const.js.map +1 -1
  335. package/lib/ice-server/src/stun/message.d.ts +43 -3
  336. package/lib/ice-server/src/stun/message.js +258 -40
  337. package/lib/ice-server/src/stun/message.js.map +1 -1
  338. package/lib/ice-server/src/stun/rawAttributeValue.d.ts +6 -0
  339. package/lib/ice-server/src/stun/rawAttributeValue.js +12 -0
  340. package/lib/ice-server/src/stun/rawAttributeValue.js.map +1 -0
  341. package/lib/index.mjs +47427 -25303
  342. package/lib/nonstandard/index.mjs +3076 -1318
  343. package/lib/polyfill/dom.mjs +40430 -18730
  344. package/lib/polyfill/index.mjs +40333 -18639
  345. package/lib/rtp/src/extra/processor/fsRetry.d.ts +20 -0
  346. package/lib/rtp/src/extra/processor/fsRetry.js +73 -0
  347. package/lib/rtp/src/extra/processor/fsRetry.js.map +1 -0
  348. package/lib/rtp/src/extra/processor/webm.d.ts +6 -0
  349. package/lib/rtp/src/extra/processor/webm.js +6 -2
  350. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  351. package/lib/rtp/src/extra/processor/webmCallback.d.ts +11 -0
  352. package/lib/rtp/src/extra/processor/webmCallback.js +23 -31
  353. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  354. package/lib/rtp/src/extra/processor/webmFileWriter.d.ts +24 -0
  355. package/lib/rtp/src/extra/processor/webmFileWriter.js +94 -0
  356. package/lib/rtp/src/extra/processor/webmFileWriter.js.map +1 -0
  357. package/lib/rtp/src/index.d.ts +1 -0
  358. package/lib/rtp/src/index.js +1 -0
  359. package/lib/rtp/src/index.js.map +1 -1
  360. package/lib/rtp/src/rtp/continuity.d.ts +14 -1
  361. package/lib/rtp/src/rtp/continuity.js +24 -4
  362. package/lib/rtp/src/rtp/continuity.js.map +1 -1
  363. package/lib/rtp/src/rtp/timelineRewriter.d.ts +178 -0
  364. package/lib/rtp/src/rtp/timelineRewriter.js +417 -0
  365. package/lib/rtp/src/rtp/timelineRewriter.js.map +1 -0
  366. package/lib/sctp/src/chunk.d.ts +5 -0
  367. package/lib/sctp/src/chunk.js +10 -0
  368. package/lib/sctp/src/chunk.js.map +1 -1
  369. package/lib/sctp/src/index.d.ts +1 -1
  370. package/lib/sctp/src/index.js +4 -1
  371. package/lib/sctp/src/index.js.map +1 -1
  372. package/lib/sctp/src/sctp.d.ts +86 -5
  373. package/lib/sctp/src/sctp.js +354 -75
  374. package/lib/sctp/src/sctp.js.map +1 -1
  375. package/lib/webrtc/src/api/compatibilityOptions.d.ts +43 -0
  376. package/lib/webrtc/src/api/compatibilityOptions.js +43 -0
  377. package/lib/webrtc/src/api/compatibilityOptions.js.map +1 -0
  378. package/lib/webrtc/src/api/peerConfig.d.ts +547 -36
  379. package/lib/webrtc/src/api/peerConfig.js +187 -26
  380. package/lib/webrtc/src/api/peerConfig.js.map +1 -1
  381. package/lib/webrtc/src/api/peerConnectionEvents.d.ts +87 -2
  382. package/lib/webrtc/src/api/peerConnectionEvents.js +105 -1
  383. package/lib/webrtc/src/api/peerConnectionEvents.js.map +1 -1
  384. package/lib/webrtc/src/dataChannel.d.ts +122 -10
  385. package/lib/webrtc/src/dataChannel.js +214 -20
  386. package/lib/webrtc/src/dataChannel.js.map +1 -1
  387. package/lib/webrtc/src/helper.d.ts +8 -0
  388. package/lib/webrtc/src/helper.js +40 -4
  389. package/lib/webrtc/src/helper.js.map +1 -1
  390. package/lib/webrtc/src/media/codecCompatibility.d.ts +87 -1
  391. package/lib/webrtc/src/media/codecCompatibility.js +338 -12
  392. package/lib/webrtc/src/media/codecCompatibility.js.map +1 -1
  393. package/lib/webrtc/src/media/domEventTarget.d.ts +55 -0
  394. package/lib/webrtc/src/media/domEventTarget.js +216 -0
  395. package/lib/webrtc/src/media/domEventTarget.js.map +1 -0
  396. package/lib/webrtc/src/media/index.d.ts +2 -0
  397. package/lib/webrtc/src/media/index.js +1 -0
  398. package/lib/webrtc/src/media/index.js.map +1 -1
  399. package/lib/webrtc/src/media/parameters.d.ts +5 -0
  400. package/lib/webrtc/src/media/parameters.js +10 -0
  401. package/lib/webrtc/src/media/parameters.js.map +1 -1
  402. package/lib/webrtc/src/media/receiver/nack.d.ts +43 -10
  403. package/lib/webrtc/src/media/receiver/nack.js +245 -88
  404. package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
  405. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +10 -0
  406. package/lib/webrtc/src/media/receiver/receiverTwcc.js +4 -10
  407. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  408. package/lib/webrtc/src/media/router.d.ts +245 -51
  409. package/lib/webrtc/src/media/router.js +702 -237
  410. package/lib/webrtc/src/media/router.js.map +1 -1
  411. package/lib/webrtc/src/media/routing/pendingRoutes.d.ts +26 -0
  412. package/lib/webrtc/src/media/routing/pendingRoutes.js +48 -0
  413. package/lib/webrtc/src/media/routing/pendingRoutes.js.map +1 -0
  414. package/lib/webrtc/src/media/routing/ridRouting.d.ts +37 -0
  415. package/lib/webrtc/src/media/routing/ridRouting.js +74 -0
  416. package/lib/webrtc/src/media/routing/ridRouting.js.map +1 -0
  417. package/lib/webrtc/src/media/routing/routeTable.d.ts +60 -0
  418. package/lib/webrtc/src/media/routing/routeTable.js +95 -0
  419. package/lib/webrtc/src/media/routing/routeTable.js.map +1 -0
  420. package/lib/webrtc/src/media/routing/rtcpRouting.d.ts +34 -0
  421. package/lib/webrtc/src/media/routing/rtcpRouting.js +165 -0
  422. package/lib/webrtc/src/media/routing/rtcpRouting.js.map +1 -0
  423. package/lib/webrtc/src/media/routing/unknownSsrc.d.ts +55 -0
  424. package/lib/webrtc/src/media/routing/unknownSsrc.js +117 -0
  425. package/lib/webrtc/src/media/routing/unknownSsrc.js.map +1 -0
  426. package/lib/webrtc/src/media/rtpReceiver.d.ts +277 -5
  427. package/lib/webrtc/src/media/rtpReceiver.js +826 -36
  428. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  429. package/lib/webrtc/src/media/rtpSender.d.ts +8 -1
  430. package/lib/webrtc/src/media/rtpSender.js +13 -6
  431. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  432. package/lib/webrtc/src/media/rtpTransceiver.d.ts +47 -11
  433. package/lib/webrtc/src/media/rtpTransceiver.js +95 -11
  434. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  435. package/lib/webrtc/src/media/sender/senderReportHistory.d.ts +51 -0
  436. package/lib/webrtc/src/media/sender/senderReportHistory.js +111 -0
  437. package/lib/webrtc/src/media/sender/senderReportHistory.js.map +1 -0
  438. package/lib/webrtc/src/media/sender/senderStats.d.ts +6 -5
  439. package/lib/webrtc/src/media/sender/senderStats.js +14 -19
  440. package/lib/webrtc/src/media/sender/senderStats.js.map +1 -1
  441. package/lib/webrtc/src/media/stats.d.ts +13 -0
  442. package/lib/webrtc/src/media/stats.js.map +1 -1
  443. package/lib/webrtc/src/media/track.d.ts +112 -11
  444. package/lib/webrtc/src/media/track.js +250 -19
  445. package/lib/webrtc/src/media/track.js.map +1 -1
  446. package/lib/webrtc/src/media/trackConstraints.d.ts +80 -0
  447. package/lib/webrtc/src/media/trackConstraints.js +141 -0
  448. package/lib/webrtc/src/media/trackConstraints.js.map +1 -0
  449. package/lib/webrtc/src/negotiation/internalState.d.ts +0 -4
  450. package/lib/webrtc/src/negotiation/internalState.js +0 -11
  451. package/lib/webrtc/src/negotiation/internalState.js.map +1 -1
  452. package/lib/webrtc/src/negotiation/remoteCandidates.d.ts +20 -1
  453. package/lib/webrtc/src/negotiation/remoteCandidates.js +29 -1
  454. package/lib/webrtc/src/negotiation/remoteCandidates.js.map +1 -1
  455. package/lib/webrtc/src/negotiation/remoteMediaApplication.d.ts +23 -6
  456. package/lib/webrtc/src/negotiation/remoteMediaApplication.js +46 -22
  457. package/lib/webrtc/src/negotiation/remoteMediaApplication.js.map +1 -1
  458. package/lib/webrtc/src/negotiation/transceiverPairing.d.ts +1 -0
  459. package/lib/webrtc/src/negotiation/transceiverPairing.js +62 -0
  460. package/lib/webrtc/src/negotiation/transceiverPairing.js.map +1 -0
  461. package/lib/webrtc/src/negotiation/transportActivation.d.ts +12 -1
  462. package/lib/webrtc/src/negotiation/transportActivation.js +133 -11
  463. package/lib/webrtc/src/negotiation/transportActivation.js.map +1 -1
  464. package/lib/webrtc/src/negotiationTransaction.d.ts +57 -5
  465. package/lib/webrtc/src/negotiationTransaction.js +134 -10
  466. package/lib/webrtc/src/negotiationTransaction.js.map +1 -1
  467. package/lib/webrtc/src/nonstandard/dummyMedia.d.ts +6 -0
  468. package/lib/webrtc/src/nonstandard/dummyMedia.js +14 -19
  469. package/lib/webrtc/src/nonstandard/dummyMedia.js.map +1 -1
  470. package/lib/webrtc/src/nonstandard/navigator.d.ts +1 -1
  471. package/lib/webrtc/src/nonstandard/recorder/index.js +5 -1
  472. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  473. package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +6 -1
  474. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +31 -2
  475. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  476. package/lib/webrtc/src/nonstandard/userMedia/packetizer.d.ts +16 -0
  477. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js +25 -0
  478. package/lib/webrtc/src/nonstandard/userMedia/packetizer.js.map +1 -1
  479. package/lib/webrtc/src/nonstandard/userMedia.js +6 -13
  480. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  481. package/lib/webrtc/src/peerConnection.d.ts +106 -11
  482. package/lib/webrtc/src/peerConnection.js +370 -36
  483. package/lib/webrtc/src/peerConnection.js.map +1 -1
  484. package/lib/webrtc/src/polyfill/api.d.ts +2 -1
  485. package/lib/webrtc/src/polyfill/api.js +3 -3
  486. package/lib/webrtc/src/polyfill/api.js.map +1 -1
  487. package/lib/webrtc/src/polyfill/dom.d.ts +21 -7
  488. package/lib/webrtc/src/polyfill/dom.js +15 -0
  489. package/lib/webrtc/src/polyfill/dom.js.map +1 -1
  490. package/lib/webrtc/src/polyfill/globals.d.ts +8 -3
  491. package/lib/webrtc/src/polyfill/globals.js.map +1 -1
  492. package/lib/webrtc/src/polyfill/index.d.ts +1 -1
  493. package/lib/webrtc/src/polyfill/index.js +1 -1
  494. package/lib/webrtc/src/polyfill/index.js.map +1 -1
  495. package/lib/webrtc/src/polyfill/install.d.ts +5 -1
  496. package/lib/webrtc/src/polyfill/install.js +4 -2
  497. package/lib/webrtc/src/polyfill/install.js.map +1 -1
  498. package/lib/webrtc/src/polyfill/mediaDevices.js +28 -4
  499. package/lib/webrtc/src/polyfill/mediaDevices.js.map +1 -1
  500. package/lib/webrtc/src/polyfill/peerConnectionConfig.d.ts +6 -0
  501. package/lib/webrtc/src/polyfill/peerConnectionConfig.js +15 -4
  502. package/lib/webrtc/src/polyfill/peerConnectionConfig.js.map +1 -1
  503. package/lib/webrtc/src/polyfill/selectSettings.d.ts +4 -14
  504. package/lib/webrtc/src/polyfill/selectSettings.js +10 -106
  505. package/lib/webrtc/src/polyfill/selectSettings.js.map +1 -1
  506. package/lib/webrtc/src/polyfill/sourceIo.d.ts +1 -2
  507. package/lib/webrtc/src/polyfill/sourceIo.js +6 -6
  508. package/lib/webrtc/src/polyfill/sourceIo.js.map +1 -1
  509. package/lib/webrtc/src/sctpManager.d.ts +31 -18
  510. package/lib/webrtc/src/sctpManager.js +162 -38
  511. package/lib/webrtc/src/sctpManager.js.map +1 -1
  512. package/lib/webrtc/src/sdp.d.ts +107 -2
  513. package/lib/webrtc/src/sdp.js +223 -17
  514. package/lib/webrtc/src/sdp.js.map +1 -1
  515. package/lib/webrtc/src/sdpManager.d.ts +101 -10
  516. package/lib/webrtc/src/sdpManager.js +236 -14
  517. package/lib/webrtc/src/sdpManager.js.map +1 -1
  518. package/lib/webrtc/src/secureTransportManager.d.ts +49 -3
  519. package/lib/webrtc/src/secureTransportManager.js +166 -12
  520. package/lib/webrtc/src/secureTransportManager.js.map +1 -1
  521. package/lib/webrtc/src/transceiverManager.d.ts +87 -6
  522. package/lib/webrtc/src/transceiverManager.js +272 -51
  523. package/lib/webrtc/src/transceiverManager.js.map +1 -1
  524. package/lib/webrtc/src/transport/dtls-application-gate.d.ts +1 -0
  525. package/lib/webrtc/src/transport/dtls-application-gate.js +143 -0
  526. package/lib/webrtc/src/transport/dtls-application-gate.js.map +1 -0
  527. package/lib/webrtc/src/transport/dtls-attempt.d.ts +1 -0
  528. package/lib/webrtc/src/transport/dtls-attempt.js +79 -0
  529. package/lib/webrtc/src/transport/dtls-attempt.js.map +1 -0
  530. package/lib/webrtc/src/transport/dtls-certificate.d.ts +24 -0
  531. package/lib/webrtc/src/transport/dtls-certificate.js +98 -0
  532. package/lib/webrtc/src/transport/dtls-certificate.js.map +1 -0
  533. package/lib/webrtc/src/transport/dtls-fingerprint.d.ts +7 -0
  534. package/lib/webrtc/src/transport/dtls-fingerprint.js +66 -0
  535. package/lib/webrtc/src/transport/dtls-fingerprint.js.map +1 -0
  536. package/lib/webrtc/src/transport/dtls-ice-transport.d.ts +1 -0
  537. package/lib/webrtc/src/transport/dtls-ice-transport.js +123 -0
  538. package/lib/webrtc/src/transport/dtls-ice-transport.js.map +1 -0
  539. package/lib/webrtc/src/transport/dtls-media-queue.d.ts +1 -0
  540. package/lib/webrtc/src/transport/dtls-media-queue.js +95 -0
  541. package/lib/webrtc/src/transport/dtls-media-queue.js.map +1 -0
  542. package/lib/webrtc/src/transport/dtls-readiness.d.ts +1 -0
  543. package/lib/webrtc/src/transport/dtls-readiness.js +173 -0
  544. package/lib/webrtc/src/transport/dtls-readiness.js.map +1 -0
  545. package/lib/webrtc/src/transport/dtls-sped-handshake.d.ts +1 -0
  546. package/lib/webrtc/src/transport/dtls-sped-handshake.js +146 -0
  547. package/lib/webrtc/src/transport/dtls-sped-handshake.js.map +1 -0
  548. package/lib/webrtc/src/transport/dtls-srtp.d.ts +1 -0
  549. package/lib/webrtc/src/transport/dtls-srtp.js +133 -0
  550. package/lib/webrtc/src/transport/dtls-srtp.js.map +1 -0
  551. package/lib/webrtc/src/transport/dtls-stats.d.ts +1 -0
  552. package/lib/webrtc/src/transport/dtls-stats.js +134 -0
  553. package/lib/webrtc/src/transport/dtls-stats.js.map +1 -0
  554. package/lib/webrtc/src/transport/dtls-types.d.ts +23 -0
  555. package/lib/webrtc/src/transport/dtls-types.js +11 -0
  556. package/lib/webrtc/src/transport/dtls-types.js.map +1 -0
  557. package/lib/webrtc/src/transport/dtls.d.ts +236 -47
  558. package/lib/webrtc/src/transport/dtls.js +1198 -441
  559. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  560. package/lib/webrtc/src/transport/ice.d.ts +95 -5
  561. package/lib/webrtc/src/transport/ice.js +323 -21
  562. package/lib/webrtc/src/transport/ice.js.map +1 -1
  563. package/lib/webrtc/src/transport/iceCandidateAttribute.d.ts +4 -2
  564. package/lib/webrtc/src/transport/iceCandidateAttribute.js.map +1 -1
  565. package/lib/webrtc/src/transport/sctp.d.ts +149 -2
  566. package/lib/webrtc/src/transport/sctp.js +826 -128
  567. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  568. package/lib/webrtc/src/transport/sped.d.ts +139 -0
  569. package/lib/webrtc/src/transport/sped.js +757 -0
  570. package/lib/webrtc/src/transport/sped.js.map +1 -0
  571. package/lib/webrtc/src/types/util.d.ts +6 -0
  572. package/lib/webrtc/src/types/util.js.map +1 -1
  573. package/lib/webrtc/src/utils.d.ts +34 -1
  574. package/lib/webrtc/src/utils.js +52 -3
  575. package/lib/webrtc/src/utils.js.map +1 -1
  576. package/lib/webrtc/src/webidl.d.ts +15 -0
  577. package/lib/webrtc/src/webidl.js +34 -0
  578. package/lib/webrtc/src/webidl.js.map +1 -0
  579. package/package.json +8 -3
  580. package/lib/webrtc/src/polyfill/rtcSessionDescription.d.ts +0 -18
  581. package/lib/webrtc/src/polyfill/rtcSessionDescription.js +0 -36
  582. package/lib/webrtc/src/polyfill/rtcSessionDescription.js.map +0 -1
@@ -1,12 +1,14 @@
1
1
  import type { Address, InterfaceAddresses, TlsConnectionOptions } from "../imports/common";
2
- import type { CandidatePair, Message, Protocol } from "../imports/ice";
2
+ import type { DtlsVersion } from "../imports/dtls";
3
+ import type { CandidatePair, IceFailoverOptions, Message, MessageIntegrityMode, Protocol } from "../imports/ice";
3
4
  import type { RTCRtpCodecParameters, RTCRtpHeaderExtensionParameters } from "../media/parameters";
4
- import { type KeyFrameRequestRouting } from "../media/router";
5
+ import type { KeyFrameRequestRouting } from "../media/router";
5
6
  import type { RTCRtpSenderOptions } from "../media/rtpSender";
6
7
  import type { BandwidthEstimatorOption } from "../media/sender/createBandwidthEstimator";
7
8
  import type { BundlePolicy } from "../sdp";
8
- import type { MLineReuse } from "../sdpManager";
9
+ import { type BundleCandidates, type MLineReuse } from "../sdpManager";
9
10
  import type { DtlsKeys, RTCCertificate } from "../transport/dtls";
11
+ import { type CompatibilityOptionValue } from "./compatibilityOptions";
10
12
  export type DebugConfig = Partial<{
11
13
  /**% */
12
14
  inboundPacketLoss: number;
@@ -53,11 +55,29 @@ export interface PeerConfig {
53
55
  * VPN, ...). If the bind fails, the family has no UDP host candidate.
54
56
  * A family left unspecified while the other one is set gathers no
55
57
  * enumerated addresses (only its `iceAdditionalHostAddresses`).
58
+ *
59
+ * When unset, each enumerated interface address gets a UDP host socket
60
+ * bound to that address, so connectivity checks leave from the advertised
61
+ * candidate on multi-NIC hosts. An address whose bind fails is not
62
+ * advertised. VPN / tunnel interfaces (`tun`, `utun`, `ipsec`, `tap`) are
63
+ * gathered with a low priority and the default-route address with the
64
+ * highest: the source address of the route to the configured STUN / TURN
65
+ * server (without one, no address is preferred and nothing else is probed).
66
+ * With a STUN server, one more socket per family is bound to the
67
+ * wildcard address: it advertises no host candidate but maps the route the
68
+ * OS picks (server-reflexive candidate with `raddr 0.0.0.0`).
69
+ * `setLocalDescription()` waits only for that socket and the
70
+ * default-route one; the other interfaces' server-reflexive candidates
71
+ * trickle through `onicecandidate` before the end-of-candidates `null`.
72
+ * Set a family to `0.0.0.0` / `::` to gather its enumerated addresses over
73
+ * wildcard sockets instead.
56
74
  */
57
75
  iceInterfaceAddresses: InterfaceAddresses | undefined;
58
76
  /** Add additional host (local) addresses to use for candidate gathering.
59
- * Notably, you can include hosts that are normally excluded, such as loopback, tun interfaces, etc.
77
+ * Notably, you can include hosts that are normally excluded, such as loopback, vmnet / veth interfaces, etc.
60
78
  * For a family bound by `iceInterfaceAddresses`, addresses other than the bound one are ignored.
79
+ * An address assigned to a local interface is bound like an enumerated one; any other address
80
+ * (a 1:1 NAT public address, for example) is gathered over a wildcard socket.
61
81
  */
62
82
  iceAdditionalHostAddresses: string[] | undefined;
63
83
  iceUseIpv4: boolean;
@@ -67,7 +87,8 @@ export interface PeerConfig {
67
87
  iceTcpPassive: boolean;
68
88
  /**
69
89
  * Seconds to wait for server-reflexive candidates while gathering.
70
- * Defaults to 5 when undefined.
90
+ * Defaults to 5 when undefined. `setLocalDescription()` waits for it only
91
+ * on the wildcard and default-route sockets (see `iceInterfaceAddresses`).
71
92
  */
72
93
  iceStunGatherTimeout: number | undefined;
73
94
  /**
@@ -75,6 +96,57 @@ export interface PeerConfig {
75
96
  * Defaults to 8 when undefined.
76
97
  */
77
98
  iceTurnConnectTimeout: number | undefined;
99
+ /**
100
+ * Seconds ICE waits for a connectivity check from the peer when it has no
101
+ * candidate pair of its own to check after both sides ended their
102
+ * candidates (the peer offered only active TCP candidates, as Firefox does
103
+ * for ICE-TCP, or none werift can reach). Without a check in that time the
104
+ * ICE transport fails. With `iceLite`, which sends no checks, ICE waits the
105
+ * same time whenever it has no candidate pair, also while it still
106
+ * gathers. The deadline is fixed when the wait begins; once gathering ended
107
+ * without a socket that could receive a check, ICE fails at once. Defaults
108
+ * to 30 when undefined; 0 fails at once.
109
+ */
110
+ iceIncomingCheckTimeout: number | undefined;
111
+ /**
112
+ * werift extension. With `iceNomination: "regular"`: milliseconds the
113
+ * controlling ICE agent keeps checking before it nominates a candidate pair,
114
+ * so a higher-priority candidate trickled shortly after a lower-priority one
115
+ * succeeded can still be selected. Maps to `IceOptions.nominationDelayMs`:
116
+ * 300 when undefined, 0 nominates the first valid pair at once.
117
+ */
118
+ iceNominationDelayMs: number | undefined;
119
+ /**
120
+ * werift extension. How the controlling ICE agent nominates toward a full
121
+ * ICE peer (`IceOptions.nomination`). `"semi-aggressive"` (default when
122
+ * undefined, as Chrome): the first pair whose check succeeds is selected at
123
+ * once and a higher-priority pair that succeeds later replaces it.
124
+ * `"regular"`: RFC 8445 regular nomination, one nomination after
125
+ * `iceNominationDelayMs`.
126
+ */
127
+ iceNomination: "semi-aggressive" | "regular" | undefined;
128
+ /**
129
+ * werift extension. Enable ICE renomination
130
+ * (draft-thatcher-ice-renomination, as libwebrtc implements it): every
131
+ * description advertises `a=ice-options:trickle renomination`. When the
132
+ * remote description advertises `renomination` too, the controlling agent
133
+ * nominates with the NOMINATION STUN attribute and an increasing value, so
134
+ * a later, better pair reliably replaces the selection on both sides
135
+ * (`IceOptions.renomination`). Chrome advertises it only when its SDP is
136
+ * modified before `setLocalDescription`; as the controlled side it honours
137
+ * the attribute regardless. Defaults to false.
138
+ */
139
+ iceRenomination: boolean;
140
+ /**
141
+ * werift extension. Thresholds of the failover of the selected candidate
142
+ * pair without an ICE restart (with semi-aggressive nomination or
143
+ * renomination): how soon a pair is unwritable (`unwritableMinChecks`,
144
+ * `unwritableTimeout`) and how soon a selected pair that stopped receiving
145
+ * moves to a backup (`receivingTimeout`, `receivingSwitchingDelay`). Maps
146
+ * to `IceOptions.failover`; each unset or invalid value keeps its default
147
+ * (libwebrtc's: 5 checks, 5000 ms, 2500 ms, 1000 ms).
148
+ */
149
+ iceFailover: IceFailoverOptions | undefined;
78
150
  turnTransport: "udp" | "tcp" | "tls" | undefined;
79
151
  turnTlsOptions: TlsConnectionOptions | undefined;
80
152
  /**
@@ -91,8 +163,82 @@ export interface PeerConfig {
91
163
  * Return `true` if a STUN response should be sent, false if it should be skipped. */
92
164
  iceFilterStunResponse: ((message: Message, addr: Address, protocol: Protocol) => boolean) | undefined;
93
165
  iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;
166
+ /**
167
+ * Opt-in SPED (DTLS handshake embedded in ICE Binding).
168
+ * Omit or false: ICE completes, then DTLS starts (current serial path).
169
+ * true: this PeerConnection only overlaps ICE checks with DTLS 1.3 handshake.
170
+ * Requires explicit DTLS 1.3 in `dtls.protocolVersions`
171
+ * (`dtls.protocolVersions` defaults to empty / DTLS 1.2 only).
172
+ * Cannot be combined with `dtls.helloRetryRequest: true`
173
+ * (SPED uses ICE-authenticated address validation, not a DTLS cookie).
174
+ * Both are validated by the constructor and `setConfiguration()`, which
175
+ * throw synchronously and leave the configuration unchanged.
176
+ */
177
+ sped?: boolean;
178
+ /**
179
+ * WARP early outbound and encrypted-media buffering policy.
180
+ * - `allowEarlyServerData` (default false): the DTLS server may send
181
+ * application data / media before the SDP fingerprint is verified.
182
+ * Requires {@link PeerConfig.sped} `true` and DTLS 1.3; the constructor
183
+ * and `setConfiguration()` throw synchronously otherwise.
184
+ * - `earlyMediaPolicy` (default `"drop"`): `"buffer"` retains inbound
185
+ * encrypted media received before authentication (bounded) instead of
186
+ * dropping it. Inbound data is never delivered before authentication.
187
+ * - `sendBeforeNomination` (default false): once the DTLS handshake is
188
+ * done on this side (the DTLS client right after its Finished) and the
189
+ * peer is authenticated, send application data and media on a valid
190
+ * candidate pair (its own connectivity check succeeded) instead of
191
+ * waiting for ICE nomination and consent (RFC 8445 §12.1, SPED
192
+ * draft-00 §3.1.2.2). Applies only until a selected pair exists; never
193
+ * during an ICE restart or on relay pairs. A peer that drops data
194
+ * arriving before its own nomination only loses it like any packet loss
195
+ * (SCTP retransmits). Requires {@link PeerConfig.sped} `true`; the
196
+ * constructor and `setConfiguration()` throw synchronously otherwise.
197
+ * `setConfiguration()` merges these fields and applies them to every open
198
+ * DTLS transport, including ones a pending description prepared.
199
+ */
200
+ warp?: {
201
+ allowEarlyServerData?: boolean;
202
+ earlyMediaPolicy?: "drop" | "buffer";
203
+ sendBeforeNomination?: boolean;
204
+ };
205
+ /**
206
+ * Integrity attributes of the ICE connectivity checks and consent requests
207
+ * werift sends (RFC 8489 short-term credentials). Applies to ICE transports
208
+ * created after it is set.
209
+ * - `undefined` / `"sha1"` (default): MESSAGE-INTEGRITY only. Browsers
210
+ * (libwebrtc, Firefox) accept this.
211
+ * - `"sha256"`: MESSAGE-INTEGRITY-SHA256 only. Only for peers known to
212
+ * support it: a peer that does not know the attribute rejects the checks.
213
+ * - `"both"`: MESSAGE-INTEGRITY followed by MESSAGE-INTEGRITY-SHA256.
214
+ *
215
+ * Checks and responses from the peer are accepted with either algorithm,
216
+ * and responses are always signed with the algorithm of the request.
217
+ */
218
+ iceMessageIntegrity: MessageIntegrityMode | undefined;
219
+ /**
220
+ * Advertise the `ice2` ice-option (`a=ice-options:trickle ice2`, RFC 8445
221
+ * §10 / RFC 8839) to declare an RFC 8445 agent. Defaults to false
222
+ * (`a=ice-options:trickle`). It is only a declaration: werift runs the
223
+ * RFC 8445 procedures either way. Cannot be changed after construction.
224
+ */
225
+ iceOptionIce2: boolean;
94
226
  dtls: Partial<{
95
227
  keys: DtlsKeys;
228
+ /**
229
+ * DTLS protocol versions in preference order.
230
+ * Unspecified / empty keeps DTLS 1.2 only. DTLS 1.3 requires explicit opt-in.
231
+ * Independent of {@link PeerConfig.sped} (SPED also requires DTLS 1.3; validated by the constructor / setConfiguration()).
232
+ */
233
+ protocolVersions: readonly DtlsVersion[];
234
+ /**
235
+ * DTLS 1.3 HelloRetryRequest cookie exchange.
236
+ * Default false: ICE-authenticated path omits cookie HRR and saves 1 RTT.
237
+ * true: send a cookie-bearing HRR (mapped internally to addressValidation: "dtls-cookie").
238
+ * Group-only HRR for key_share correction is independent of this option.
239
+ * Cannot be combined with {@link PeerConfig.sped} `true`.
240
+ */
241
+ helloRetryRequest?: boolean;
96
242
  }>;
97
243
  icePasswordPrefix: string | undefined;
98
244
  bundlePolicy: BundlePolicy;
@@ -100,18 +246,39 @@ export interface PeerConfig {
100
246
  iceCandidatePoolSize: number;
101
247
  certificates: RTCCertificate[];
102
248
  /**
103
- * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given.
104
- * Cannot be changed after construction.
105
- * - `"process"` (default): one certificate shared by every RTCPeerConnection in the process
106
- * (legacy behavior), so their `a=fingerprint` values are identical.
107
- * - `"peerConnection"`: each RTCPeerConnection generates its own certificate (browser behavior).
249
+ * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given
250
+ * (see {@link CompatibilityOptionValues}). Cannot be changed after construction.
251
+ * - `"process"` (default): one certificate shared by every RTCPeerConnection in the process,
252
+ * so their `a=fingerprint` values are identical.
253
+ * - `"standard"`: each RTCPeerConnection generates its own certificate, as browsers do.
108
254
  * All DTLS transports of that connection share it.
255
+ *
256
+ * Also accepts the v0.27.0 name `"peerConnection"` (= `"standard"`).
109
257
  */
110
258
  certificateScope: CertificateScope;
111
259
  debug: DebugConfig;
112
260
  midSuffix: boolean;
113
261
  /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
114
262
  maxMessageSize: number;
263
+ /**
264
+ * The initial `binaryType` of every data channel this connection creates,
265
+ * by `createDataChannel()` or announced by the remote peer (a compatibility
266
+ * option, see {@link CompatibilityOptionValues} and
267
+ * {@link RTCDataChannelBinaryType}).
268
+ * - `"nodebuffer"` (default, werift's own value): binary messages arrive as
269
+ * a Node.js `Buffer`, as before this option existed.
270
+ * - `"standard"`: the browser default, `"arraybuffer"` (W3C); the channel's
271
+ * `binaryType` reads `"arraybuffer"`.
272
+ * - `"arraybuffer"` / `"blob"`: binary messages arrive as an `ArrayBuffer`
273
+ * / a `Blob` (`werift/polyfill` uses `"arraybuffer"`).
274
+ *
275
+ * Another value is a `TypeError`. `compatibility: "standard"` sets it to
276
+ * `"standard"` when it is not given. `setConfiguration()` may change it; the
277
+ * new value applies to channels created afterwards, and an existing
278
+ * channel changes with its own `binaryType` setter.
279
+ * @see tests/datachannel/binaryType.test.ts "dataChannelBinaryType: standard gives channels the W3C default arraybuffer"
280
+ */
281
+ dataChannelBinaryType: DataChannelBinaryTypeOption;
115
282
  /**
116
283
  * When true, padding-only RTP is omitted from onReceiveRtp and later media
117
284
  * sequence numbers are compacted. Default false preserves wire RTP events.
@@ -129,21 +296,144 @@ export interface PeerConfig {
129
296
  */
130
297
  pendingRtp: NonNullable<RTCRtpSenderOptions["pendingRtp"]>;
131
298
  /**
132
- * How local SDP marks inactive / stopped m-lines. Cannot be changed after construction.
133
- * - `"compatible"` (default): an accepted `inactive` m-line keeps a non-zero port.
134
- * Only rejected (no common codec / remote port 0) or stopped m-lines use port 0,
135
- * and only those negotiated port 0 positions are reused by new transceivers.
136
- * - `"aggressive"`: legacy behavior. `inactive` m-lines are also written with port 0.
299
+ * How local SDP marks inactive / stopped m-lines (see {@link CompatibilityOptionValues}).
300
+ * Cannot be changed after construction.
301
+ * - `"standard"` (default): an accepted `inactive` m-line keeps a non-zero port, as JSEP
302
+ * and browsers do. Only rejected (no common codec / remote port 0) or stopped m-lines
303
+ * use port 0, and only those negotiated port 0 positions are reused by new transceivers.
304
+ * - `"aggressive"`: behavior before v0.25.0. `inactive` m-lines are also written with
305
+ * port 0, so the remote side treats them as rejected and their positions are reused.
306
+ *
307
+ * Also accepts the v0.27.0 name `"compatible"` (= `"standard"`).
137
308
  */
138
309
  mLineReuse: MLineReuse;
139
310
  /**
140
- * Where a PLI / FIR goes when no route has its target SSRC. See {@link KeyFrameRequestRouting}.
141
- * - `"compatible"` (default): the sender whose RTX SSRC it is, else the only video sender.
142
- * - `"strict"`: not delivered, as RFC 4585 / RFC 5104 define the target.
311
+ * How a remote offer's m-sections are paired with local transceivers that
312
+ * have no MID yet (see {@link CompatibilityOptionValues}). Cannot be changed
313
+ * after construction.
314
+ * - `"byKind"` (default): behavior up to v0.27.0. Any unassociated,
315
+ * non-stopped transceiver of the same kind is paired (the one at the same
316
+ * m-line index first), whatever created it. In glare (perfect negotiation)
317
+ * the remote offer can take over a transceiver created with
318
+ * `addTransceiver(kind, { direction: "sendonly" })` and its direction
319
+ * becomes `sendrecv`.
320
+ * - `"standard"`: RFC 8829 (JSEP) section 5.10, as browsers do. An
321
+ * m-section whose MID no transceiver has is associated only with an
322
+ * unassociated, non-stopped transceiver of the same kind that
323
+ * `addTrack()` created (or one a rollback promoted to that, JSEP 4.1.8.2),
324
+ * and only when the m-section is `sendrecv` or `recvonly`. A transceiver
325
+ * created by `addTransceiver()` (with or without a track, also after
326
+ * `replaceTrack()` or a later `addTrack()` reusing it) is never paired:
327
+ * the offer gets a new transceiver, and the local one keeps its direction
328
+ * and `mid === null` until a local offer negotiates it. Use it for the
329
+ * perfect negotiation pattern and for code written for browsers.
330
+ */
331
+ transceiverPairing: TransceiverPairing;
332
+ /**
333
+ * Where a PLI / FIR goes when no route has its target SSRC (see
334
+ * {@link CompatibilityOptionValues} and {@link KeyFrameRequestRouting}).
335
+ * `setConfiguration()` may change it.
336
+ * - `"fallback"` (default): the sender whose RTX SSRC it is, else the only video sender.
337
+ * - `"standard"`: not delivered, as RFC 4585 / RFC 5104 define the target.
338
+ *
339
+ * Also accepts the names up to v0.27.0: `"compatible"` (= `"fallback"`) and
340
+ * `"strict"` (= `"standard"`).
143
341
  */
144
342
  keyFrameRequestRouting: KeyFrameRequestRouting;
343
+ /**
344
+ * How strictly the DTLS 1.2 handshake validates the peer's messages (see
345
+ * {@link CompatibilityOptionValues}). Cannot be changed after construction.
346
+ * - `"lenient"` (default): a malformed `supported_versions` is ignored and
347
+ * DTLS 1.2 negotiated, duplicate extensions are accepted and `use_srtp`
348
+ * is read without length checks, as before the strict checks.
349
+ * - `"standard"`: RFC-strict; these fail the handshake (a malformed
350
+ * `supported_versions` with a `protocol_version` alert).
351
+ *
352
+ * A `supported_versions` without an overlapping version fails either way,
353
+ * and DTLS 1.3 always validates strictly.
354
+ */
355
+ dtlsHandshakeValidation: DtlsHandshakeValidation;
356
+ /**
357
+ * Which m-lines of a BUNDLE group carry the local ICE candidates.
358
+ * Cannot be changed after construction. See {@link BundleCandidates}.
359
+ * - `"legacy"` (default): every m-line repeats its transport's candidates and
360
+ * `a=end-of-candidates` (werift's earlier output).
361
+ * - `"compatible"`: as Chrome writes them, only the BUNDLE tag m-line carries
362
+ * them, so renegotiation with more m-lines no longer repeats the candidate list.
363
+ */
364
+ bundleCandidates: BundleCandidates;
365
+ /**
366
+ * Sets every compatibility option (`certificateScope`, `mLineReuse`,
367
+ * `transceiverPairing`, `keyFrameRequestRouting`,
368
+ * `dtlsHandshakeValidation`, `dataChannelBinaryType`, see
369
+ * {@link CompatibilityOptionValues}) to the specification / browser behavior
370
+ * at once. Cannot be changed after construction.
371
+ * - `undefined` (default): each option keeps its own default.
372
+ * - `"standard"`: every compatibility option not given in the same
373
+ * configuration is `"standard"`.
374
+ *
375
+ * An option given explicitly always takes precedence over `compatibility`:
376
+ * a value given in the same configuration (an old name included) is kept,
377
+ * and `setConfiguration()` treats the options as if `compatibility` were
378
+ * not set (`keyFrameRequestRouting` and `dataChannelBinaryType` may
379
+ * change, the others cannot). An
380
+ * option given as `undefined` counts as not given.
381
+ *
382
+ * ```ts
383
+ * new RTCPeerConnection({ compatibility: "standard" });
384
+ * // certificateScope, mLineReuse, transceiverPairing,
385
+ * // keyFrameRequestRouting, dtlsHandshakeValidation and
386
+ * // dataChannelBinaryType are all "standard"
387
+ * new RTCPeerConnection({ compatibility: "standard", certificateScope: "process" });
388
+ * // certificateScope is "process", the others are "standard"
389
+ * ```
390
+ *
391
+ * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not
392
+ * compatibility options.
393
+ * @see tests/datachannel/binaryType.test.ts "compatibility: standard makes data channels deliver ArrayBuffer unless dataChannelBinaryType is given"
394
+ */
395
+ compatibility: CompatibilityPreset | undefined;
145
396
  }
146
- export type CertificateScope = "process" | "peerConnection";
397
+ /** Which default DTLS certificate is used. See {@link PeerConfig.certificateScope}. */
398
+ export type CertificateScope = CompatibilityOptionValue<"certificateScope">;
399
+ export declare const CertificateScopeModes: readonly CertificateScope[];
400
+ /** How local SDP marks inactive / stopped m-lines. See {@link PeerConfig.mLineReuse}. */
401
+ export declare const MLineReuseModes: readonly MLineReuse[];
402
+ /** How a remote offer pairs m-sections with local transceivers. See {@link PeerConfig.transceiverPairing}. */
403
+ export type TransceiverPairing = CompatibilityOptionValue<"transceiverPairing">;
404
+ export declare const TransceiverPairingModes: readonly TransceiverPairing[];
405
+ /** How strictly the DTLS 1.2 handshake validates the peer. See {@link PeerConfig.dtlsHandshakeValidation}. */
406
+ export type DtlsHandshakeValidation = CompatibilityOptionValue<"dtlsHandshakeValidation">;
407
+ export declare const DtlsHandshakeValidationModes: readonly DtlsHandshakeValidation[];
408
+ /** The initial `binaryType` of new data channels. See {@link PeerConfig.dataChannelBinaryType}. */
409
+ export type DataChannelBinaryTypeOption = CompatibilityOptionValue<"dataChannelBinaryType">;
410
+ export declare const DataChannelBinaryTypeModes: readonly DataChannelBinaryTypeOption[];
411
+ /** The values of {@link PeerConfig.compatibility}. */
412
+ export type CompatibilityPreset = "standard";
413
+ export declare const CompatibilityPresets: readonly CompatibilityPreset[];
414
+ /**
415
+ * The values the compatibility options used up to v0.27.0 that are not
416
+ * values any more, and the value each one is read as. They are accepted on
417
+ * input only: `getConfiguration()` returns the current name.
418
+ */
419
+ export declare const DeprecatedCompatibilityValues: {
420
+ readonly certificateScope: {
421
+ readonly peerConnection: "standard";
422
+ };
423
+ readonly mLineReuse: {
424
+ readonly compatible: "standard";
425
+ };
426
+ readonly keyFrameRequestRouting: {
427
+ readonly compatible: "fallback";
428
+ readonly strict: "standard";
429
+ };
430
+ };
431
+ /** @deprecated Use `"standard"` (`"peerConnection"`). */
432
+ export type DeprecatedCertificateScope = keyof (typeof DeprecatedCompatibilityValues)["certificateScope"];
433
+ /** @deprecated Use `"standard"` (`"compatible"`). */
434
+ export type DeprecatedMLineReuse = keyof (typeof DeprecatedCompatibilityValues)["mLineReuse"];
435
+ /** @deprecated Use `"fallback"` (`"compatible"`) or `"standard"` (`"strict"`). */
436
+ export type DeprecatedKeyFrameRequestRouting = keyof (typeof DeprecatedCompatibilityValues)["keyFrameRequestRouting"];
147
437
  export declare const findCodecByMimeType: (codecs: RTCRtpCodecParameters[], target: RTCRtpCodecParameters) => RTCRtpCodecParameters | undefined;
148
438
  export type RTCIceServer = {
149
439
  urls: string | string[];
@@ -167,10 +457,17 @@ export interface RTCConfiguration {
167
457
  type RTCPeerConnectionRTCConfiguration = Omit<RTCConfiguration, "bundlePolicy"> & {
168
458
  bundlePolicy?: PeerConfig["bundlePolicy"] | RTCBundlePolicy;
169
459
  };
170
- export type RTCPeerConnectionConfig = Partial<Omit<PeerConfig, "bundlePolicy" | "rtcpMuxPolicy" | "iceCandidatePoolSize" | "certificates" | "sctp">> & RTCPeerConnectionRTCConfiguration & {
460
+ export type RTCPeerConnectionConfig = Partial<Omit<PeerConfig, "bundlePolicy" | "rtcpMuxPolicy" | "iceCandidatePoolSize" | "certificates" | "sctp" | "certificateScope" | "mLineReuse" | "keyFrameRequestRouting">> & RTCPeerConnectionRTCConfiguration & {
171
461
  sctp?: RTCSctpConfiguration;
462
+ /** See {@link PeerConfig.certificateScope}. */
463
+ certificateScope?: CertificateScope | DeprecatedCertificateScope;
464
+ /** See {@link PeerConfig.mLineReuse}. */
465
+ mLineReuse?: MLineReuse | DeprecatedMLineReuse;
466
+ /** See {@link PeerConfig.keyFrameRequestRouting}. */
467
+ keyFrameRequestRouting?: KeyFrameRequestRouting | DeprecatedKeyFrameRequestRouting;
172
468
  };
173
- export declare function generateDefaultPeerConfig(): PeerConfig;
469
+ export declare function peerConfigHasDtls13(config: PeerConfig): boolean;
470
+ export declare function generateDefaultPeerConfig(): Required<PeerConfig>;
174
471
  export declare const defaultPeerConfig: PeerConfig;
175
472
  export declare function clonePeerConfiguration(config: PeerConfig): {
176
473
  codecs: {
@@ -189,8 +486,15 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
189
486
  icePortRange: [number, number] | undefined;
190
487
  iceAdditionalHostAddresses: string[] | undefined;
191
488
  dtls: {
489
+ protocolVersions: DtlsVersion[] | undefined;
490
+ helloRetryRequest: boolean | undefined;
192
491
  keys?: DtlsKeys | undefined;
193
492
  };
493
+ warp: {
494
+ allowEarlyServerData?: boolean;
495
+ earlyMediaPolicy?: "drop" | "buffer";
496
+ sendBeforeNomination?: boolean;
497
+ } | undefined;
194
498
  certificates: RTCCertificate[];
195
499
  debug: {
196
500
  inboundPacketLoss?: number | undefined;
@@ -226,6 +530,22 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
226
530
  * VPN, ...). If the bind fails, the family has no UDP host candidate.
227
531
  * A family left unspecified while the other one is set gathers no
228
532
  * enumerated addresses (only its `iceAdditionalHostAddresses`).
533
+ *
534
+ * When unset, each enumerated interface address gets a UDP host socket
535
+ * bound to that address, so connectivity checks leave from the advertised
536
+ * candidate on multi-NIC hosts. An address whose bind fails is not
537
+ * advertised. VPN / tunnel interfaces (`tun`, `utun`, `ipsec`, `tap`) are
538
+ * gathered with a low priority and the default-route address with the
539
+ * highest: the source address of the route to the configured STUN / TURN
540
+ * server (without one, no address is preferred and nothing else is probed).
541
+ * With a STUN server, one more socket per family is bound to the
542
+ * wildcard address: it advertises no host candidate but maps the route the
543
+ * OS picks (server-reflexive candidate with `raddr 0.0.0.0`).
544
+ * `setLocalDescription()` waits only for that socket and the
545
+ * default-route one; the other interfaces' server-reflexive candidates
546
+ * trickle through `onicecandidate` before the end-of-candidates `null`.
547
+ * Set a family to `0.0.0.0` / `::` to gather its enumerated addresses over
548
+ * wildcard sockets instead.
229
549
  */
230
550
  iceInterfaceAddresses: InterfaceAddresses | undefined;
231
551
  iceUseIpv4: boolean;
@@ -235,7 +555,8 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
235
555
  iceTcpPassive: boolean;
236
556
  /**
237
557
  * Seconds to wait for server-reflexive candidates while gathering.
238
- * Defaults to 5 when undefined.
558
+ * Defaults to 5 when undefined. `setLocalDescription()` waits for it only
559
+ * on the wildcard and default-route sockets (see `iceInterfaceAddresses`).
239
560
  */
240
561
  iceStunGatherTimeout: number | undefined;
241
562
  /**
@@ -243,6 +564,57 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
243
564
  * Defaults to 8 when undefined.
244
565
  */
245
566
  iceTurnConnectTimeout: number | undefined;
567
+ /**
568
+ * Seconds ICE waits for a connectivity check from the peer when it has no
569
+ * candidate pair of its own to check after both sides ended their
570
+ * candidates (the peer offered only active TCP candidates, as Firefox does
571
+ * for ICE-TCP, or none werift can reach). Without a check in that time the
572
+ * ICE transport fails. With `iceLite`, which sends no checks, ICE waits the
573
+ * same time whenever it has no candidate pair, also while it still
574
+ * gathers. The deadline is fixed when the wait begins; once gathering ended
575
+ * without a socket that could receive a check, ICE fails at once. Defaults
576
+ * to 30 when undefined; 0 fails at once.
577
+ */
578
+ iceIncomingCheckTimeout: number | undefined;
579
+ /**
580
+ * werift extension. With `iceNomination: "regular"`: milliseconds the
581
+ * controlling ICE agent keeps checking before it nominates a candidate pair,
582
+ * so a higher-priority candidate trickled shortly after a lower-priority one
583
+ * succeeded can still be selected. Maps to `IceOptions.nominationDelayMs`:
584
+ * 300 when undefined, 0 nominates the first valid pair at once.
585
+ */
586
+ iceNominationDelayMs: number | undefined;
587
+ /**
588
+ * werift extension. How the controlling ICE agent nominates toward a full
589
+ * ICE peer (`IceOptions.nomination`). `"semi-aggressive"` (default when
590
+ * undefined, as Chrome): the first pair whose check succeeds is selected at
591
+ * once and a higher-priority pair that succeeds later replaces it.
592
+ * `"regular"`: RFC 8445 regular nomination, one nomination after
593
+ * `iceNominationDelayMs`.
594
+ */
595
+ iceNomination: "semi-aggressive" | "regular" | undefined;
596
+ /**
597
+ * werift extension. Enable ICE renomination
598
+ * (draft-thatcher-ice-renomination, as libwebrtc implements it): every
599
+ * description advertises `a=ice-options:trickle renomination`. When the
600
+ * remote description advertises `renomination` too, the controlling agent
601
+ * nominates with the NOMINATION STUN attribute and an increasing value, so
602
+ * a later, better pair reliably replaces the selection on both sides
603
+ * (`IceOptions.renomination`). Chrome advertises it only when its SDP is
604
+ * modified before `setLocalDescription`; as the controlled side it honours
605
+ * the attribute regardless. Defaults to false.
606
+ */
607
+ iceRenomination: boolean;
608
+ /**
609
+ * werift extension. Thresholds of the failover of the selected candidate
610
+ * pair without an ICE restart (with semi-aggressive nomination or
611
+ * renomination): how soon a pair is unwritable (`unwritableMinChecks`,
612
+ * `unwritableTimeout`) and how soon a selected pair that stopped receiving
613
+ * moves to a backup (`receivingTimeout`, `receivingSwitchingDelay`). Maps
614
+ * to `IceOptions.failover`; each unset or invalid value keeps its default
615
+ * (libwebrtc's: 5 checks, 5000 ms, 2500 ms, 1000 ms).
616
+ */
617
+ iceFailover: IceFailoverOptions | undefined;
246
618
  turnTransport: "udp" | "tcp" | "tls" | undefined;
247
619
  turnTlsOptions: TlsConnectionOptions | undefined;
248
620
  /**
@@ -259,22 +631,76 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
259
631
  * Return `true` if a STUN response should be sent, false if it should be skipped. */
260
632
  iceFilterStunResponse: ((message: Message, addr: Address, protocol: Protocol) => boolean) | undefined;
261
633
  iceFilterCandidatePair: ((pair: CandidatePair) => boolean) | undefined;
634
+ /**
635
+ * Opt-in SPED (DTLS handshake embedded in ICE Binding).
636
+ * Omit or false: ICE completes, then DTLS starts (current serial path).
637
+ * true: this PeerConnection only overlaps ICE checks with DTLS 1.3 handshake.
638
+ * Requires explicit DTLS 1.3 in `dtls.protocolVersions`
639
+ * (`dtls.protocolVersions` defaults to empty / DTLS 1.2 only).
640
+ * Cannot be combined with `dtls.helloRetryRequest: true`
641
+ * (SPED uses ICE-authenticated address validation, not a DTLS cookie).
642
+ * Both are validated by the constructor and `setConfiguration()`, which
643
+ * throw synchronously and leave the configuration unchanged.
644
+ */
645
+ sped?: boolean;
646
+ /**
647
+ * Integrity attributes of the ICE connectivity checks and consent requests
648
+ * werift sends (RFC 8489 short-term credentials). Applies to ICE transports
649
+ * created after it is set.
650
+ * - `undefined` / `"sha1"` (default): MESSAGE-INTEGRITY only. Browsers
651
+ * (libwebrtc, Firefox) accept this.
652
+ * - `"sha256"`: MESSAGE-INTEGRITY-SHA256 only. Only for peers known to
653
+ * support it: a peer that does not know the attribute rejects the checks.
654
+ * - `"both"`: MESSAGE-INTEGRITY followed by MESSAGE-INTEGRITY-SHA256.
655
+ *
656
+ * Checks and responses from the peer are accepted with either algorithm,
657
+ * and responses are always signed with the algorithm of the request.
658
+ */
659
+ iceMessageIntegrity: MessageIntegrityMode | undefined;
660
+ /**
661
+ * Advertise the `ice2` ice-option (`a=ice-options:trickle ice2`, RFC 8445
662
+ * §10 / RFC 8839) to declare an RFC 8445 agent. Defaults to false
663
+ * (`a=ice-options:trickle`). It is only a declaration: werift runs the
664
+ * RFC 8445 procedures either way. Cannot be changed after construction.
665
+ */
666
+ iceOptionIce2: boolean;
262
667
  icePasswordPrefix: string | undefined;
263
668
  bundlePolicy: BundlePolicy;
264
669
  rtcpMuxPolicy: "require";
265
670
  iceCandidatePoolSize: number;
266
671
  /**
267
- * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given.
268
- * Cannot be changed after construction.
269
- * - `"process"` (default): one certificate shared by every RTCPeerConnection in the process
270
- * (legacy behavior), so their `a=fingerprint` values are identical.
271
- * - `"peerConnection"`: each RTCPeerConnection generates its own certificate (browser behavior).
672
+ * Which default DTLS certificate is used when neither `certificates` nor `dtls.keys` is given
673
+ * (see {@link CompatibilityOptionValues}). Cannot be changed after construction.
674
+ * - `"process"` (default): one certificate shared by every RTCPeerConnection in the process,
675
+ * so their `a=fingerprint` values are identical.
676
+ * - `"standard"`: each RTCPeerConnection generates its own certificate, as browsers do.
272
677
  * All DTLS transports of that connection share it.
678
+ *
679
+ * Also accepts the v0.27.0 name `"peerConnection"` (= `"standard"`).
273
680
  */
274
681
  certificateScope: CertificateScope;
275
682
  midSuffix: boolean;
276
683
  /** Advertised local SCTP max-message-size in SDP. Use 0 for unlimited. */
277
684
  maxMessageSize: number;
685
+ /**
686
+ * The initial `binaryType` of every data channel this connection creates,
687
+ * by `createDataChannel()` or announced by the remote peer (a compatibility
688
+ * option, see {@link CompatibilityOptionValues} and
689
+ * {@link RTCDataChannelBinaryType}).
690
+ * - `"nodebuffer"` (default, werift's own value): binary messages arrive as
691
+ * a Node.js `Buffer`, as before this option existed.
692
+ * - `"standard"`: the browser default, `"arraybuffer"` (W3C); the channel's
693
+ * `binaryType` reads `"arraybuffer"`.
694
+ * - `"arraybuffer"` / `"blob"`: binary messages arrive as an `ArrayBuffer`
695
+ * / a `Blob` (`werift/polyfill` uses `"arraybuffer"`).
696
+ *
697
+ * Another value is a `TypeError`. `compatibility: "standard"` sets it to
698
+ * `"standard"` when it is not given. `setConfiguration()` may change it; the
699
+ * new value applies to channels created afterwards, and an existing
700
+ * channel changes with its own `binaryType` setter.
701
+ * @see tests/datachannel/binaryType.test.ts "dataChannelBinaryType: standard gives channels the W3C default arraybuffer"
702
+ */
703
+ dataChannelBinaryType: DataChannelBinaryTypeOption;
278
704
  /**
279
705
  * When true, padding-only RTP is omitted from onReceiveRtp and later media
280
706
  * sequence numbers are compacted. Default false preserves wire RTP events.
@@ -283,24 +709,109 @@ export declare function clonePeerConfiguration(config: PeerConfig): {
283
709
  /** Send-side estimator used by each new sender; defaults to `"lightweight"`. */
284
710
  bandwidthEstimator: BandwidthEstimatorOption;
285
711
  /**
286
- * How local SDP marks inactive / stopped m-lines. Cannot be changed after construction.
287
- * - `"compatible"` (default): an accepted `inactive` m-line keeps a non-zero port.
288
- * Only rejected (no common codec / remote port 0) or stopped m-lines use port 0,
289
- * and only those negotiated port 0 positions are reused by new transceivers.
290
- * - `"aggressive"`: legacy behavior. `inactive` m-lines are also written with port 0.
712
+ * How local SDP marks inactive / stopped m-lines (see {@link CompatibilityOptionValues}).
713
+ * Cannot be changed after construction.
714
+ * - `"standard"` (default): an accepted `inactive` m-line keeps a non-zero port, as JSEP
715
+ * and browsers do. Only rejected (no common codec / remote port 0) or stopped m-lines
716
+ * use port 0, and only those negotiated port 0 positions are reused by new transceivers.
717
+ * - `"aggressive"`: behavior before v0.25.0. `inactive` m-lines are also written with
718
+ * port 0, so the remote side treats them as rejected and their positions are reused.
719
+ *
720
+ * Also accepts the v0.27.0 name `"compatible"` (= `"standard"`).
291
721
  */
292
722
  mLineReuse: MLineReuse;
293
723
  /**
294
- * Where a PLI / FIR goes when no route has its target SSRC. See {@link KeyFrameRequestRouting}.
295
- * - `"compatible"` (default): the sender whose RTX SSRC it is, else the only video sender.
296
- * - `"strict"`: not delivered, as RFC 4585 / RFC 5104 define the target.
724
+ * How a remote offer's m-sections are paired with local transceivers that
725
+ * have no MID yet (see {@link CompatibilityOptionValues}). Cannot be changed
726
+ * after construction.
727
+ * - `"byKind"` (default): behavior up to v0.27.0. Any unassociated,
728
+ * non-stopped transceiver of the same kind is paired (the one at the same
729
+ * m-line index first), whatever created it. In glare (perfect negotiation)
730
+ * the remote offer can take over a transceiver created with
731
+ * `addTransceiver(kind, { direction: "sendonly" })` and its direction
732
+ * becomes `sendrecv`.
733
+ * - `"standard"`: RFC 8829 (JSEP) section 5.10, as browsers do. An
734
+ * m-section whose MID no transceiver has is associated only with an
735
+ * unassociated, non-stopped transceiver of the same kind that
736
+ * `addTrack()` created (or one a rollback promoted to that, JSEP 4.1.8.2),
737
+ * and only when the m-section is `sendrecv` or `recvonly`. A transceiver
738
+ * created by `addTransceiver()` (with or without a track, also after
739
+ * `replaceTrack()` or a later `addTrack()` reusing it) is never paired:
740
+ * the offer gets a new transceiver, and the local one keeps its direction
741
+ * and `mid === null` until a local offer negotiates it. Use it for the
742
+ * perfect negotiation pattern and for code written for browsers.
743
+ */
744
+ transceiverPairing: TransceiverPairing;
745
+ /**
746
+ * Where a PLI / FIR goes when no route has its target SSRC (see
747
+ * {@link CompatibilityOptionValues} and {@link KeyFrameRequestRouting}).
748
+ * `setConfiguration()` may change it.
749
+ * - `"fallback"` (default): the sender whose RTX SSRC it is, else the only video sender.
750
+ * - `"standard"`: not delivered, as RFC 4585 / RFC 5104 define the target.
751
+ *
752
+ * Also accepts the names up to v0.27.0: `"compatible"` (= `"fallback"`) and
753
+ * `"strict"` (= `"standard"`).
297
754
  */
298
755
  keyFrameRequestRouting: KeyFrameRequestRouting;
756
+ /**
757
+ * How strictly the DTLS 1.2 handshake validates the peer's messages (see
758
+ * {@link CompatibilityOptionValues}). Cannot be changed after construction.
759
+ * - `"lenient"` (default): a malformed `supported_versions` is ignored and
760
+ * DTLS 1.2 negotiated, duplicate extensions are accepted and `use_srtp`
761
+ * is read without length checks, as before the strict checks.
762
+ * - `"standard"`: RFC-strict; these fail the handshake (a malformed
763
+ * `supported_versions` with a `protocol_version` alert).
764
+ *
765
+ * A `supported_versions` without an overlapping version fails either way,
766
+ * and DTLS 1.3 always validates strictly.
767
+ */
768
+ dtlsHandshakeValidation: DtlsHandshakeValidation;
769
+ /**
770
+ * Which m-lines of a BUNDLE group carry the local ICE candidates.
771
+ * Cannot be changed after construction. See {@link BundleCandidates}.
772
+ * - `"legacy"` (default): every m-line repeats its transport's candidates and
773
+ * `a=end-of-candidates` (werift's earlier output).
774
+ * - `"compatible"`: as Chrome writes them, only the BUNDLE tag m-line carries
775
+ * them, so renegotiation with more m-lines no longer repeats the candidate list.
776
+ */
777
+ bundleCandidates: BundleCandidates;
778
+ /**
779
+ * Sets every compatibility option (`certificateScope`, `mLineReuse`,
780
+ * `transceiverPairing`, `keyFrameRequestRouting`,
781
+ * `dtlsHandshakeValidation`, `dataChannelBinaryType`, see
782
+ * {@link CompatibilityOptionValues}) to the specification / browser behavior
783
+ * at once. Cannot be changed after construction.
784
+ * - `undefined` (default): each option keeps its own default.
785
+ * - `"standard"`: every compatibility option not given in the same
786
+ * configuration is `"standard"`.
787
+ *
788
+ * An option given explicitly always takes precedence over `compatibility`:
789
+ * a value given in the same configuration (an old name included) is kept,
790
+ * and `setConfiguration()` treats the options as if `compatibility` were
791
+ * not set (`keyFrameRequestRouting` and `dataChannelBinaryType` may
792
+ * change, the others cannot). An
793
+ * option given as `undefined` counts as not given.
794
+ *
795
+ * ```ts
796
+ * new RTCPeerConnection({ compatibility: "standard" });
797
+ * // certificateScope, mLineReuse, transceiverPairing,
798
+ * // keyFrameRequestRouting, dtlsHandshakeValidation and
799
+ * // dataChannelBinaryType are all "standard"
800
+ * new RTCPeerConnection({ compatibility: "standard", certificateScope: "process" });
801
+ * // certificateScope is "process", the others are "standard"
802
+ * ```
803
+ *
804
+ * It does not change `iceServers` / `iceUseDefaultStunServer`, which are not
805
+ * compatibility options.
806
+ * @see tests/datachannel/binaryType.test.ts "compatibility: standard makes data channels deliver ArrayBuffer unless dataChannelBinaryType is given"
807
+ */
808
+ compatibility: CompatibilityPreset | undefined;
299
809
  };
300
- export declare function mergePeerConfiguration(config: PeerConfig, input: RTCPeerConnectionConfig, { isReconfiguration, hasLocalDescription, hasSctpTransport, }: {
810
+ export declare function mergePeerConfiguration(config: PeerConfig, input: RTCPeerConnectionConfig, { isReconfiguration, hasLocalDescription, hasSctpTransport, dtlsTransportCreated, }: {
301
811
  isReconfiguration: boolean;
302
812
  hasLocalDescription: boolean;
303
813
  hasSctpTransport: boolean;
814
+ dtlsTransportCreated: boolean;
304
815
  }): Partial<PeerConfig> & {
305
816
  sctp?: RTCSctpConfiguration;
306
817
  };