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,16 +1,32 @@
1
1
  import { Candidate } from "./candidate";
2
+ import type { IceCandidateErrorInfo, IceServerReachedInfo } from "./candidateError";
2
3
  import { MdnsLookup } from "./dns/lookup";
3
- import { CandidatePair, type IceConnection, type IceOptions, type IceState, type TurnServerOptions } from "./iceBase";
4
+ import { type IceGatheringErrorInfo } from "./gatheringError";
5
+ import { CandidatePair, type IceConnection, type IceOptions, type IceState, type NormalizedTurnServer } from "./iceBase";
4
6
  import { type Address, Event } from "./imports/common";
5
7
  import { Message } from "./stun/message";
6
8
  import type { Protocol } from "./types/model";
9
+ /**
10
+ * The URL `onIceCandidateError` names the built-in default STUN server by:
11
+ * it is in no configuration, so werift synthesizes one.
12
+ */
13
+ export declare const DEFAULT_STUN_SERVER_URL = "stun:stun.l.google.com:19302";
7
14
  export declare class Connection implements IceConnection {
8
15
  private _iceControlling;
9
16
  localUsername: string;
10
17
  localPassword: string;
11
18
  remoteIsLite: boolean;
19
+ /** The peer advertised `a=ice-options:renomination` (see `IceOptions.renomination`). */
20
+ remoteRenomination: boolean;
21
+ remoteIceOptions: string[];
12
22
  remotePassword: string;
13
23
  remoteUsername: string;
24
+ /**
25
+ * Remote ufrags of replaced generations (bounded). A late check one of them
26
+ * sends is still answered but never adds a candidate or pair to the new
27
+ * generation's checklist.
28
+ */
29
+ private retiredRemoteUsernames;
14
30
  checkList: CandidatePair[];
15
31
  localCandidates: Candidate[];
16
32
  /**
@@ -19,8 +35,10 @@ export declare class Connection implements IceConnection {
19
35
  * configured and useDefaultStunServer is not false.
20
36
  */
21
37
  stunServers: Address[];
38
+ /** Whether stunServers is the built-in default (none configured). */
39
+ private usesDefaultStunServer;
22
40
  /** TURN servers gathering allocates on, one allocation each. */
23
- turnServers: Required<TurnServerOptions>[];
41
+ turnServers: NormalizedTurnServer[];
24
42
  options: IceOptions;
25
43
  remoteCandidatesEnd: boolean;
26
44
  /**
@@ -38,6 +56,14 @@ export declare class Connection implements IceConnection {
38
56
  localCandidatesEnd: boolean;
39
57
  /** connect() began this generation's checks (their outcome sets the state). */
40
58
  private checksBegun;
59
+ /** connect() stopped scheduling checks (a later pair must start its own). */
60
+ private schedulingStopped;
61
+ /**
62
+ * The waits of connect() (one per concurrent call) for the peer's first
63
+ * check on an empty check list; woken when a pair is added or the local
64
+ * gathering ends (waitForIncomingCheck).
65
+ */
66
+ private readonly incomingCheckWaits;
41
67
  generation: number;
42
68
  /**
43
69
  * Counts every reset of the remote generation: a local ICE restart and a
@@ -64,7 +90,26 @@ export declare class Connection implements IceConnection {
64
90
  lookup?: MdnsLookup;
65
91
  private _remoteCandidates;
66
92
  nominated?: CandidatePair;
67
- private nominating;
93
+ /** Authenticated pair the remote peer last sent application data on. */
94
+ private lastDataPair?;
95
+ /**
96
+ * Selected pairs of the previous generation (ours and the one the peer was
97
+ * sending on; nomination can be asymmetric). RFC 8445 §9: media continues
98
+ * over the previously selected pair until the restart selects a new one.
99
+ * The peer may keep using it after we nominate, so these are released once
100
+ * the peer sends on an authenticated current-generation pair.
101
+ */
102
+ private previousSelectedPairs;
103
+ /** The ICE-lite nomination (first valid pair, in `checkStart`) is in flight. */
104
+ private liteNominating;
105
+ /** Regular nomination (RFC 8445 §8.1.1) of the live checklist. */
106
+ private readonly nomination;
107
+ /** Semi-aggressive nomination and renomination: replacing the selection. */
108
+ private readonly selection;
109
+ /** See `NominationHint`; set by the restart that ends a provisional checklist. */
110
+ private nominationHint?;
111
+ /** USE-CANDIDATE re-sent for a pair selected before the agent became controlling (`confirmSelections`). */
112
+ private readonly selectionConfirmations;
68
113
  /**
69
114
  * Aborted when the remote generation ends (restart, restartRemote, close):
70
115
  * every check and nomination transaction of that generation stops with it.
@@ -77,55 +122,131 @@ export declare class Connection implements IceConnection {
77
122
  * - `retryCheck` (487 role conflict / 401 retry): the handle of the check
78
123
  * it replaces and this signal (the retry is a `checkStart`).
79
124
  * - regular nomination in `checkStart` (toward an ICE-lite peer): the
80
- * check's signal; `isStaleNomination` guards `nominating`, the pair state
81
- * and `checkComplete`.
82
- * - `nominateTcpPair`: this signal; `isStaleNomination`.
83
- * - `checkProvisional` / `nominateProvisional`: `generation.checks`
84
- * (`endProvisional()`, a replacement pranswer, close); `belongs()`.
85
- * - `queryConsent`: a per-request `AbortController` and
86
- * `stopConsentLifecycle()`; `consentSessionId`.
125
+ * check's signal; `isStaleNomination` guards `liteNominating`, the pair
126
+ * state and `checkComplete`.
127
+ * - `RegularNomination` (live: `sendNomination`): this signal and the
128
+ * attempt's own, which `reset()` (restart, restartRemote,
129
+ * resetNominatedPair, close) and `invalidate()` (role change) abort; a
130
+ * result of a replaced attempt is ignored. Its delay timer is cleared by
131
+ * `reset()`.
132
+ * - `ProvisionalChecklist` checks and nominations: `generation.checks`
133
+ * (`end()`, a replacement pranswer, close); `belongs()`, and
134
+ * the provisional `RegularNomination` as above.
135
+ * - consent checks (`ConsentFreshness`): a per-request `AbortController`
136
+ * and `consent.stop()`; its session id.
87
137
  * - `serverReflexiveCandidate` (gathering): `protocol.close()`; otherwise
88
138
  * it ends by its retransmission timeout, and `stale()` drops the
89
- * candidate of an ended gather.
139
+ * candidate (or the failure) of an ended gather.
90
140
  * - TURN client requests: the `closing` signal and `TurnProtocol.close()`.
91
141
  * Regression tests: `tests/ice/check-cancel.test.ts`.
92
142
  */
93
143
  private remoteChecks;
94
144
  private checkListDone;
95
- /** Resolves when the agent closes: work that awaits the network stops waiting. */
96
- private readonly closedSignal;
97
- private signalClosed;
98
145
  /** Aborted by close(): a TURN allocation still running is released. */
99
146
  private readonly closing;
100
147
  /**
101
- * Results for connect(). Known constraint (as in develop): a restart
102
- * replaces the queue, so a connect() still waiting on the old one never
103
- * settles (the agent is still collected). It cannot simply return, since
104
- * the caller (webrtc's `TransactionActivation`) treats a returned start as
105
- * a connected ICE transport.
148
+ * Results for connect() of the current generation. A restart replaces the
149
+ * queue; a connect() of the replaced generation keeps the old one and
150
+ * stops on that generation's `remoteChecks` signal instead (connectError).
106
151
  */
107
152
  private checkListState;
108
153
  private earlyChecks;
109
154
  private earlyChecksDone;
110
155
  private localCandidatesStart;
111
156
  private protocols;
112
- private queryConsentHandle?;
113
- /** RFC 7675 consent-to-send: application data may use the selected pair. */
114
- private consentFresh;
115
- /** Invalidates in-flight consent callbacks on restart / close / replace / expire. */
116
- private consentSessionId;
117
- private consentExpiryTimer?;
118
- private consentRequestAbort?;
119
- /** ICE restart generation checked beside the selected current pair. */
120
- private provisional?;
157
+ /** RFC 7675 consent freshness of the selected pair. */
158
+ private readonly consent;
159
+ /**
160
+ * Failover of the selected pair without an ICE restart (see
161
+ * `failoverEnabled`): the backup pairs it monitors and the liveness of
162
+ * the selected one.
163
+ */
164
+ private readonly failover;
165
+ /**
166
+ * The pair a nomination that moves the selection off a pair that still
167
+ * outranks (or equals) it is sent for, until its outcome, and why
168
+ * (`failover`: `evaluateFailover`; `receiving`, `rtt`:
169
+ * `SelectionController`). When it succeeds the selection moves to it even
170
+ * if the old pair answered again meanwhile (the peer may already have taken
171
+ * the nomination). After `failover` and `receiving` the old pair's socket
172
+ * is demoted (D4).
173
+ * @see tests/ice/selection-controller.test.ts "receiving: a selection that recovers within RECEIVING_SWITCHING_DELAY stays; one that does not moves after it"
174
+ * @see tests/ice/selection-controller.test.ts "an RTT switch within the hold is not a failover: the old pair is not demoted"
175
+ */
176
+ private switchNomination?;
177
+ /**
178
+ * The controlling agent's choice among the selection and the monitored
179
+ * backups by receiving state and RTT (libwebrtc's ICE controller).
180
+ */
181
+ private readonly switching;
182
+ /** See `failoverThresholds`. */
183
+ private failoverThresholdsCache?;
121
184
  /**
122
- * Server-reflexive candidates each UDP socket advertised in its last
123
- * gathering (one per distinct mapping its STUN servers returned).
185
+ * The selected pair's consent expired while a backup was writable: the
186
+ * agent fails when this fires unless the selection moved first
187
+ * (FAILOVER_CONSENT_EXPIRED_GRACE).
124
188
  */
125
- private readonly reflexiveBySocket;
189
+ private consentExpiredGrace?;
190
+ /** The state `disconnected` replaced, restored when the selection works again. */
191
+ private stateBeforeDisconnect?;
192
+ /** Host, server-reflexive and relay gathering (`CandidateGatherer`). */
193
+ private readonly gatherer;
194
+ /**
195
+ * Settles when the background server-reflexive queries of the current
196
+ * generation end (see {@link Connection.waitForLocalCandidatesEnd}).
197
+ */
198
+ private localCandidatesEndPromise?;
199
+ /** ICE restart generation checked beside the selected current pair. */
200
+ private readonly provisionalChecklist;
126
201
  readonly onData: Event<[Buffer<ArrayBufferLike>]>;
127
202
  readonly stateChanged: Event<[IceState]>;
128
203
  readonly onIceCandidate: Event<[Candidate]>;
204
+ /**
205
+ * A STUN server query or TURN allocation of the current generation's
206
+ * gathering failed (W3C `icecandidateerror`), synchronously and without
207
+ * changing the gathering: other servers and sockets go on, and gathering
208
+ * still completes. A server answering with an error gives its ERROR-CODE,
209
+ * once per local socket and generation. One that is not reached (timeout,
210
+ * `stunGatherTimeout`, DNS, connect or socket error) gives 701, once per
211
+ * server and generation and only when no local socket reached it (a STUN
212
+ * server is reported when the last socket's query ended). A TURN server's UDP attempt and its TCP fallback are
213
+ * one failure, reported when both failed (a server's error code wins over
214
+ * 701). A credential retry (401 / 438) that succeeds is not a failure.
215
+ * Nothing is fired for a replaced generation or after close (the event
216
+ * completes then). A STUN failure carries the host address of a socket
217
+ * that asked; a TURN one carries none. The built-in default STUN server (none
218
+ * configured, `useDefaultStunServer` not false) is named by the
219
+ * synthesized URL {@link DEFAULT_STUN_SERVER_URL} in `server.urls`.
220
+ */
221
+ readonly onIceCandidateError: Event<[IceCandidateErrorInfo]>;
222
+ /**
223
+ * The current generation's gathering reported an error (werift extension,
224
+ * see {@link IceGatheringErrorInfo}). New reasons may be added: handle
225
+ * unknown values.
226
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「without servers or explicit addresses: ends with interface-enumeration-failed then no-candidates」
227
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「a STUN server still gives a server-reflexive candidate」
228
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「an unexpected exception reports gathering-failed, ends the generation and rejects」
229
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「restarting from the no-candidates listener leaves the new generation ungathered」
230
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「nothing is reported after close」
231
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「nothing is reported for a generation an ICE restart replaced」
232
+ * @see packages/ice/tests/ice/interface-enumeration.test.ts「a listener that throws does not stop the gathering or the later listeners」
233
+ */
234
+ readonly onGatheringError: Event<[IceGatheringErrorInfo]>;
235
+ /**
236
+ * A STUN or TURN server of the current generation's gathering answered:
237
+ * a STUN query or TURN allocation gave a candidate, or the server sent an
238
+ * error response (see {@link IceServerReachedInfo}). Synchronous; nothing
239
+ * is fired for a replaced generation or after close.
240
+ */
241
+ readonly onIceServerReached: Event<[IceServerReachedInfo]>;
242
+ /** The staged ICE restart generation (`ProvisionalChecklist`). */
243
+ private get provisional();
244
+ private set spedRuntime(value);
245
+ /**
246
+ * Exact SPED Binding Response bytes keyed by STUN transaction id.
247
+ * Handshake only: TTL = STUN transaction lifetime, LRU-capped.
248
+ */
249
+ private spedBindingCache;
129
250
  constructor(_iceControlling: boolean, options?: Partial<IceOptions>);
130
251
  /**
131
252
  * Replace STUN/TURN servers after construction.
@@ -158,7 +279,35 @@ export declare class Connection implements IceConnection {
158
279
  get iceControlling(): boolean;
159
280
  set iceControlling(value: boolean);
160
281
  get iceLite(): boolean;
282
+ /**
283
+ * Keep the selected path of the generation a restart replaces: the peer
284
+ * keeps sending media on it until it moves to the new selected pair
285
+ * (RFC 8445 §9). Its datagrams stay deliverable as media only.
286
+ */
287
+ private retainSelectedPairs;
161
288
  restart(): Promise<void>;
289
+ /** DTLS handshake datagram on an authenticated current-generation pair. */
290
+ private sendHandshakeOnAuthenticatedPair;
291
+ /**
292
+ * Direct fallback only on a current-generation authenticated CandidatePair.
293
+ * No pair (e.g. earlyChecks) means no wire send.
294
+ */
295
+ private maybeSendSpedFallback;
296
+ /**
297
+ * UDP prflx with a pending C070-less Binding: lock unsupported once
298
+ * trickle proves host/srflx, or end-of-candidates / nomination leaves a
299
+ * lasting prflx. Nomination is enough: RFC 8838 allows ICE to complete
300
+ * before end-of-candidates, and a nominated pair must not gain new
301
+ * trickle candidates.
302
+ * @returns the pair that locked unsupported, if any.
303
+ */
304
+ private settleSpedUnconfirmed;
305
+ /**
306
+ * Send the original L1 snapshot on the pair that locked fallback.
307
+ * Prefer `preferredPair` so nomination settlement cannot race
308
+ * `this.nominated` and land on an earlier authenticated checklist entry.
309
+ */
310
+ private flushSpedUnconfirmedFallback;
162
311
  /**
163
312
  * Only the remote side restarted (new remote credentials in an answer to an
164
313
  * offer that kept the local ones): the remote generation, its checks and
@@ -170,11 +319,6 @@ export declare class Connection implements IceConnection {
170
319
  * replaces (or close ends), and start a signal for the next generation.
171
320
  */
172
321
  private cancelChecks;
173
- /**
174
- * Drop the provisional generation and stop the checks still in flight for
175
- * it (their retransmissions would outlive it).
176
- */
177
- private endProvisional;
178
322
  /** Accept provisional checks without changing the selected current pair. */
179
323
  stageLocalCredentials(usernameFragment: string, password: string, gatherOptions?: Partial<IceOptions>): void;
180
324
  discardStagedLocalCredentials(usernameFragment: string): void;
@@ -187,11 +331,6 @@ export declare class Connection implements IceConnection {
187
331
  /** Start checks for the provisional generation; the selected pair is kept. */
188
332
  startProvisionalChecks(): void;
189
333
  get provisionalNominated(): CandidatePair | undefined;
190
- private tryProvisionalPair;
191
- private checkProvisional;
192
- private nominateProvisional;
193
- /** Incoming check for the provisional ufrag; never touches the current checklist. */
194
- private checkIncomingProvisional;
195
334
  /** Called after restart, before re-gathering the chosen generation. */
196
335
  commitLocalCredentials(usernameFragment: string, password: string): void;
197
336
  /**
@@ -201,11 +340,16 @@ export declare class Connection implements IceConnection {
201
340
  */
202
341
  dropOtherRemoteGenerations(usernameFragment: string): void;
203
342
  resetNominatedPair(): void;
343
+ get remoteIce2(): boolean;
344
+ setRemoteIceOptions(options: string[]): void;
204
345
  setRemoteParams({ iceLite, usernameFragment, password, }: {
205
346
  iceLite: boolean;
206
347
  usernameFragment: string;
207
348
  password: string;
208
349
  }): void;
350
+ private retireRemoteUsername;
351
+ /** A check sent by a remote generation that was replaced. */
352
+ private isRetiredRemoteCheck;
209
353
  /**
210
354
  * Gather the local candidates of the current generation.
211
355
  *
@@ -216,56 +360,115 @@ export declare class Connection implements IceConnection {
216
360
  * allocation), so a caller may let it finish in the background.
217
361
  */
218
362
  gatherCandidates(): Promise<void>;
363
+ /** @see packages/ice/tests/ice/interface-enumeration.test.ts「an unexpected exception reports gathering-failed, ends the generation and rejects」 */
364
+ private gatherGeneration;
365
+ /** @see packages/ice/tests/ice/interface-enumeration.test.ts「without servers or explicit addresses: ends with interface-enumeration-failed then no-candidates」 */
366
+ private endLocalCandidates;
367
+ /** @see packages/ice/tests/ice/interface-enumeration.test.ts「nothing is reported after close」 */
368
+ private emitGatheringError;
369
+ /**
370
+ * Wait for `work` or close(), whichever comes first. Unlike racing a
371
+ * promise that stays pending for the agent's lifetime, the close listener
372
+ * goes away with this wait, so a settled gathering (and the candidates its
373
+ * result holds) is not kept alive by every later restart.
374
+ */
375
+ private untilSettledOrClosed;
376
+ /**
377
+ * Resolves when the current generation's gathering has ended
378
+ * (`localCandidatesEnd`): {@link Connection.gatherCandidates} returns once
379
+ * the host sockets, the TURN allocations and the representative socket's
380
+ * server-reflexive query are done, while the other host sockets' queries
381
+ * continue and trickle through `onIceCandidate`. Also resolves when the
382
+ * agent closes or restarts (the generation ends without its end).
383
+ */
384
+ waitForLocalCandidatesEnd(): Promise<void>;
219
385
  /**
220
386
  * Whether gathering started for `generation` still belongs to the agent:
221
387
  * no ICE restart replaced the generation and the agent is not closed.
222
388
  */
223
389
  private isGathering;
224
- /**
225
- * Whether the provisional generation may use `protocol`: the staged
226
- * generation drops the sockets its gather options exclude at the commit,
227
- * so its checks never use them. A kept TURN allocation serves it only when
228
- * the generation still uses that TURN server, credential and transport (any of its
229
- * TURN servers): one whose server was removed or replaced (a credential
230
- * rotation) is not part of it.
231
- */
232
- private allowsProvisional;
233
390
  /** A copy of `candidate` labelled with the current generation and ufrag. */
234
391
  private withGeneration;
235
392
  /** Whether gathering contacts a STUN or TURN server (more than re-advertising sockets). */
236
393
  get gathersFromServers(): boolean;
237
394
  private appendLocalCandidate;
395
+ /**
396
+ * Report a failed STUN query / TURN allocation of the gathering whose
397
+ * `stale` is given (see onIceCandidateError). A failure that is not
398
+ * reported (cancelled), belongs to a replaced generation or arrives after
399
+ * close is dropped. A listener that throws does not stop the gathering.
400
+ */
401
+ private emitCandidateError;
402
+ /** Report that `server` answered the gathering whose `stale` is given. */
403
+ private emitServerReached;
238
404
  private ensureProtocol;
405
+ private handleBindingRequest;
406
+ /** Queue a check until connect() while the checklist is empty, else handle it. */
407
+ private queueOrCheckIncoming;
408
+ /**
409
+ * @returns true when the request is fully handled (an error response was
410
+ * sent, or the role switched and the peer retries).
411
+ */
412
+ private resolveRoleConflict;
413
+ private handleCurrentGenerationBinding;
414
+ private shouldCacheSpedBindingResponse;
415
+ private cachedSpedBindingResponse;
416
+ private storeSpedBindingResponse;
239
417
  /**
240
418
  * RFC 6544: the selected TCP connection is the only path for this component;
241
419
  * once it is closed no application data or consent check can reach the peer,
242
420
  * so fail the same way as a consent expiry instead of waiting for it.
243
421
  */
244
422
  private handleConnectionClosed;
245
- private getCandidatePromises;
423
+ connect(): Promise<void>;
246
424
  /**
247
- * Allocate on one TURN server and add its relay candidate. A UDP
248
- * allocation that fails falls back to TCP on the same server. An
249
- * allocation that completes for a replaced generation (or a closed agent)
250
- * is released.
425
+ * The error connect() ends with when its generation ended: close() fails
426
+ * it as before (`ICE negotiation failed`); a restart (local or
427
+ * remote-only) cancels it with `IceRestartedError`, which says nothing
428
+ * about the generation that replaced it.
251
429
  */
252
- private gatherRelayCandidate;
253
- connect(): Promise<void>;
430
+ private connectError;
431
+ /**
432
+ * Resolves (with ICE_FAILED, which no caller acts on: each checks
433
+ * `ended` first) once `ended` aborts, so a wait raced against it stops.
434
+ */
435
+ private untilEnded;
436
+ /**
437
+ * With an empty check list, wait for a pair (a check from the peer taught a
438
+ * peer-reflexive candidate, RFC 8445 section 7.3.1.3, the only way to
439
+ * connect to a peer whose TCP candidates are all active, RFC 6544; or a
440
+ * trickled candidate). Resolves true when a pair was added, so that the
441
+ * scheduling loop runs again; false when:
442
+ * - the local gathering ended without a socket that could receive a check
443
+ * (at once, also when it ends during the wait: an ICE-lite agent may
444
+ * connect while it still gathers),
445
+ * - `incomingCheckTimeout` ran out (a deadline fixed when the wait began;
446
+ * being woken does not extend it), or
447
+ * - the generation ended (`ended`; the caller settles with connectError).
448
+ * Every concurrent caller wakes on its own.
449
+ */
450
+ private waitForIncomingCheck;
451
+ /** Wake every wait of connect() for an incoming check (waitForIncomingCheck). */
452
+ private wakeIncomingCheckWaits;
254
453
  private unfreezeInitial;
255
454
  private schedulingChecks;
256
455
  /**
257
- * Stop consent request cadence, expiry timer, and outstanding transactions.
258
- * Does not change ICE state by itself.
456
+ * Mirror libwebrtc semi-aggressive nomination (not required by RFC 7675):
457
+ * attach USE-CANDIDATE to consent checks of the selected pair when we are
458
+ * controlling and the remote is ICE-lite, or we nominate semi-aggressively
459
+ * (a peer that became controlled after a role conflict, or lost the
460
+ * nominating response, learns the selection from them).
259
461
  */
260
- private stopConsentLifecycle;
462
+ private shouldNominateConsentRequest;
261
463
  /**
262
- * ICE-lite interop only (not required by RFC 7675): mirror libwebrtc
263
- * semi-aggressive nomination — attach USE-CANDIDATE when we are controlling,
264
- * the remote is ICE-lite, and the target is the current selected pair.
464
+ * Renomination: the NOMINATION value consent checks of the selected pair
465
+ * carry, so the peer keeps (or learns) the selection. A pair selected
466
+ * without a renomination of this agent (the peer nominated it while this
467
+ * agent was controlled) takes the next value.
265
468
  */
266
- private shouldNominateConsentRequest;
267
- private canSendApplicationData;
268
- private abortableDelay;
469
+ private consentNomination;
470
+ private applicationDataPair;
471
+ /** Start RFC 7675 consent freshness for the selected pair. */
269
472
  private queryConsent;
270
473
  close(): Promise<void>;
271
474
  private setState;
@@ -278,6 +481,11 @@ export declare class Connection implements IceConnection {
278
481
  * the pairing and provisional lifecycle together.
279
482
  */
280
483
  addRemoteCandidate(remoteCandidate: Candidate | undefined): Promise<void>;
484
+ /**
485
+ * Trickle may signal host/srflx/relay after the address was learned as
486
+ * prflx. Reuse that Candidate so SPED eligibility follows the signaled type.
487
+ */
488
+ private adoptExistingPrflx;
281
489
  send: (data: Buffer) => Promise<void>;
282
490
  getDefaultCandidate(): Candidate;
283
491
  set remoteCandidates(value: Candidate[]);
@@ -285,46 +493,246 @@ export declare class Connection implements IceConnection {
285
493
  get candidatePairs(): CandidatePair[];
286
494
  private sortCheckList;
287
495
  private findPair;
496
+ /**
497
+ * Several remote candidates can share one transport address (a srflx equal
498
+ * to its host base), so one 5-tuple may have several pairs. Checks are
499
+ * accounted on one of them only; prefer the authenticated pair so the
500
+ * 5-tuple is not judged by a FROZEN/FAILED duplicate.
501
+ */
502
+ private findPairByAddr;
503
+ /**
504
+ * Datagrams map to a pair by protocol and remote 5-tuple.
505
+ * Nominated is preferred only when the source matches that pair.
506
+ */
507
+ private resolveDatagramPair;
508
+ private isPreviousSelectedPair;
509
+ private decorateSpedRequest;
510
+ private bindingResponseSourceMatches;
511
+ private isStaleConnectivityCheck;
512
+ private abandonInFlightStunTransactions;
513
+ private consumeSpedStun;
288
514
  private applyIceControlling;
515
+ /**
516
+ * The agent became controlling with a pair already selected (live or
517
+ * provisional), e.g. one the peer nominated while this agent was
518
+ * controlled. The selection stays (RFC 8445 §8.1.1 allows no other pair),
519
+ * but the peer, controlled now, may still wait for a nomination: send
520
+ * USE-CANDIDATE for that pair, repeated on timeouts as a nomination is.
521
+ * A peer that selected the pair already keeps it.
522
+ */
523
+ private confirmSelections;
524
+ private confirmSelection;
525
+ /**
526
+ * The role changed: a nomination in flight (live or provisional) was sent
527
+ * as the controlling agent and must not select a pair, fail one, or fail
528
+ * the agent under the new role. Its transaction stops; a controlling agent
529
+ * later nominates afresh.
530
+ */
531
+ private invalidateNominations;
289
532
  private switchRole;
290
533
  private checkComplete;
534
+ /**
535
+ * Fail the check list once no pair can succeed and no nomination can still
536
+ * select one. Background gathering and remote trickle both delay this.
537
+ */
538
+ private concludeCheckListIfExhausted;
291
539
  checkStart: (pair: CandidatePair) => {
292
540
  awaitable: Promise<void>;
293
541
  resolve: (value: void | PromiseLike<void>) => void;
294
542
  reject: (reason?: any) => void;
295
543
  };
544
+ /**
545
+ * A check of the live checklist cancelled before its outcome (the
546
+ * checklist completed, `connect` cancels the remaining checks) leaves the
547
+ * pair Waiting instead of In-Progress, so the peer's checks on it still
548
+ * trigger one (7.2.1.4): a controlled agent that selected a lower pair can
549
+ * then follow a later nomination of this one. A nomination already received
550
+ * for it is checked at once (its triggering check came while the cancelled
551
+ * one was still in flight). A generation that ended or a closed agent
552
+ * changes nothing.
553
+ */
554
+ private checkCancelled;
296
555
  /**
297
556
  * 487 / 401 retry of a check: the retry is cancelled with the check it
298
557
  * replaces (its handle) and, through checkStart, with the generation.
299
558
  */
300
559
  private retryCheck;
301
560
  private isTcpPair;
561
+ private checkRequestOptions;
562
+ /** The agent is controlling and both agents are full ICE. */
563
+ private nominatesFullPeer;
302
564
  /**
303
- * Aggressive nomination lets each side settle on whichever TCP connection
304
- * finished first; the two sides can then pick different connections and
305
- * pruning destroys the peer's choice. For TCP the controlling agent instead
306
- * nominates exactly one valid pair (RFC 8445 §8.1.1 regular nomination).
565
+ * Both agents advertised renomination (`IceOptions.renomination`): the
566
+ * controlling agent nominates with NOMINATION values instead of
567
+ * USE-CANDIDATE, whatever `IceOptions.nomination` says.
307
568
  */
308
- private usesTcpRegularNomination;
309
- private checkRequestOptions;
569
+ private usesRenomination;
570
+ /**
571
+ * `nomination: "regular"`: RFC 8445 §8.1.1 regular nomination for every
572
+ * transport. A check that succeeds only makes its pair valid;
573
+ * `RegularNomination` later picks one valid pair and nominates it once
574
+ * with a separate USE-CANDIDATE check.
575
+ */
576
+ private usesRegularNomination;
577
+ /**
578
+ * The default, as libwebrtc: checks carry USE-CANDIDATE until a pair is
579
+ * selected and afterwards for pairs that outrank the selected one, so the
580
+ * first pair that succeeds is selected at once and a higher-priority pair
581
+ * that succeeds later (a TURN/UDP candidate trickled after a TURN/TCP one
582
+ * connected) replaces it. A first-success-wins nomination would keep the
583
+ * lower-priority pair for the whole session.
584
+ */
585
+ private usesSemiAggressiveNomination;
310
586
  /**
311
- * Controlling side: nominate the highest-priority TCP pair once every
312
- * higher-priority TCP pair has finished its check, so the choice does not
313
- * depend on which connection happened to complete first.
587
+ * The controlling agent may move the selection to a higher-priority pair
588
+ * (semi-aggressive nomination, renomination): checks of pairs that outrank
589
+ * the selected one go on after the first selection.
314
590
  */
315
- private nominateTcpPairIfReady;
316
- private nominateTcpPair;
317
- /** The agent was closed or restarted while the nomination was in flight. */
591
+ private replacesSelection;
592
+ /**
593
+ * A pair semi-aggressive nomination and renomination may select: not an
594
+ * ICE-TCP pair (each TCP pair is its own connection, and nominating more
595
+ * than one could leave the agents on different connections after pruning;
596
+ * TCP pairs keep regular nomination, see `regularNominationPairs`), nor
597
+ * one the agent never checks (forceTurn).
598
+ */
599
+ private replacesWith;
600
+ /**
601
+ * The pairs `RegularNomination` nominates from: every pair with
602
+ * `nomination: "regular"`, otherwise the ICE-TCP pairs (as before
603
+ * semi-aggressive nomination, #721).
604
+ */
605
+ private regularNominationPairs;
606
+ /** `IceOptions.nominationDelayMs`, or its default when unset or invalid. */
607
+ private get nominationDelayMs();
608
+ /** A pair the agent never checks itself (forceTurn keeps it from the schedule). */
609
+ private isUncheckedPair;
610
+ /** The highest-priority valid pair of `pairs`. */
611
+ private bestValidPair;
612
+ private outranks;
613
+ /**
614
+ * The live checklist's side of regular nomination (`RegularNomination`):
615
+ * the controlling agent nominates the best valid pair once the checklist
616
+ * is quiet (see `decideNomination`).
617
+ */
618
+ private liveNominationHost;
619
+ /**
620
+ * Send the USE-CANDIDATE check for a live `pair` (see `NominationOutcome`),
621
+ * or with `nomination` the renomination check that carries that
622
+ * NOMINATION value instead.
623
+ */
624
+ private sendNomination;
625
+ /**
626
+ * No attempt of a USE-CANDIDATE check was answered, or the pair a
627
+ * provisional nomination may have selected (`NominationHint`) failed or
628
+ * never appeared. A request may still have reached the peer, and a
629
+ * controlled agent keeps the first pair
630
+ * nominated to it (RFC 8445 §8.1.1): nominating another pair could leave
631
+ * the two agents on different pairs. The agent nominates nothing else,
632
+ * connect() rejects and the agent fails (an ICE restart starts over), as a
633
+ * consent expiry does.
634
+ */
635
+ private nominationAbandoned;
636
+ /**
637
+ * At the restart that ends the provisional checklist (a final answer): the
638
+ * pair it nominated, or sent a USE-CANDIDATE to that the peer did not
639
+ * refuse (see `NominationHint`).
640
+ */
641
+ private provisionalNominationHint;
642
+ /** The agent was closed or restarted while the ICE-lite nomination was in flight. */
318
643
  private isStaleNomination;
319
644
  private addPair;
645
+ private ensureIncomingPair;
320
646
  checkIncoming(message: Message, addr: Address, protocol: Protocol): void;
647
+ /**
648
+ * @param admit after a selection that may still be replaced, only pairs
649
+ * that could replace it join the checklist.
650
+ */
321
651
  private tryPair;
652
+ /** See `tryPair`: undefined admits every pair. */
653
+ private admitsPair;
654
+ /**
655
+ * Failover of the selected pair without an ICE restart (libwebrtc
656
+ * compatible) applies to the agent's mode: both agents are full ICE and the
657
+ * agent uses semi-aggressive nomination or renomination (the modes in which
658
+ * a controlling agent may replace the selection, `replacesSelection`; a
659
+ * controlled agent follows the peer's nominations). Regular nomination
660
+ * (RFC 8445 §8.1.1 allows no other pair without an ICE restart) and ICE-lite
661
+ * keep the selection until consent expires.
662
+ */
663
+ private failoverScope;
664
+ /** {@link failoverScope}, and the selected pair is not ICE-TCP (its closed connection fails the agent). */
665
+ private failoverEnabled;
666
+ /** `IceOptions.failover` with its defaults (resolved again when the options change). */
667
+ private get failoverThresholds();
668
+ /**
669
+ * Failover: the selected pair stopped receiving (`isNotReceiving`) while
670
+ * its consent is still fresh and it is not unwritable yet.
671
+ * `SelectionController` makes that switch; this lets its nomination
672
+ * replace the selection.
673
+ * @see tests/ice/failover.test.ts "the selected pair stops answering and receiving: once it has not been receiving for 1 s (from the later of 2.5 s of silence and an unanswered check), the agent moves to the backup that receives, before the pair is unwritable (§15 A)"
674
+ */
675
+ private selectionNotReceiving;
676
+ /** Failover: the selection may move to a backup ({@link selectionDown} or {@link selectionNotReceiving}). */
677
+ private selectionFailing;
678
+ /** Failover: the selected pair stopped answering (unwritable) or its consent expired. */
679
+ private selectionDown;
680
+ /** Whether `pair` may be nominated to move the selection up (see `FailoverMonitor.allows`). */
681
+ private failoverAllows;
682
+ private failoverHost;
683
+ /** The writability of a monitored pair may have changed. */
684
+ private onLinkChanged;
685
+ /**
686
+ * Failover (controlling): the selected pair stopped answering, so nominate
687
+ * the best writable backup (`FailoverMonitor.target`), with USE-CANDIDATE
688
+ * (semi-aggressive) or the next NOMINATION value (renomination). Its
689
+ * success moves the selection (`replacesSelectedPair`). A controlled agent
690
+ * only follows the peer's nominations.
691
+ *
692
+ * A selected pair that only stopped receiving is `SelectionController`'s.
693
+ * @see tests/ice/failover.test.ts "the selected pair stops answering and receiving: once it has not been receiving for 1 s (from the later of 2.5 s of silence and an unanswered check), the agent moves to the backup that receives, before the pair is unwritable (§15 A)"
694
+ */
695
+ private evaluateFailover;
696
+ /**
697
+ * Failover: the agent's state from the selected pair and the backups.
698
+ * `disconnected` while the selected pair is unwritable and no backup is
699
+ * writable; back to the state it replaced only once the selected pair is
700
+ * writable again (it recovered, or the selection moved to a backup); a
701
+ * backup that answers before the selection moved to it keeps the agent
702
+ * `disconnected`. `failed` once the selected pair's consent expired with no
703
+ * writable backup left.
704
+ */
705
+ private updateLinkState;
706
+ /** See `consentExpiredGrace`. */
707
+ private startConsentExpiredGrace;
708
+ private clearConsentExpiredGrace;
709
+ /** The selected pair's consent expired and no backup took over: the agent fails (an ICE restart recovers). */
710
+ private failConsentExpired;
711
+ /**
712
+ * Failover: sending on `protocol` (to `remoteAddr`, or on every path of it
713
+ * when undefined: its TURN allocation is lost) failed in a way that says
714
+ * the path is gone (`Protocol.onPathBroken`). The monitored pairs on it are
715
+ * unwritable at once, so the selection fails over without waiting for
716
+ * unanswered checks (libwebrtc drops the connections of a port that is
717
+ * gone).
718
+ */
719
+ private failoverPathBroken;
720
+ /** Failover: application data arrived on `protocol` from `addr`. */
721
+ private failoverDataReceived;
722
+ /**
723
+ * Failover: one check of a backup pair, as libwebrtc pings its
724
+ * connections: no nomination (USE-CANDIDATE / NOMINATION only when the
725
+ * selection moves to it), a single transmission with the consent response
726
+ * timeout. Resolves true when it was answered from the pair's address.
727
+ */
728
+ private pingBackup;
322
729
  /**
323
730
  * Pair a local candidate gathered after remote candidates arrived (a late
324
731
  * TURN allocation, a slow host socket) with them.
325
732
  */
326
733
  private pairLocalProtocol;
327
734
  private pairRemoteCandidate;
735
+ /** A connectivity check from this agent (`buildCheckRequest`). */
328
736
  private buildRequest;
329
737
  private pruneTcpConnections;
330
738
  private respondError;