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,7 +1,10 @@
1
1
  import { Candidate } from "./candidate";
2
+ import { type IceCandidateErrorInfo, type IceServerReachedInfo } from "./candidateError";
2
3
  import type { MdnsLookup } from "./dns/lookup";
4
+ import type { IceGatheringErrorInfo } from "./gatheringError";
3
5
  import type { Cancelable } from "./helper";
4
6
  import { type Address, type Event, type InterfaceAddresses, type TlsConnectionOptions } from "./imports/common";
7
+ import { type MessageIntegrityMode } from "./stun/const";
5
8
  import { Message } from "./stun/message";
6
9
  import type { Protocol } from "./types/model";
7
10
  export interface IceConnection {
@@ -12,6 +15,20 @@ export interface IceConnection {
12
15
  remotePassword: string;
13
16
  remoteUsername: string;
14
17
  remoteIsLite: boolean;
18
+ /**
19
+ * The peer advertised `a=ice-options:renomination`. With
20
+ * {@link IceOptions.renomination} the controlling agent then nominates with
21
+ * the NOMINATION attribute (see `renomination`).
22
+ */
23
+ remoteRenomination?: boolean;
24
+ /**
25
+ * The remote `a=ice-options` tokens (RFC 8839 §5.6), e.g. `trickle`,
26
+ * `ice2`. Informational: werift already follows RFC 8445, so no token
27
+ * changes how checks or nomination run.
28
+ */
29
+ remoteIceOptions?: string[];
30
+ /** The remote declared `ice2`: an RFC 8445 agent (RFC 8445 §10). */
31
+ readonly remoteIce2?: boolean;
15
32
  checkList: CandidatePair[];
16
33
  localCandidates: Candidate[];
17
34
  remoteCandidates: Candidate[];
@@ -32,13 +49,40 @@ export interface IceConnection {
32
49
  options: IceOptions;
33
50
  remoteCandidatesEnd: boolean;
34
51
  localCandidatesEnd: boolean;
52
+ /**
53
+ * Resolves when `localCandidatesEnd` becomes true after `gatherCandidates()`
54
+ * returned (server-reflexive queries that continue in the background), or
55
+ * when the generation ends. Optional so that other implementations of this
56
+ * interface keep compiling; without it gathering ends when
57
+ * `gatherCandidates()` returns.
58
+ */
59
+ waitForLocalCandidatesEnd?(): Promise<void>;
35
60
  state: IceState;
36
61
  lookup?: MdnsLookup;
37
62
  nominated?: CandidatePair;
38
63
  readonly onData: Event<[Buffer]>;
39
64
  readonly stateChanged: Event<[IceState]>;
40
65
  readonly onIceCandidate: Event<[Candidate]>;
66
+ /**
67
+ * A STUN or TURN server of the current generation's gathering gave no
68
+ * candidate (see {@link IceCandidateErrorInfo}). Optional so that other
69
+ * implementations of this interface keep compiling.
70
+ */
71
+ readonly onIceCandidateError?: Event<[IceCandidateErrorInfo]>;
72
+ /**
73
+ * A STUN or TURN server of the current generation's gathering answered
74
+ * (see {@link IceServerReachedInfo}). Optional like onIceCandidateError.
75
+ */
76
+ readonly onIceServerReached?: Event<[IceServerReachedInfo]>;
77
+ /**
78
+ * The current generation's gathering reported an error (see
79
+ * {@link IceGatheringErrorInfo}). Optional like onIceCandidateError.
80
+ * @see packages/webrtc/tests/transport/iceGatheringError.test.ts「of an ICE agent without onGatheringError: gathering-failed is reported and the gathering completes」
81
+ */
82
+ readonly onGatheringError?: Event<[IceGatheringErrorInfo]>;
41
83
  restart(): void;
84
+ /** Record the remote `a=ice-options` tokens (see remoteIceOptions). */
85
+ setRemoteIceOptions?(options: string[]): void;
42
86
  /**
43
87
  * Optional staged-restart and provisional-generation support. An
44
88
  * implementation without them still restarts ICE at the final answer, but
@@ -112,6 +156,18 @@ export declare class CandidatePair implements CandidatePairStats {
112
156
  handle?: Cancelable<void>;
113
157
  nominated: boolean;
114
158
  remoteNominated: boolean;
159
+ /**
160
+ * The largest nomination the peer sent for this pair while this agent was
161
+ * controlled: the NOMINATION attribute's value (renomination), or 1 for
162
+ * USE-CANDIDATE. The controlled agent selects the nominated pair with the
163
+ * largest value, the higher-priority one between equal values.
164
+ */
165
+ remoteNomination: number;
166
+ /**
167
+ * The NOMINATION value this agent (controlling, renomination) sent for the
168
+ * pair and the peer answered; 0 when it did not renominate the pair.
169
+ */
170
+ nomination: number;
115
171
  private _state;
116
172
  get state(): CandidatePairState;
117
173
  packetsSent: number;
@@ -129,6 +185,25 @@ export declare class CandidatePair implements CandidatePairStats {
129
185
  retransmissionsSent: number;
130
186
  consentRequestsSent: number;
131
187
  private readonly requestTransactionIds;
188
+ /** The most recent RTT samples (seconds), oldest first (see `smoothedRtt`). */
189
+ private readonly rttSamples;
190
+ /**
191
+ * Record the RTT (seconds) of an answered check: the totals, the samples of
192
+ * {@link smoothedRtt} and, unless `latest` is false (a response to an older
193
+ * check than the one `rtt` came from), `rtt`.
194
+ * @see tests/ice/selection-controller.test.ts "a response to an older check (latest: false) counts for the totals and the smoothed RTT, not the current RTT"
195
+ */
196
+ recordRoundTrip(rtt: number, { latest }?: {
197
+ latest?: boolean;
198
+ }): void;
199
+ /**
200
+ * The smoothed RTT (seconds) the selection switches by: the median of the
201
+ * last {@link RTT_SMOOTHING_SAMPLES} samples, undefined with fewer than
202
+ * {@link RTT_SMOOTHING_MIN_SAMPLES}.
203
+ * @see tests/ice/selection-controller.test.ts "the median of the last 5 samples: one outlier does not move it"
204
+ * @see tests/ice/selection-controller.test.ts "equal priority: one outlier RTT of the other pair does not move the selection"
205
+ */
206
+ get smoothedRtt(): number | undefined;
132
207
  toJSON(): {
133
208
  protocol: string;
134
209
  localCandidate: string;
@@ -148,6 +223,8 @@ export declare class CandidatePair implements CandidatePairStats {
148
223
  get foundation(): string;
149
224
  noteIncomingRequest(transactionId: string): boolean;
150
225
  }
226
+ /** Default of {@link IceOptions.incomingCheckTimeout}, in seconds. */
227
+ export declare const DEFAULT_INCOMING_CHECK_TIMEOUT = 30;
151
228
  export declare const ICE_COMPLETED: 1;
152
229
  export declare const ICE_FAILED: 2;
153
230
  /** Basic consent check period in seconds (RFC 7675). Actual interval is 0.8–1.2× this. */
@@ -160,17 +237,123 @@ export declare const CONSENT_FAILURES = 6;
160
237
  /** RFC 7675: consent expires this many seconds after the last valid response. */
161
238
  export declare const CONSENT_TIMEOUT = 30;
162
239
  /**
163
- * Default single-shot response wait for consent requests (ms) when RTT is unknown.
164
- * Independent of retransmission count. Downstream ICE-lite peers typically
165
- * answer in 150–300ms; 1s is a conservative default used by interop patches.
240
+ * RTT-based response deadline of a consent request (ms) when the RTT is
241
+ * unknown (see {@link consentResponseTimeoutMs}). Downstream ICE-lite peers
242
+ * typically answer in 150–300ms. It is no longer how long the request's
243
+ * transaction stays open: that is {@link CONSENT_TIMEOUT}, so a response
244
+ * after this deadline still refreshes the consent.
166
245
  */
167
246
  export declare const CONSENT_RESPONSE_TIMEOUT = 1000;
168
247
  /** RFC 8445 §14.3: ICE RTO must not be less than 500ms. */
169
248
  export declare const CONSENT_RESPONSE_TIMEOUT_MIN = 500;
170
249
  /**
171
- * Compute consent response wait from pair RTT (seconds).
172
- * Uses 2×RTT + 200ms jitter margin, floored at {@link CONSENT_RESPONSE_TIMEOUT_MIN}.
173
- * Falls back to {@link CONSENT_RESPONSE_TIMEOUT} when RTT is unavailable.
250
+ * Ping interval (ms) of a pair that is weak (a check went unanswered) or
251
+ * stabilizing (fewer than {@link MIN_PINGS_AT_WEAK_PING_INTERVAL} responses
252
+ * since it began to be monitored). libwebrtc:
253
+ * `WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL`.
254
+ */
255
+ export declare const WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL = 900;
256
+ /**
257
+ * Ping interval (ms) of a stable backup pair (multiplied by a random 0.8–1.2).
258
+ * libwebrtc: `STABLE_WRITABLE_CONNECTION_PING_INTERVAL`.
259
+ */
260
+ export declare const STABLE_WRITABLE_CONNECTION_PING_INTERVAL = 2500;
261
+ /**
262
+ * Responses a pair needs, pinged at the weak interval, before it counts as
263
+ * stable. libwebrtc: `MIN_PINGS_AT_WEAK_PING_INTERVAL`.
264
+ */
265
+ export declare const MIN_PINGS_AT_WEAK_PING_INTERVAL = 3;
266
+ /**
267
+ * A pair is no longer writable once at least this many consecutive checks
268
+ * went unanswered and {@link CONNECTION_WRITE_CONNECT_TIMEOUT} passed since
269
+ * its last response. libwebrtc: `CONNECTION_WRITE_CONNECT_FAILURES`.
270
+ */
271
+ export declare const CONNECTION_WRITE_CONNECT_FAILURES = 5;
272
+ /** See {@link CONNECTION_WRITE_CONNECT_FAILURES} (ms). libwebrtc: `CONNECTION_WRITE_CONNECT_TIMEOUT`. */
273
+ export declare const CONNECTION_WRITE_CONNECT_TIMEOUT = 5000;
274
+ /**
275
+ * A pair that received nothing (response, request or data) for this long
276
+ * (ms) is weak. libwebrtc: `WEAK_CONNECTION_RECEIVE_TIMEOUT`.
277
+ */
278
+ export declare const WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500;
279
+ /**
280
+ * How long (ms) the selected pair must have stopped receiving (nothing
281
+ * received for {@link WEAK_CONNECTION_RECEIVE_TIMEOUT}) before the
282
+ * controlling agent fails over to a backup that receives, without waiting
283
+ * for the selected pair to become unwritable. libwebrtc:
284
+ * `receiving_switching_delay` (default 1000 ms).
285
+ */
286
+ export declare const RECEIVING_SWITCHING_DELAY = 1000;
287
+ /**
288
+ * A backup pair that received nothing for this long (ms) is dropped (its
289
+ * state becomes Failed) and the next pair of its socket is monitored. The
290
+ * same value as {@link CONSENT_TIMEOUT}. libwebrtc:
291
+ * `DEAD_CONNECTION_RECEIVE_TIMEOUT`.
292
+ */
293
+ export declare const DEAD_CONNECTION_RECEIVE_TIMEOUT: number;
294
+ /**
295
+ * Response timeout (ms) of a backup check while the pair's RTT is still
296
+ * unknown (it never answered a check of this agent). libwebrtc starts a
297
+ * connection's RTT estimate at `DEFAULT_RTT` (3000 ms); the consent default
298
+ * ({@link CONSENT_RESPONSE_TIMEOUT}, 1 s) would never let a backup path
299
+ * slower than that become valid. Once the pair answered, the timeout follows
300
+ * its RTT ({@link consentResponseTimeoutMs}).
301
+ */
302
+ export declare const BACKUP_UNKNOWN_RTT_RESPONSE_TIMEOUT = 3000;
303
+ /**
304
+ * After the selected pair's consent expired (RFC 7675: no more application
305
+ * data on it), how long (ms) the agent stays `disconnected` waiting for the
306
+ * selection to move to a writable backup (its own failover nomination, or
307
+ * the peer's when controlled) before it fails. A peer that fails over does
308
+ * so 5–10 s after the path broke, long before the 30 s expiry; the grace
309
+ * covers a nomination still in flight. werift's own value.
310
+ */
311
+ export declare const FAILOVER_CONSENT_EXPIRED_GRACE = 10000;
312
+ /**
313
+ * Pairs of one local socket (or TURN allocation) tried as its backup before
314
+ * the socket waits for a retry (1, 2, 4, 8, 16 s, then every 16 s) and starts
315
+ * again from its highest-priority pair. werift's own limit.
316
+ */
317
+ export declare const FAILOVER_BACKUP_ATTEMPTS = 3;
318
+ /**
319
+ * Consecutive responses a pair the agent failed over from needs before the
320
+ * selection may move back to it (or to another pair of its socket). Keeps
321
+ * the selection from flapping. werift's own value (libwebrtc relies on
322
+ * {@link MIN_PINGS_AT_WEAK_PING_INTERVAL} for the same purpose).
323
+ */
324
+ export declare const FAILOVER_RECOVERY_RESPONSES = 3;
325
+ /**
326
+ * Between pairs of equal state and priority, the selection moves only to a
327
+ * pair whose smoothed RTT ({@link CandidatePair.smoothedRtt}) is at least this
328
+ * much (ms) lower. libwebrtc: `kMinImprovement`.
329
+ * @see tests/ice/selection-controller.test.ts "equal priority: a pair only 9 ms faster does not take the selection"
330
+ */
331
+ export declare const RTT_SWITCH_MIN_IMPROVEMENT = 10;
332
+ /**
333
+ * The RTT samples {@link CandidatePair.smoothedRtt} keeps (the most recent
334
+ * ones). werift's own value: libwebrtc keeps a moving average instead, which
335
+ * one outlier still moves.
336
+ * @see tests/ice/selection-controller.test.ts "the median of the last 5 samples: one outlier does not move it"
337
+ */
338
+ export declare const RTT_SMOOTHING_SAMPLES = 5;
339
+ /**
340
+ * Samples a pair needs before {@link CandidatePair.smoothedRtt} has a value
341
+ * (the RTT takes part in a switch). The same as
342
+ * {@link MIN_PINGS_AT_WEAK_PING_INTERVAL}: a backup is stable from then on.
343
+ * @see tests/ice/selection-controller.test.ts "the median of the last 5 samples: one outlier does not move it"
344
+ */
345
+ export declare const RTT_SMOOTHING_MIN_SAMPLES = 3;
346
+ /**
347
+ * RTT-based response deadline (ms) from a pair RTT (seconds): when a consent
348
+ * request without a response counts as unanswered (failover's pacing and
349
+ * writability), and the response timeout of a backup check once the backup's
350
+ * RTT is known. Uses 2×RTT + 200ms jitter margin, floored at
351
+ * {@link CONSENT_RESPONSE_TIMEOUT_MIN}. Falls back to
352
+ * {@link CONSENT_RESPONSE_TIMEOUT} when RTT is unavailable.
353
+ *
354
+ * A consent request's transaction is not ended at this deadline: it stays
355
+ * open for {@link CONSENT_TIMEOUT}, so a response slower than the estimate
356
+ * (an RTT that rose after the selection) still refreshes the consent.
174
357
  */
175
358
  export declare function consentResponseTimeoutMs(rttSeconds?: number): number;
176
359
  /**
@@ -192,7 +375,64 @@ export type TurnServerOptions = {
192
375
  password: string;
193
376
  /** Defaults to "udp" (with a TCP fallback when the UDP allocation fails). */
194
377
  transport?: "udp" | "tcp" | "tls";
378
+ /**
379
+ * The application's names (URLs) for this server. Metadata only: the
380
+ * allocation does not use them. They are passed through unchanged to
381
+ * {@link IceServerRef.urls} of `Connection.onIceCandidateError`, so a
382
+ * failure can be matched to the configured server without exposing the
383
+ * credential. Duplicates merged by {@link normalizeIceServerOptions} have
384
+ * their urls merged.
385
+ */
386
+ urls?: string[];
387
+ };
388
+ /** A TURN server as gathering uses it (see {@link normalizeIceServerOptions}). */
389
+ export type NormalizedTurnServer = Required<Omit<TurnServerOptions, "urls">> & Pick<TurnServerOptions, "urls">;
390
+ /**
391
+ * The application's name (URL) of a STUN server, reported in
392
+ * {@link IceServerRef.urls} of `Connection.onIceCandidateError`. Metadata
393
+ * only; several entries may name the same address.
394
+ */
395
+ export type StunServerUrl = {
396
+ address: Address;
397
+ url: string;
195
398
  };
399
+ /**
400
+ * Thresholds of the failover of the selected pair ({@link IceOptions.failover}),
401
+ * after libwebrtc's `RTCConfiguration` fields of the same meaning. Lower
402
+ * values fail over sooner and also on a shorter loss burst.
403
+ */
404
+ export interface IceFailoverOptions {
405
+ /**
406
+ * Consecutive unanswered checks after which a pair is unwritable (together
407
+ * with `unwritableTimeout`). An integer of at least 1; defaults to
408
+ * {@link CONNECTION_WRITE_CONNECT_FAILURES} (5). libwebrtc:
409
+ * `ice_unwritable_min_checks`.
410
+ */
411
+ unwritableMinChecks?: number;
412
+ /**
413
+ * Time (ms) since a pair's last response after which it is unwritable
414
+ * (together with `unwritableMinChecks`). At least 0; defaults to
415
+ * {@link CONNECTION_WRITE_CONNECT_TIMEOUT} (5000). libwebrtc:
416
+ * `ice_unwritable_timeout`.
417
+ */
418
+ unwritableTimeout?: number;
419
+ /**
420
+ * Time (ms) without receiving anything (response, request or data) after
421
+ * which a pair is weak (checked at the weak interval, 900 ms) and stops
422
+ * receiving. Greater than 0; defaults to
423
+ * {@link WEAK_CONNECTION_RECEIVE_TIMEOUT} (2500). libwebrtc:
424
+ * `receiving_timeout`.
425
+ */
426
+ receivingTimeout?: number;
427
+ /**
428
+ * Time (ms) the selected pair must have stopped receiving (one of its
429
+ * checks unanswered as well) before the controlling agent fails over to a
430
+ * backup that receives, before the selected pair becomes unwritable. At
431
+ * least 0; defaults to {@link RECEIVING_SWITCHING_DELAY} (1000).
432
+ * libwebrtc: `receiving_switching_delay`.
433
+ */
434
+ receivingSwitchingDelay?: number;
435
+ }
196
436
  export interface IceOptions {
197
437
  /** Advertise and operate as an ICE lite agent. */
198
438
  iceLite: boolean;
@@ -209,24 +449,115 @@ export interface IceOptions {
209
449
  * Defaults to 5. Where UDP is blocked these STUN queries are never answered,
210
450
  * so the wait always runs to the timeout; agents that must not stall on such
211
451
  * networks can lower it.
452
+ *
453
+ * `gatherCandidates()` waits only for the representative sockets' queries
454
+ * (see `stunServers`); the other host sockets' queries continue up to this
455
+ * timeout in the background and end-of-candidates follows them.
212
456
  */
213
457
  stunGatherTimeout?: number;
458
+ /**
459
+ * Seconds `connect()` waits for a connectivity check from the peer when it
460
+ * has no candidate pair of its own to check after both sides ended their
461
+ * candidates: the peer offered only active TCP candidates (RFC 6544), or
462
+ * none this agent can reach. A check from the peer adds a peer-reflexive
463
+ * pair and the connection proceeds; without one, `connect()` fails when the
464
+ * time runs out. An ICE-lite agent, which sends no checks, waits the same
465
+ * time whenever it has no candidate pair, also while it still gathers. The
466
+ * deadline is fixed when the wait begins; once the local gathering ended
467
+ * without a socket that could receive a check, `connect()` fails at once.
468
+ * Defaults to 30; 0 fails at once.
469
+ */
470
+ incomingCheckTimeout?: number;
214
471
  /**
215
472
  * Seconds to wait for a TURN TCP/TLS connection to be established.
216
473
  * Defaults to 8.
217
474
  */
218
475
  turnConnectTimeout?: number;
476
+ /**
477
+ * With `nomination: "regular"`: milliseconds the controlling agent keeps
478
+ * checking before it nominates (RFC 8445 §8.1.1 regular nomination). The
479
+ * default semi-aggressive nomination does not wait. Counted from the later of the first
480
+ * valid pair and the last pair added that outranks the best valid pair, so
481
+ * a higher-priority candidate trickled shortly after a lower-priority one
482
+ * succeeded can still be selected. Once both sides signalled
483
+ * end-of-candidates and no higher-priority pair is still being checked, the
484
+ * best valid pair is nominated at once. Defaults to 300; 0 nominates the
485
+ * best valid pair as soon as one exists. A negative or non-finite value
486
+ * falls back to the default.
487
+ */
488
+ nominationDelayMs?: number;
489
+ /**
490
+ * How the controlling agent nominates toward a full ICE peer when
491
+ * renomination is not in use (see `renomination`).
492
+ *
493
+ * - `"semi-aggressive"` (default, as libwebrtc / Chrome): a check carries
494
+ * USE-CANDIDATE while no pair is selected and for every pair that
495
+ * outranks the selected one. The first pair whose check succeeds is
496
+ * selected at once; checks of higher-priority pairs go on, and one that
497
+ * succeeds later replaces the selection. Consent checks of the selected
498
+ * pair carry USE-CANDIDATE as well.
499
+ * - `"regular"`: RFC 8445 §8.1.1 regular nomination. Checks carry no
500
+ * USE-CANDIDATE; after `nominationDelayMs` (or end-of-candidates) the
501
+ * best valid pair is nominated once with a separate check and never
502
+ * replaced.
503
+ *
504
+ * Toward an ICE-lite peer the first valid pair is nominated in either mode.
505
+ */
506
+ nomination?: "semi-aggressive" | "regular";
507
+ /**
508
+ * Renomination (draft-thatcher-ice-renomination, as libwebrtc implements
509
+ * it). When enabled the agent advertises `a=ice-options:renomination`
510
+ * (packages/webrtc). When the peer advertised it too, the controlling agent
511
+ * nominates with the NOMINATION attribute (0xC001) and an increasing value
512
+ * instead of USE-CANDIDATE: it nominates the first valid pair, keeps
513
+ * checking higher-priority pairs and renominates a better one when its
514
+ * check succeeds. This replaces `nomination` for that session.
515
+ *
516
+ * The controlled agent always honours the NOMINATION attribute: it selects
517
+ * the pair with the largest value. Defaults to false.
518
+ */
519
+ renomination?: boolean;
520
+ /**
521
+ * Thresholds of the failover of the selected pair without an ICE restart
522
+ * (semi-aggressive nomination or renomination, full ICE, not ICE-TCP).
523
+ * Each unset or invalid value keeps its default, which follows libwebrtc.
524
+ * See {@link IceFailoverOptions}.
525
+ */
526
+ failover?: IceFailoverOptions;
219
527
  /**
220
528
  * STUN servers queried while gathering, in priority order. Every IPv4 UDP
221
529
  * host socket queries each of them in parallel; equal mappings are
222
530
  * advertised once, different ones (a NAT that maps per destination) each.
223
- * Gathering ends when the slowest server answers or `stunGatherTimeout`
224
- * runs out.
531
+ *
532
+ * Without `interfaceAddresses`, each family with a STUN server also gets a
533
+ * UDP socket bound to the wildcard address that advertises no host
534
+ * candidate: the OS picks its route (a full-tunnel VPN, an interface the
535
+ * host sockets do not cover), and its server-reflexive candidates carry
536
+ * the related address `0.0.0.0` / `::`. The IPv4 wildcard socket queries
537
+ * every server, the IPv6 one only the IPv6 literal servers. It checks only
538
+ * the remote candidates whose route leaves from an address no UDP host
539
+ * socket is bound to, so a peer on a covered path learns no
540
+ * peer-reflexive candidate from it.
541
+ *
542
+ * `gatherCandidates()` returns once the representative sockets answered or
543
+ * `stunGatherTimeout` ran out: the wildcard sockets and the host socket of
544
+ * the default-route address (every host socket when a family has neither).
545
+ * The other host sockets' server-reflexive candidates trickle through
546
+ * `onIceCandidate`, and `localCandidatesEnd` follows the last of them
547
+ * (`waitForLocalCandidatesEnd()`), so an interface that cannot reach the
548
+ * STUN server does not delay the description.
225
549
  *
226
550
  * Merged with the deprecated `stunServer`: the singular one comes first,
227
551
  * duplicates are dropped (see {@link normalizeIceServerOptions}).
228
552
  */
229
553
  stunServers?: Address[];
554
+ /**
555
+ * The application's names (URLs) of {@link IceOptions.stunServers}, by
556
+ * address. Metadata only, reported in {@link IceServerRef.urls} of
557
+ * `Connection.onIceCandidateError`; replaced together with the STUN
558
+ * servers (see {@link mergeIceServerOptions}).
559
+ */
560
+ stunServerUrls?: StunServerUrl[];
230
561
  /**
231
562
  * TURN servers allocated on while gathering, in priority order. Each one
232
563
  * gets its own allocation with its own credential and transport; one that
@@ -283,8 +614,30 @@ export interface IceOptions {
283
614
  * gathered. If the bind fails, the family has no UDP host candidate.
284
615
  *
285
616
  * A family left unspecified while the other one is set gathers no
286
- * enumerated addresses (only its `additionalHostAddresses`). Without any
287
- * family set, every enumerated address is gathered over wildcard sockets.
617
+ * enumerated addresses (only its `additionalHostAddresses`).
618
+ *
619
+ * Without any family set, every enumerated address gets its own UDP host
620
+ * socket bound to that address (an IPv6 link-local one with its zone), so
621
+ * the socket's packets leave from the advertised candidate address even on
622
+ * a host with several network interfaces. An address whose bind fails, or
623
+ * whose sends fail, loses only its own candidate; the other addresses are
624
+ * unaffected. An `additionalHostAddresses` entry that is not assigned to a
625
+ * local interface (a 1:1 NAT public address, for example) is gathered over
626
+ * a wildcard socket. The enumerated addresses include costly networks (VPN
627
+ * / tunnel interfaces: `ipsec`, `tun`, `utun`, `tap`) with a low local
628
+ * preference; `vmnet` / `veth` interfaces are excluded. The default-route
629
+ * address gets the highest local preference, so checks start with the path
630
+ * the OS uses: the source address of the route to the first configured
631
+ * STUN / TURN server that resolves in the family and has a route (UDP
632
+ * `connect()`, no packet is sent). A family without such a server has no
633
+ * default-route address: no other address (no public one) is probed in
634
+ * its place, and its host candidates keep the gathering order. With a STUN
635
+ * server, a wildcard socket per family maps the route the
636
+ * OS picks (see `stunServers`).
637
+ *
638
+ * A family set to the wildcard address (`0.0.0.0` / `::`) gathers its
639
+ * enumerated and additional addresses over wildcard sockets instead;
640
+ * the wildcard address itself is never advertised.
288
641
  */
289
642
  interfaceAddresses?: InterfaceAddresses;
290
643
  /**
@@ -295,6 +648,20 @@ export interface IceOptions {
295
648
  additionalHostAddresses?: string[];
296
649
  filterStunResponse?: (message: Message, addr: Address, protocol: Protocol) => boolean;
297
650
  filterCandidatePair?: (pair: CandidatePair) => boolean;
651
+ /**
652
+ * Integrity attributes of the connectivity checks and consent requests this
653
+ * agent sends (short-term credentials, RFC 8489):
654
+ * - `"sha1"` (default): MESSAGE-INTEGRITY only, what every browser accepts.
655
+ * - `"sha256"`: MESSAGE-INTEGRITY-SHA256 only. A peer that does not know
656
+ * the comprehension-required 0x001C attribute rejects such checks (420
657
+ * or no answer), so use it only with a peer known to support it.
658
+ * - `"both"`: MESSAGE-INTEGRITY followed by MESSAGE-INTEGRITY-SHA256.
659
+ *
660
+ * Received requests and responses are accepted with either algorithm, and
661
+ * a response is always signed with the algorithm of its request
662
+ * (MESSAGE-INTEGRITY-SHA256 when the request carried it, RFC 8489 §9.1.3).
663
+ */
664
+ messageIntegrity?: MessageIntegrityMode;
298
665
  }
299
666
  export declare const defaultOptions: IceOptions;
300
667
  export declare function validateRemoteCandidate(candidate: Candidate): Candidate;
@@ -305,11 +672,33 @@ export declare function sortCandidatePairs(pairs: {
305
672
  localCandidate: Pick<Candidate, "priority">;
306
673
  remoteCandidate: Pick<Candidate, "priority">;
307
674
  }[];
675
+ /**
676
+ * `2^32 * MIN(G,D) + 2 * MAX(G,D) + (G > D ? 1 : 0)` (RFC 8445 §6.1.2.3).
677
+ * The value can exceed `Number.MAX_SAFE_INTEGER`, so it is approximate;
678
+ * order pairs with `compareCandidatePairPriority`, which is exact.
679
+ */
308
680
  export declare function candidatePairPriority(local: Pick<Candidate, "priority">, remote: Pick<Candidate, "priority">, iceControlling: boolean): number;
309
- export declare function serverReflexiveCandidate(protocol: Protocol, stunServer: Address): Promise<Candidate | undefined>;
681
+ /**
682
+ * Exact comparison of two pair priorities (RFC 8445 §6.1.2.3): negative
683
+ * when pair `a` has the lower priority, positive when the higher, 0 when equal.
684
+ */
685
+ export declare function compareCandidatePairPriority(aLocal: Pick<Candidate, "priority">, aRemote: Pick<Candidate, "priority">, bLocal: Pick<Candidate, "priority">, bRemote: Pick<Candidate, "priority">, iceControlling: boolean): number;
686
+ /**
687
+ * Query `stunServer` from `protocol` for a server-reflexive candidate.
688
+ * Unlike {@link serverReflexiveCandidate} it rejects with the reason of a
689
+ * failure. `base` is used for wildcard sockets that advertise no host
690
+ * candidate themselves.
691
+ */
692
+ export declare function queryServerReflexiveCandidate(protocol: Protocol, stunServer: Address, base?: Pick<Candidate, "host" | "port" | "transport" | "component"> & Partial<Pick<Candidate, "tcptype">>): Promise<Candidate>;
693
+ /**
694
+ * Query a STUN server for a server-reflexive candidate. This compatibility
695
+ * helper resolves `undefined` on failure; use
696
+ * {@link queryServerReflexiveCandidate} when the failure reason is needed.
697
+ */
698
+ export declare function serverReflexiveCandidate(protocol: Protocol, stunServer: Address, base?: Pick<Candidate, "host" | "port" | "transport" | "component"> & Partial<Pick<Candidate, "tcptype">>): Promise<Candidate | undefined>;
310
699
  export declare function validateAddress(addr?: Address): Address | undefined;
311
700
  /** The STUN/TURN server fields of {@link IceOptions}, singular and plural. */
312
- export type IceServerFields = Partial<Pick<IceOptions, "stunServer" | "stunServers" | "turnServer" | "turnServers" | "turnUsername" | "turnPassword" | "turnTransport">>;
701
+ export type IceServerFields = Partial<Pick<IceOptions, "stunServer" | "stunServers" | "stunServerUrls" | "turnServer" | "turnServers" | "turnUsername" | "turnPassword" | "turnTransport">>;
313
702
  /**
314
703
  * The STUN and TURN servers `options` configure, the one place the singular
315
704
  * (deprecated) and plural fields are merged:
@@ -319,14 +708,15 @@ export type IceServerFields = Partial<Pick<IceOptions, "stunServer" | "stunServe
319
708
  * credential) are kept once, at their first position;
320
709
  * - an invalid address (see {@link validateAddress}) is dropped, and so is a
321
710
  * TURN server without username or password (it cannot allocate);
322
- * - a TURN transport left unset is "udp".
711
+ * - a TURN transport left unset is "udp";
712
+ * - the `urls` of merged TURN duplicates are merged (in order, once each).
323
713
  *
324
714
  * The built-in default STUN server is not added here; Connection falls back
325
715
  * to it when the result has no STUN server.
326
716
  */
327
717
  export declare function normalizeIceServerOptions(options: IceServerFields): {
328
718
  stunServers: Address[];
329
- turnServers: Required<TurnServerOptions>[];
719
+ turnServers: NormalizedTurnServer[];
330
720
  };
331
721
  /**
332
722
  * `current` with an ICE server update applied (Connection.setIceServers): the