@mtkruto/node 0.1.800 → 0.2.1

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 (664) hide show
  1. package/esm/0_deps.d.ts +2 -0
  2. package/esm/0_deps.d.ts.map +1 -1
  3. package/esm/0_deps.js +2 -1
  4. package/esm/2_tl.d.ts +7 -8
  5. package/esm/2_tl.d.ts.map +1 -1
  6. package/esm/2_tl.js +7 -8
  7. package/esm/3_errors.d.ts +519 -515
  8. package/esm/3_errors.d.ts.map +1 -1
  9. package/esm/3_errors.js +527 -512
  10. package/esm/3_transport.d.ts +1 -0
  11. package/esm/3_transport.d.ts.map +1 -1
  12. package/esm/3_transport.js +1 -0
  13. package/esm/4_errors.d.ts +7 -7
  14. package/esm/4_errors.d.ts.map +1 -1
  15. package/esm/4_errors.js +5 -5
  16. package/esm/client/0_client_abstract.d.ts +1 -21
  17. package/esm/client/0_client_abstract.d.ts.map +1 -1
  18. package/esm/client/0_client_abstract.js +17 -15
  19. package/esm/client/0_message.d.ts +3 -3
  20. package/esm/client/0_message.d.ts.map +1 -1
  21. package/esm/client/0_message.js +4 -20
  22. package/esm/client/0_params.d.ts +1 -1
  23. package/esm/client/0_params.d.ts.map +1 -1
  24. package/esm/client/0_password.d.ts +2 -2
  25. package/esm/client/0_password.d.ts.map +1 -1
  26. package/esm/client/0_password.js +3 -8
  27. package/esm/client/0_storage_operations.d.ts +23 -23
  28. package/esm/client/0_storage_operations.d.ts.map +1 -1
  29. package/esm/client/0_storage_operations.js +13 -12
  30. package/esm/client/0_utilities.d.ts.map +1 -1
  31. package/esm/client/0_utilities.js +13 -10
  32. package/esm/client/1_client_encrypted.d.ts +3 -5
  33. package/esm/client/1_client_encrypted.d.ts.map +1 -1
  34. package/esm/client/1_client_encrypted.js +44 -28
  35. package/esm/client/1_client_plain.d.ts +2 -2
  36. package/esm/client/1_client_plain.d.ts.map +1 -1
  37. package/esm/client/1_client_plain.js +27 -19
  38. package/esm/client/1_types.d.ts +9 -22
  39. package/esm/client/1_types.d.ts.map +1 -1
  40. package/esm/client/2_account_manager.d.ts +2 -2
  41. package/esm/client/2_account_manager.js +16 -16
  42. package/esm/client/2_bot_info_manager.d.ts.map +1 -1
  43. package/esm/client/2_bot_info_manager.js +7 -6
  44. package/esm/client/2_business_connection_manager.d.ts +3 -3
  45. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  46. package/esm/client/2_business_connection_manager.js +6 -5
  47. package/esm/client/2_file_manager.d.ts +4 -4
  48. package/esm/client/2_file_manager.d.ts.map +1 -1
  49. package/esm/client/2_file_manager.js +26 -23
  50. package/esm/client/2_reaction_manager.d.ts +3 -3
  51. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  52. package/esm/client/2_reaction_manager.js +16 -10
  53. package/esm/client/2_update_manager.d.ts +11 -11
  54. package/esm/client/2_update_manager.d.ts.map +1 -1
  55. package/esm/client/2_update_manager.js +185 -164
  56. package/esm/client/3_message_manager.d.ts +8 -9
  57. package/esm/client/3_message_manager.d.ts.map +1 -1
  58. package/esm/client/3_message_manager.js +205 -474
  59. package/esm/client/3_video_chat_manager.d.ts +3 -3
  60. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  61. package/esm/client/3_video_chat_manager.js +26 -36
  62. package/esm/client/4_callback_query_manager.d.ts +3 -3
  63. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  64. package/esm/client/4_callback_query_manager.js +5 -16
  65. package/esm/client/4_chat_list_manager.d.ts +5 -4
  66. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  67. package/esm/client/4_chat_list_manager.js +56 -34
  68. package/esm/client/4_inline_query_manager.d.ts +3 -3
  69. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  70. package/esm/client/4_inline_query_manager.js +6 -15
  71. package/esm/client/4_story_manager.d.ts +3 -3
  72. package/esm/client/4_story_manager.d.ts.map +1 -1
  73. package/esm/client/4_story_manager.js +15 -32
  74. package/esm/client/5_client.d.ts +10 -12
  75. package/esm/client/5_client.d.ts.map +1 -1
  76. package/esm/client/5_client.js +60 -114
  77. package/esm/{tl/7_message.d.ts → connection/1_connection_tcp.d.ts} +14 -12
  78. package/esm/connection/1_connection_tcp.d.ts.map +1 -0
  79. package/esm/connection/1_connection_tcp.js +169 -0
  80. package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
  81. package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
  82. package/esm/deps/deno.land/std@0.224.0/io/_constants.js +4 -0
  83. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
  84. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
  85. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.js +86 -0
  86. package/esm/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
  87. package/esm/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
  88. package/esm/deps/deno.land/std@0.224.0/io/types.js +3 -0
  89. package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
  90. package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
  91. package/esm/deps/deno.land/std@0.224.0/io/write_all.js +49 -0
  92. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
  93. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
  94. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +253 -0
  95. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
  96. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
  97. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +1 -0
  98. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
  99. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
  100. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +13 -0
  101. package/esm/mod.d.ts +0 -1
  102. package/esm/mod.d.ts.map +1 -1
  103. package/esm/mod.js +0 -1
  104. package/esm/tl/0_api.d.ts +14813 -0
  105. package/esm/tl/0_api.d.ts.map +1 -0
  106. package/esm/tl/0_api.js +23222 -0
  107. package/esm/tl/1_utilities.d.ts +32 -0
  108. package/esm/tl/1_utilities.d.ts.map +1 -0
  109. package/esm/tl/1_utilities.js +65 -0
  110. package/esm/tl/1_utilities_test.d.ts.map +1 -0
  111. package/esm/tl/2_deserialize.d.ts +23 -0
  112. package/esm/tl/2_deserialize.d.ts.map +1 -0
  113. package/esm/tl/{3_deserialize.js → 2_deserialize.js} +16 -17
  114. package/esm/tl/2_serialize.d.ts +22 -0
  115. package/esm/tl/2_serialize.d.ts.map +1 -0
  116. package/esm/tl/2_serialize.js +160 -0
  117. package/esm/tl/2_serialize_test.d.ts.map +1 -0
  118. package/esm/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
  119. package/esm/tl/3_tl_reader.d.ts.map +1 -0
  120. package/esm/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
  121. package/esm/tl/3_utilities.d.ts +5 -5
  122. package/esm/tl/3_utilities.d.ts.map +1 -1
  123. package/esm/tl/3_utilities.js +9 -10
  124. package/esm/tl/4_rpc_result.d.ts +27 -0
  125. package/esm/tl/4_rpc_result.d.ts.map +1 -0
  126. package/esm/tl/4_rpc_result.js +28 -0
  127. package/{script/tl/5_tl_writer.d.ts → esm/tl/4_tl_writer.d.ts} +2 -2
  128. package/esm/tl/4_tl_writer.d.ts.map +1 -0
  129. package/esm/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
  130. package/esm/tl/5_message.d.ts +39 -0
  131. package/esm/tl/5_message.d.ts.map +1 -0
  132. package/esm/tl/5_message.js +98 -0
  133. package/esm/tl/5_message_test.d.ts.map +1 -0
  134. package/esm/transport/3_transport_provider_tcp.d.ts +14 -0
  135. package/esm/transport/3_transport_provider_tcp.d.ts.map +1 -0
  136. package/esm/transport/3_transport_provider_tcp.js +15 -0
  137. package/esm/types/0_birthday.d.ts +2 -2
  138. package/esm/types/0_birthday.d.ts.map +1 -1
  139. package/esm/types/0_callback_query_answer.d.ts +2 -2
  140. package/esm/types/0_callback_query_answer.d.ts.map +1 -1
  141. package/esm/types/0_chat_administrator_rights.d.ts +3 -3
  142. package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
  143. package/esm/types/0_chat_administrator_rights.js +1 -11
  144. package/esm/types/0_chat_member_rights.d.ts +3 -3
  145. package/esm/types/0_chat_member_rights.d.ts.map +1 -1
  146. package/esm/types/0_chat_member_rights.js +3 -3
  147. package/esm/types/0_chat_photo.d.ts +2 -2
  148. package/esm/types/0_chat_photo.d.ts.map +1 -1
  149. package/esm/types/0_chat_photo.js +2 -2
  150. package/esm/types/0_contact.d.ts +2 -2
  151. package/esm/types/0_contact.d.ts.map +1 -1
  152. package/esm/types/0_dice.d.ts +2 -2
  153. package/esm/types/0_dice.d.ts.map +1 -1
  154. package/esm/types/0_giveaway_parameters.d.ts +2 -2
  155. package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
  156. package/esm/types/0_giveaway_parameters.js +3 -3
  157. package/esm/types/0_link_preview.d.ts +2 -2
  158. package/esm/types/0_link_preview.d.ts.map +1 -1
  159. package/esm/types/0_live_stream_channel.d.ts +2 -2
  160. package/esm/types/0_live_stream_channel.d.ts.map +1 -1
  161. package/esm/types/0_location.d.ts +2 -2
  162. package/esm/types/0_location.d.ts.map +1 -1
  163. package/esm/types/0_location.js +5 -5
  164. package/esm/types/0_mask_position.d.ts +2 -2
  165. package/esm/types/0_mask_position.d.ts.map +1 -1
  166. package/esm/types/0_message_entity.d.ts +3 -3
  167. package/esm/types/0_message_entity.d.ts.map +1 -1
  168. package/esm/types/0_message_entity.js +42 -42
  169. package/esm/types/0_message_search_filter.d.ts +2 -2
  170. package/esm/types/0_message_search_filter.d.ts.map +1 -1
  171. package/esm/types/0_message_search_filter.js +14 -15
  172. package/esm/types/0_opening_hours.d.ts +2 -2
  173. package/esm/types/0_opening_hours.d.ts.map +1 -1
  174. package/esm/types/0_poll_option.d.ts +2 -2
  175. package/esm/types/0_poll_option.d.ts.map +1 -1
  176. package/esm/types/0_reaction.d.ts +3 -3
  177. package/esm/types/0_reaction.d.ts.map +1 -1
  178. package/esm/types/0_reaction.js +4 -4
  179. package/esm/types/0_restriction_reason.d.ts +2 -2
  180. package/esm/types/0_restriction_reason.d.ts.map +1 -1
  181. package/esm/types/0_thumbnail.d.ts +2 -2
  182. package/esm/types/0_thumbnail.d.ts.map +1 -1
  183. package/esm/types/0_thumbnail.js +3 -3
  184. package/esm/types/0_video_chat.d.ts +2 -2
  185. package/esm/types/0_video_chat.d.ts.map +1 -1
  186. package/esm/types/0_video_chat.js +2 -2
  187. package/esm/types/0_voice.d.ts +2 -2
  188. package/esm/types/0_voice.d.ts.map +1 -1
  189. package/esm/types/1_animation.d.ts +2 -2
  190. package/esm/types/1_animation.d.ts.map +1 -1
  191. package/esm/types/1_animation.js +2 -2
  192. package/esm/types/1_audio.d.ts +2 -2
  193. package/esm/types/1_audio.d.ts.map +1 -1
  194. package/esm/types/1_audio.js +2 -2
  195. package/esm/types/1_bot_command_scope.d.ts +9 -2
  196. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  197. package/esm/types/1_bot_command_scope.js +9 -9
  198. package/esm/types/1_chat_p.d.ts +5 -5
  199. package/esm/types/1_chat_p.d.ts.map +1 -1
  200. package/esm/types/1_chat_p.js +6 -6
  201. package/esm/types/1_document.d.ts +2 -2
  202. package/esm/types/1_document.d.ts.map +1 -1
  203. package/esm/types/1_document.js +2 -2
  204. package/esm/types/1_giveaway.d.ts +2 -2
  205. package/esm/types/1_giveaway.d.ts.map +1 -1
  206. package/esm/types/1_keyboard_button.d.ts +3 -3
  207. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  208. package/esm/types/1_keyboard_button.js +18 -45
  209. package/esm/types/1_message_reaction.d.ts +2 -2
  210. package/esm/types/1_message_reaction.d.ts.map +1 -1
  211. package/esm/types/1_message_reaction.js +5 -5
  212. package/esm/types/1_photo.d.ts +5 -5
  213. package/esm/types/1_photo.d.ts.map +1 -1
  214. package/esm/types/1_photo.js +4 -4
  215. package/esm/types/1_poll.d.ts +2 -2
  216. package/esm/types/1_poll.d.ts.map +1 -1
  217. package/esm/types/1_reaction_count.d.ts +2 -2
  218. package/esm/types/1_reaction_count.d.ts.map +1 -1
  219. package/esm/types/1_reply_quote.d.ts +2 -2
  220. package/esm/types/1_reply_quote.d.ts.map +1 -1
  221. package/esm/types/1_sticker.d.ts +3 -3
  222. package/esm/types/1_sticker.d.ts.map +1 -1
  223. package/esm/types/1_sticker.js +9 -9
  224. package/esm/types/1_story_privacy.d.ts +3 -3
  225. package/esm/types/1_story_privacy.d.ts.map +1 -1
  226. package/esm/types/1_story_privacy.js +14 -14
  227. package/esm/types/1_story_reaction.d.ts +2 -2
  228. package/esm/types/1_story_reaction.d.ts.map +1 -1
  229. package/esm/types/1_user.d.ts +2 -2
  230. package/esm/types/1_user.d.ts.map +1 -1
  231. package/esm/types/1_user.js +2 -2
  232. package/esm/types/1_venue.d.ts +2 -2
  233. package/esm/types/1_venue.d.ts.map +1 -1
  234. package/esm/types/1_venue.js +2 -2
  235. package/esm/types/1_video.d.ts +2 -2
  236. package/esm/types/1_video.d.ts.map +1 -1
  237. package/esm/types/1_video.js +2 -2
  238. package/esm/types/1_video_note.d.ts +2 -2
  239. package/esm/types/1_video_note.d.ts.map +1 -1
  240. package/esm/types/1_video_note.js +2 -2
  241. package/esm/types/2_business_connection.d.ts +2 -2
  242. package/esm/types/2_business_connection.d.ts.map +1 -1
  243. package/esm/types/2_business_connection.js +1 -2
  244. package/esm/types/2_chat.d.ts +2 -2
  245. package/esm/types/2_chat.d.ts.map +1 -1
  246. package/esm/types/2_chat.js +11 -11
  247. package/esm/types/2_chat_member.d.ts +2 -2
  248. package/esm/types/2_chat_member.d.ts.map +1 -1
  249. package/esm/types/2_chat_member.js +10 -10
  250. package/esm/types/2_chosen_inline_result.d.ts +2 -2
  251. package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
  252. package/esm/types/2_chosen_inline_result.js +5 -5
  253. package/esm/types/2_game.d.ts +2 -2
  254. package/esm/types/2_game.d.ts.map +1 -1
  255. package/esm/types/2_game.js +4 -4
  256. package/esm/types/2_inactive_chat.d.ts +2 -2
  257. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  258. package/esm/types/2_inactive_chat.js +2 -2
  259. package/esm/types/2_inline_keyboard_button.d.ts +3 -3
  260. package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
  261. package/esm/types/2_inline_keyboard_button.js +15 -21
  262. package/esm/types/2_inline_query.d.ts +2 -2
  263. package/esm/types/2_inline_query.d.ts.map +1 -1
  264. package/esm/types/2_inline_query.js +8 -8
  265. package/esm/types/2_invite_link.d.ts +2 -2
  266. package/esm/types/2_invite_link.d.ts.map +1 -1
  267. package/esm/types/2_invite_link.js +1 -2
  268. package/esm/types/2_message_reaction_count.d.ts +2 -2
  269. package/esm/types/2_message_reaction_count.d.ts.map +1 -1
  270. package/esm/types/2_message_reactions.d.ts +2 -2
  271. package/esm/types/2_message_reactions.d.ts.map +1 -1
  272. package/esm/types/2_message_reactions.js +2 -2
  273. package/esm/types/2_story_content.d.ts +2 -2
  274. package/esm/types/2_story_content.d.ts.map +1 -1
  275. package/esm/types/2_story_content.js +6 -6
  276. package/esm/types/2_story_interactions.d.ts +2 -2
  277. package/esm/types/2_story_interactions.d.ts.map +1 -1
  278. package/esm/types/2_story_interactive_area.d.ts +3 -3
  279. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  280. package/esm/types/2_story_interactive_area.js +19 -29
  281. package/esm/types/3_chat_member_updated.d.ts +2 -2
  282. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  283. package/esm/types/3_chat_member_updated.js +7 -7
  284. package/esm/types/3_reply_markup.d.ts +3 -3
  285. package/esm/types/3_reply_markup.d.ts.map +1 -1
  286. package/esm/types/3_reply_markup.js +12 -22
  287. package/esm/types/3_story.d.ts +2 -2
  288. package/esm/types/3_story.d.ts.map +1 -1
  289. package/esm/types/4_inline_query_result.d.ts +3 -3
  290. package/esm/types/4_inline_query_result.d.ts.map +1 -1
  291. package/esm/types/4_inline_query_result.js +53 -161
  292. package/esm/types/4_message.d.ts +3 -3
  293. package/esm/types/4_message.d.ts.map +1 -1
  294. package/esm/types/4_message.js +68 -59
  295. package/esm/types/5_callback_query.d.ts +3 -3
  296. package/esm/types/5_callback_query.d.ts.map +1 -1
  297. package/esm/types/5_callback_query.js +5 -5
  298. package/esm/types/5_chat_list_item.d.ts +3 -3
  299. package/esm/types/5_chat_list_item.d.ts.map +1 -1
  300. package/esm/types/5_chat_list_item.js +2 -2
  301. package/esm/types/5_inline_query_answer.d.ts +2 -2
  302. package/esm/types/5_inline_query_answer.d.ts.map +1 -1
  303. package/esm/types/_file_id.d.ts +2 -2
  304. package/esm/types/_file_id.d.ts.map +1 -1
  305. package/esm/types/_file_id.js +4 -4
  306. package/esm/types/_getters.d.ts +7 -7
  307. package/esm/types/_getters.d.ts.map +1 -1
  308. package/package.json +1 -1
  309. package/script/0_deps.d.ts +2 -0
  310. package/script/0_deps.d.ts.map +1 -1
  311. package/script/0_deps.js +5 -2
  312. package/script/2_tl.d.ts +7 -8
  313. package/script/2_tl.d.ts.map +1 -1
  314. package/script/2_tl.js +20 -11
  315. package/script/3_errors.d.ts +519 -515
  316. package/script/3_errors.d.ts.map +1 -1
  317. package/script/3_errors.js +543 -514
  318. package/script/3_transport.d.ts +1 -0
  319. package/script/3_transport.d.ts.map +1 -1
  320. package/script/3_transport.js +1 -0
  321. package/script/4_errors.d.ts +7 -7
  322. package/script/4_errors.d.ts.map +1 -1
  323. package/script/4_errors.js +6 -6
  324. package/script/client/0_client_abstract.d.ts +1 -21
  325. package/script/client/0_client_abstract.d.ts.map +1 -1
  326. package/script/client/0_client_abstract.js +41 -16
  327. package/script/client/0_message.d.ts +3 -3
  328. package/script/client/0_message.d.ts.map +1 -1
  329. package/script/client/0_message.js +3 -19
  330. package/script/client/0_params.d.ts +1 -1
  331. package/script/client/0_params.d.ts.map +1 -1
  332. package/script/client/0_password.d.ts +2 -2
  333. package/script/client/0_password.d.ts.map +1 -1
  334. package/script/client/0_password.js +2 -7
  335. package/script/client/0_storage_operations.d.ts +23 -23
  336. package/script/client/0_storage_operations.d.ts.map +1 -1
  337. package/script/client/0_storage_operations.js +12 -11
  338. package/script/client/0_utilities.d.ts.map +1 -1
  339. package/script/client/0_utilities.js +12 -9
  340. package/script/client/1_client_encrypted.d.ts +3 -5
  341. package/script/client/1_client_encrypted.d.ts.map +1 -1
  342. package/script/client/1_client_encrypted.js +42 -26
  343. package/script/client/1_client_plain.d.ts +2 -2
  344. package/script/client/1_client_plain.d.ts.map +1 -1
  345. package/script/client/1_client_plain.js +25 -17
  346. package/script/client/1_types.d.ts +9 -22
  347. package/script/client/1_types.d.ts.map +1 -1
  348. package/script/client/2_account_manager.d.ts +2 -2
  349. package/script/client/2_account_manager.js +15 -15
  350. package/script/client/2_bot_info_manager.d.ts.map +1 -1
  351. package/script/client/2_bot_info_manager.js +7 -6
  352. package/script/client/2_business_connection_manager.d.ts +3 -3
  353. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  354. package/script/client/2_business_connection_manager.js +5 -4
  355. package/script/client/2_file_manager.d.ts +4 -4
  356. package/script/client/2_file_manager.d.ts.map +1 -1
  357. package/script/client/2_file_manager.js +25 -22
  358. package/script/client/2_reaction_manager.d.ts +3 -3
  359. package/script/client/2_reaction_manager.d.ts.map +1 -1
  360. package/script/client/2_reaction_manager.js +15 -9
  361. package/script/client/2_update_manager.d.ts +11 -11
  362. package/script/client/2_update_manager.d.ts.map +1 -1
  363. package/script/client/2_update_manager.js +183 -162
  364. package/script/client/3_message_manager.d.ts +8 -9
  365. package/script/client/3_message_manager.d.ts.map +1 -1
  366. package/script/client/3_message_manager.js +204 -473
  367. package/script/client/3_video_chat_manager.d.ts +3 -3
  368. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  369. package/script/client/3_video_chat_manager.js +25 -35
  370. package/script/client/4_callback_query_manager.d.ts +3 -3
  371. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  372. package/script/client/4_callback_query_manager.js +4 -15
  373. package/script/client/4_chat_list_manager.d.ts +5 -4
  374. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  375. package/script/client/4_chat_list_manager.js +54 -32
  376. package/script/client/4_inline_query_manager.d.ts +3 -3
  377. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  378. package/script/client/4_inline_query_manager.js +5 -14
  379. package/script/client/4_story_manager.d.ts +3 -3
  380. package/script/client/4_story_manager.d.ts.map +1 -1
  381. package/script/client/4_story_manager.js +14 -31
  382. package/script/client/5_client.d.ts +10 -12
  383. package/script/client/5_client.d.ts.map +1 -1
  384. package/script/client/5_client.js +59 -113
  385. package/{esm/tl/6_rpc_result.d.ts → script/connection/1_connection_tcp.d.ts} +14 -10
  386. package/script/connection/1_connection_tcp.d.ts.map +1 -0
  387. package/script/connection/1_connection_tcp.js +196 -0
  388. package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
  389. package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
  390. package/script/deps/deno.land/std@0.224.0/io/_constants.js +7 -0
  391. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
  392. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
  393. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.js +91 -0
  394. package/script/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
  395. package/script/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
  396. package/script/deps/deno.land/std@0.224.0/io/types.js +4 -0
  397. package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
  398. package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
  399. package/script/deps/deno.land/std@0.224.0/io/write_all.js +54 -0
  400. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
  401. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
  402. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +280 -0
  403. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
  404. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
  405. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +5 -0
  406. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
  407. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
  408. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +40 -0
  409. package/script/mod.d.ts +0 -1
  410. package/script/mod.d.ts.map +1 -1
  411. package/script/mod.js +0 -1
  412. package/script/tl/0_api.d.ts +14813 -0
  413. package/script/tl/0_api.d.ts.map +1 -0
  414. package/script/tl/0_api.js +23248 -0
  415. package/script/tl/1_utilities.d.ts +32 -0
  416. package/script/tl/1_utilities.d.ts.map +1 -0
  417. package/script/tl/1_utilities.js +76 -0
  418. package/script/tl/1_utilities_test.d.ts.map +1 -0
  419. package/script/tl/2_deserialize.d.ts +23 -0
  420. package/script/tl/2_deserialize.d.ts.map +1 -0
  421. package/script/tl/{3_deserialize.js → 2_deserialize.js} +19 -20
  422. package/script/tl/2_serialize.d.ts +22 -0
  423. package/script/tl/2_serialize.d.ts.map +1 -0
  424. package/script/tl/2_serialize.js +164 -0
  425. package/script/tl/2_serialize_test.d.ts.map +1 -0
  426. package/script/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
  427. package/script/tl/3_tl_reader.d.ts.map +1 -0
  428. package/script/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
  429. package/script/tl/3_utilities.d.ts +5 -5
  430. package/script/tl/3_utilities.d.ts.map +1 -1
  431. package/script/tl/3_utilities.js +9 -10
  432. package/script/tl/4_rpc_result.d.ts +27 -0
  433. package/script/tl/4_rpc_result.d.ts.map +1 -0
  434. package/{esm/tl/8_message_container.d.ts → script/tl/4_rpc_result.js} +12 -12
  435. package/{esm/tl/5_tl_writer.d.ts → script/tl/4_tl_writer.d.ts} +2 -2
  436. package/script/tl/4_tl_writer.d.ts.map +1 -0
  437. package/script/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
  438. package/script/tl/5_message.d.ts +39 -0
  439. package/script/tl/5_message.d.ts.map +1 -0
  440. package/script/tl/5_message.js +106 -0
  441. package/script/tl/5_message_test.d.ts.map +1 -0
  442. package/script/transport/3_transport_provider_tcp.d.ts +14 -0
  443. package/script/transport/3_transport_provider_tcp.d.ts.map +1 -0
  444. package/script/transport/3_transport_provider_tcp.js +19 -0
  445. package/script/types/0_birthday.d.ts +2 -2
  446. package/script/types/0_birthday.d.ts.map +1 -1
  447. package/script/types/0_callback_query_answer.d.ts +2 -2
  448. package/script/types/0_callback_query_answer.d.ts.map +1 -1
  449. package/script/types/0_chat_administrator_rights.d.ts +3 -3
  450. package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
  451. package/script/types/0_chat_administrator_rights.js +1 -11
  452. package/script/types/0_chat_member_rights.d.ts +3 -3
  453. package/script/types/0_chat_member_rights.d.ts.map +1 -1
  454. package/script/types/0_chat_member_rights.js +3 -3
  455. package/script/types/0_chat_photo.d.ts +2 -2
  456. package/script/types/0_chat_photo.d.ts.map +1 -1
  457. package/script/types/0_chat_photo.js +1 -1
  458. package/script/types/0_contact.d.ts +2 -2
  459. package/script/types/0_contact.d.ts.map +1 -1
  460. package/script/types/0_dice.d.ts +2 -2
  461. package/script/types/0_dice.d.ts.map +1 -1
  462. package/script/types/0_giveaway_parameters.d.ts +2 -2
  463. package/script/types/0_giveaway_parameters.d.ts.map +1 -1
  464. package/script/types/0_giveaway_parameters.js +2 -2
  465. package/script/types/0_link_preview.d.ts +2 -2
  466. package/script/types/0_link_preview.d.ts.map +1 -1
  467. package/script/types/0_live_stream_channel.d.ts +2 -2
  468. package/script/types/0_live_stream_channel.d.ts.map +1 -1
  469. package/script/types/0_location.d.ts +2 -2
  470. package/script/types/0_location.d.ts.map +1 -1
  471. package/script/types/0_location.js +4 -4
  472. package/script/types/0_mask_position.d.ts +2 -2
  473. package/script/types/0_mask_position.d.ts.map +1 -1
  474. package/script/types/0_message_entity.d.ts +3 -3
  475. package/script/types/0_message_entity.d.ts.map +1 -1
  476. package/script/types/0_message_entity.js +41 -41
  477. package/script/types/0_message_search_filter.d.ts +2 -2
  478. package/script/types/0_message_search_filter.d.ts.map +1 -1
  479. package/script/types/0_message_search_filter.js +14 -15
  480. package/script/types/0_opening_hours.d.ts +2 -2
  481. package/script/types/0_opening_hours.d.ts.map +1 -1
  482. package/script/types/0_poll_option.d.ts +2 -2
  483. package/script/types/0_poll_option.d.ts.map +1 -1
  484. package/script/types/0_reaction.d.ts +3 -3
  485. package/script/types/0_reaction.d.ts.map +1 -1
  486. package/script/types/0_reaction.js +3 -3
  487. package/script/types/0_restriction_reason.d.ts +2 -2
  488. package/script/types/0_restriction_reason.d.ts.map +1 -1
  489. package/script/types/0_thumbnail.d.ts +2 -2
  490. package/script/types/0_thumbnail.d.ts.map +1 -1
  491. package/script/types/0_thumbnail.js +2 -2
  492. package/script/types/0_video_chat.d.ts +2 -2
  493. package/script/types/0_video_chat.d.ts.map +1 -1
  494. package/script/types/0_video_chat.js +1 -1
  495. package/script/types/0_voice.d.ts +2 -2
  496. package/script/types/0_voice.d.ts.map +1 -1
  497. package/script/types/1_animation.d.ts +2 -2
  498. package/script/types/1_animation.d.ts.map +1 -1
  499. package/script/types/1_animation.js +1 -1
  500. package/script/types/1_audio.d.ts +2 -2
  501. package/script/types/1_audio.d.ts.map +1 -1
  502. package/script/types/1_audio.js +1 -1
  503. package/script/types/1_bot_command_scope.d.ts +9 -2
  504. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  505. package/script/types/1_bot_command_scope.js +8 -8
  506. package/script/types/1_chat_p.d.ts +5 -5
  507. package/script/types/1_chat_p.d.ts.map +1 -1
  508. package/script/types/1_chat_p.js +5 -5
  509. package/script/types/1_document.d.ts +2 -2
  510. package/script/types/1_document.d.ts.map +1 -1
  511. package/script/types/1_document.js +1 -1
  512. package/script/types/1_giveaway.d.ts +2 -2
  513. package/script/types/1_giveaway.d.ts.map +1 -1
  514. package/script/types/1_keyboard_button.d.ts +3 -3
  515. package/script/types/1_keyboard_button.d.ts.map +1 -1
  516. package/script/types/1_keyboard_button.js +17 -44
  517. package/script/types/1_message_reaction.d.ts +2 -2
  518. package/script/types/1_message_reaction.d.ts.map +1 -1
  519. package/script/types/1_message_reaction.js +4 -4
  520. package/script/types/1_photo.d.ts +5 -5
  521. package/script/types/1_photo.d.ts.map +1 -1
  522. package/script/types/1_photo.js +3 -3
  523. package/script/types/1_poll.d.ts +2 -2
  524. package/script/types/1_poll.d.ts.map +1 -1
  525. package/script/types/1_reaction_count.d.ts +2 -2
  526. package/script/types/1_reaction_count.d.ts.map +1 -1
  527. package/script/types/1_reply_quote.d.ts +2 -2
  528. package/script/types/1_reply_quote.d.ts.map +1 -1
  529. package/script/types/1_sticker.d.ts +3 -3
  530. package/script/types/1_sticker.d.ts.map +1 -1
  531. package/script/types/1_sticker.js +8 -8
  532. package/script/types/1_story_privacy.d.ts +3 -3
  533. package/script/types/1_story_privacy.d.ts.map +1 -1
  534. package/script/types/1_story_privacy.js +13 -13
  535. package/script/types/1_story_reaction.d.ts +2 -2
  536. package/script/types/1_story_reaction.d.ts.map +1 -1
  537. package/script/types/1_user.d.ts +2 -2
  538. package/script/types/1_user.d.ts.map +1 -1
  539. package/script/types/1_user.js +1 -1
  540. package/script/types/1_venue.d.ts +2 -2
  541. package/script/types/1_venue.d.ts.map +1 -1
  542. package/script/types/1_venue.js +1 -1
  543. package/script/types/1_video.d.ts +2 -2
  544. package/script/types/1_video.d.ts.map +1 -1
  545. package/script/types/1_video.js +1 -1
  546. package/script/types/1_video_note.d.ts +2 -2
  547. package/script/types/1_video_note.d.ts.map +1 -1
  548. package/script/types/1_video_note.js +1 -1
  549. package/script/types/2_business_connection.d.ts +2 -2
  550. package/script/types/2_business_connection.d.ts.map +1 -1
  551. package/script/types/2_business_connection.js +1 -2
  552. package/script/types/2_chat.d.ts +2 -2
  553. package/script/types/2_chat.d.ts.map +1 -1
  554. package/script/types/2_chat.js +10 -10
  555. package/script/types/2_chat_member.d.ts +2 -2
  556. package/script/types/2_chat_member.d.ts.map +1 -1
  557. package/script/types/2_chat_member.js +9 -9
  558. package/script/types/2_chosen_inline_result.d.ts +2 -2
  559. package/script/types/2_chosen_inline_result.d.ts.map +1 -1
  560. package/script/types/2_chosen_inline_result.js +4 -4
  561. package/script/types/2_game.d.ts +2 -2
  562. package/script/types/2_game.d.ts.map +1 -1
  563. package/script/types/2_game.js +3 -3
  564. package/script/types/2_inactive_chat.d.ts +2 -2
  565. package/script/types/2_inactive_chat.d.ts.map +1 -1
  566. package/script/types/2_inactive_chat.js +1 -1
  567. package/script/types/2_inline_keyboard_button.d.ts +3 -3
  568. package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
  569. package/script/types/2_inline_keyboard_button.js +14 -20
  570. package/script/types/2_inline_query.d.ts +2 -2
  571. package/script/types/2_inline_query.d.ts.map +1 -1
  572. package/script/types/2_inline_query.js +7 -7
  573. package/script/types/2_invite_link.d.ts +2 -2
  574. package/script/types/2_invite_link.d.ts.map +1 -1
  575. package/script/types/2_invite_link.js +1 -2
  576. package/script/types/2_message_reaction_count.d.ts +2 -2
  577. package/script/types/2_message_reaction_count.d.ts.map +1 -1
  578. package/script/types/2_message_reactions.d.ts +2 -2
  579. package/script/types/2_message_reactions.d.ts.map +1 -1
  580. package/script/types/2_message_reactions.js +1 -1
  581. package/script/types/2_story_content.d.ts +2 -2
  582. package/script/types/2_story_content.d.ts.map +1 -1
  583. package/script/types/2_story_content.js +5 -5
  584. package/script/types/2_story_interactions.d.ts +2 -2
  585. package/script/types/2_story_interactions.d.ts.map +1 -1
  586. package/script/types/2_story_interactive_area.d.ts +3 -3
  587. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  588. package/script/types/2_story_interactive_area.js +18 -28
  589. package/script/types/3_chat_member_updated.d.ts +2 -2
  590. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  591. package/script/types/3_chat_member_updated.js +6 -6
  592. package/script/types/3_reply_markup.d.ts +3 -3
  593. package/script/types/3_reply_markup.d.ts.map +1 -1
  594. package/script/types/3_reply_markup.js +11 -21
  595. package/script/types/3_story.d.ts +2 -2
  596. package/script/types/3_story.d.ts.map +1 -1
  597. package/script/types/4_inline_query_result.d.ts +3 -3
  598. package/script/types/4_inline_query_result.d.ts.map +1 -1
  599. package/script/types/4_inline_query_result.js +52 -160
  600. package/script/types/4_message.d.ts +3 -3
  601. package/script/types/4_message.d.ts.map +1 -1
  602. package/script/types/4_message.js +67 -58
  603. package/script/types/5_callback_query.d.ts +3 -3
  604. package/script/types/5_callback_query.d.ts.map +1 -1
  605. package/script/types/5_callback_query.js +4 -4
  606. package/script/types/5_chat_list_item.d.ts +3 -3
  607. package/script/types/5_chat_list_item.d.ts.map +1 -1
  608. package/script/types/5_chat_list_item.js +1 -1
  609. package/script/types/5_inline_query_answer.d.ts +2 -2
  610. package/script/types/5_inline_query_answer.d.ts.map +1 -1
  611. package/script/types/_file_id.d.ts +2 -2
  612. package/script/types/_file_id.d.ts.map +1 -1
  613. package/script/types/_file_id.js +3 -3
  614. package/script/types/_getters.d.ts +7 -7
  615. package/script/types/_getters.d.ts.map +1 -1
  616. package/esm/tl/1_tl_object.d.ts +0 -64
  617. package/esm/tl/1_tl_object.d.ts.map +0 -1
  618. package/esm/tl/1_tl_object.js +0 -221
  619. package/esm/tl/1_tl_object_test.d.ts.map +0 -1
  620. package/esm/tl/2_types.d.ts +0 -28060
  621. package/esm/tl/2_types.d.ts.map +0 -1
  622. package/esm/tl/2_types.js +0 -68685
  623. package/esm/tl/2_types_test.d.ts.map +0 -1
  624. package/esm/tl/3_deserialize.d.ts +0 -23
  625. package/esm/tl/3_deserialize.d.ts.map +0 -1
  626. package/esm/tl/3_functions.d.ts +0 -14094
  627. package/esm/tl/3_functions.d.ts.map +0 -1
  628. package/esm/tl/3_functions.js +0 -28475
  629. package/esm/tl/3_functions_test.d.ts.map +0 -1
  630. package/esm/tl/4_tl_reader.d.ts.map +0 -1
  631. package/esm/tl/5_tl_writer.d.ts.map +0 -1
  632. package/esm/tl/6_rpc_result.d.ts.map +0 -1
  633. package/esm/tl/6_rpc_result.js +0 -49
  634. package/esm/tl/7_message.d.ts.map +0 -1
  635. package/esm/tl/7_message.js +0 -90
  636. package/esm/tl/7_message_test.d.ts.map +0 -1
  637. package/esm/tl/8_message_container.d.ts.map +0 -1
  638. package/esm/tl/8_message_container.js +0 -72
  639. package/script/tl/1_tl_object.d.ts +0 -64
  640. package/script/tl/1_tl_object.d.ts.map +0 -1
  641. package/script/tl/1_tl_object.js +0 -228
  642. package/script/tl/1_tl_object_test.d.ts.map +0 -1
  643. package/script/tl/2_types.d.ts +0 -28060
  644. package/script/tl/2_types.d.ts.map +0 -1
  645. package/script/tl/2_types.js +0 -70558
  646. package/script/tl/2_types_test.d.ts.map +0 -1
  647. package/script/tl/3_deserialize.d.ts +0 -23
  648. package/script/tl/3_deserialize.d.ts.map +0 -1
  649. package/script/tl/3_functions.d.ts +0 -14094
  650. package/script/tl/3_functions.d.ts.map +0 -1
  651. package/script/tl/3_functions.js +0 -29121
  652. package/script/tl/3_functions_test.d.ts.map +0 -1
  653. package/script/tl/4_tl_reader.d.ts.map +0 -1
  654. package/script/tl/5_tl_writer.d.ts.map +0 -1
  655. package/script/tl/6_rpc_result.d.ts +0 -30
  656. package/script/tl/6_rpc_result.d.ts.map +0 -1
  657. package/script/tl/6_rpc_result.js +0 -53
  658. package/script/tl/7_message.d.ts +0 -32
  659. package/script/tl/7_message.d.ts.map +0 -1
  660. package/script/tl/7_message.js +0 -95
  661. package/script/tl/7_message_test.d.ts.map +0 -1
  662. package/script/tl/8_message_container.d.ts +0 -32
  663. package/script/tl/8_message_container.d.ts.map +0 -1
  664. package/script/tl/8_message_container.js +0 -76
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_constants.d.ts","sourceRoot":"","sources":["../../../../../src/deps/deno.land/std@0.224.0/io/_constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,mBAAmB,QAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ export const DEFAULT_CHUNK_SIZE = 16640;
4
+ export const DEFAULT_BUFFER_SIZE = 32 * 1024;
@@ -0,0 +1,70 @@
1
+ import type { Reader, ReaderSync } from "./types.js";
2
+ export type { Reader, ReaderSync };
3
+ /**
4
+ * Turns a {@linkcode Reader} into an async iterator.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { iterateReader } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
9
+ *
10
+ * using file = await Deno.open("/etc/passwd");
11
+ * for await (const chunk of iterateReader(file)) {
12
+ * console.log(chunk);
13
+ * }
14
+ * ```
15
+ *
16
+ * Second argument can be used to tune size of a buffer.
17
+ * Default size of the buffer is 32kB.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { iterateReader } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
22
+ *
23
+ * using file = await Deno.open("/etc/passwd");
24
+ * const iter = iterateReader(file, {
25
+ * bufSize: 1024 * 1024
26
+ * });
27
+ * for await (const chunk of iter) {
28
+ * console.log(chunk);
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function iterateReader(reader: Reader, options?: {
33
+ bufSize?: number;
34
+ }): AsyncIterableIterator<Uint8Array>;
35
+ /**
36
+ * Turns a {@linkcode ReaderSync} into an iterator.
37
+ *
38
+ * ```ts
39
+ * import { iterateReaderSync } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
40
+ *
41
+ * using file = Deno.openSync("/etc/passwd");
42
+ * for (const chunk of iterateReaderSync(file)) {
43
+ * console.log(chunk);
44
+ * }
45
+ * ```
46
+ *
47
+ * Second argument can be used to tune size of a buffer.
48
+ * Default size of the buffer is 32kB.
49
+ *
50
+ * ```ts
51
+ * import { iterateReaderSync } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
52
+
53
+ * using file = await Deno.open("/etc/passwd");
54
+ * const iter = iterateReaderSync(file, {
55
+ * bufSize: 1024 * 1024
56
+ * });
57
+ * for (const chunk of iter) {
58
+ * console.log(chunk);
59
+ * }
60
+ * ```
61
+ *
62
+ * Iterator uses an internal buffer of fixed size for efficiency; it returns
63
+ * a view on that buffer on each iteration. It is therefore caller's
64
+ * responsibility to copy contents of the buffer if needed; otherwise the
65
+ * next iteration will overwrite contents of previously returned chunk.
66
+ */
67
+ export declare function iterateReaderSync(reader: ReaderSync, options?: {
68
+ bufSize?: number;
69
+ }): IterableIterator<Uint8Array>;
70
+ //# sourceMappingURL=iterate_reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterate_reader.d.ts","sourceRoot":"","sources":["../../../../../src/deps/deno.land/std@0.224.0/io/iterate_reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAuB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,qBAAqB,CAAC,UAAU,CAAC,CAWnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAiB,iBAAiB,CAChC,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,gBAAgB,CAAC,UAAU,CAAC,CAW9B"}
@@ -0,0 +1,86 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { DEFAULT_BUFFER_SIZE } from "./_constants.js";
4
+ /**
5
+ * Turns a {@linkcode Reader} into an async iterator.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { iterateReader } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
10
+ *
11
+ * using file = await Deno.open("/etc/passwd");
12
+ * for await (const chunk of iterateReader(file)) {
13
+ * console.log(chunk);
14
+ * }
15
+ * ```
16
+ *
17
+ * Second argument can be used to tune size of a buffer.
18
+ * Default size of the buffer is 32kB.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { iterateReader } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
23
+ *
24
+ * using file = await Deno.open("/etc/passwd");
25
+ * const iter = iterateReader(file, {
26
+ * bufSize: 1024 * 1024
27
+ * });
28
+ * for await (const chunk of iter) {
29
+ * console.log(chunk);
30
+ * }
31
+ * ```
32
+ */
33
+ export async function* iterateReader(reader, options) {
34
+ const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
35
+ const b = new Uint8Array(bufSize);
36
+ while (true) {
37
+ const result = await reader.read(b);
38
+ if (result === null) {
39
+ break;
40
+ }
41
+ yield b.slice(0, result);
42
+ }
43
+ }
44
+ /**
45
+ * Turns a {@linkcode ReaderSync} into an iterator.
46
+ *
47
+ * ```ts
48
+ * import { iterateReaderSync } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
49
+ *
50
+ * using file = Deno.openSync("/etc/passwd");
51
+ * for (const chunk of iterateReaderSync(file)) {
52
+ * console.log(chunk);
53
+ * }
54
+ * ```
55
+ *
56
+ * Second argument can be used to tune size of a buffer.
57
+ * Default size of the buffer is 32kB.
58
+ *
59
+ * ```ts
60
+ * import { iterateReaderSync } from "https://deno.land/std@$STD_VERSION/io/iterate_reader.ts";
61
+
62
+ * using file = await Deno.open("/etc/passwd");
63
+ * const iter = iterateReaderSync(file, {
64
+ * bufSize: 1024 * 1024
65
+ * });
66
+ * for (const chunk of iter) {
67
+ * console.log(chunk);
68
+ * }
69
+ * ```
70
+ *
71
+ * Iterator uses an internal buffer of fixed size for efficiency; it returns
72
+ * a view on that buffer on each iteration. It is therefore caller's
73
+ * responsibility to copy contents of the buffer if needed; otherwise the
74
+ * next iteration will overwrite contents of previously returned chunk.
75
+ */
76
+ export function* iterateReaderSync(reader, options) {
77
+ const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
78
+ const b = new Uint8Array(bufSize);
79
+ while (true) {
80
+ const result = reader.readSync(b);
81
+ if (result === null) {
82
+ break;
83
+ }
84
+ yield b.slice(0, result);
85
+ }
86
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * An abstract interface which when implemented provides an interface to read bytes into an array buffer asynchronously.
3
+ */
4
+ export interface Reader {
5
+ /** Reads up to `p.byteLength` bytes into `p`. It resolves to the number of
6
+ * bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
7
+ * encountered. Even if `read()` resolves to `n` < `p.byteLength`, it may
8
+ * use all of `p` as scratch space during the call. If some data is
9
+ * available but not `p.byteLength` bytes, `read()` conventionally resolves
10
+ * to what is available instead of waiting for more.
11
+ *
12
+ * When `read()` encounters end-of-file condition, it resolves to EOF
13
+ * (`null`).
14
+ *
15
+ * When `read()` encounters an error, it rejects with an error.
16
+ *
17
+ * Callers should always process the `n` > `0` bytes returned before
18
+ * considering the EOF (`null`). Doing so correctly handles I/O errors that
19
+ * happen after reading some bytes and also both of the allowed EOF
20
+ * behaviors.
21
+ *
22
+ * Implementations should not retain a reference to `p`.
23
+ *
24
+ * Use
25
+ * {@linkcode https://deno.land/std@$STD_VERSION/io/to_iterator.ts?s=toIterator}
26
+ * to turn a {@linkcode Reader} into an {@linkcode AsyncIterableIterator}.
27
+ */
28
+ read(p: Uint8Array): Promise<number | null>;
29
+ }
30
+ /**
31
+ * An abstract interface which when implemented provides an interface to read bytes into an array buffer synchronously.
32
+ */
33
+ export interface ReaderSync {
34
+ /** Reads up to `p.byteLength` bytes into `p`. It resolves to the number
35
+ * of bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
36
+ * encountered. Even if `read()` returns `n` < `p.byteLength`, it may use
37
+ * all of `p` as scratch space during the call. If some data is available
38
+ * but not `p.byteLength` bytes, `read()` conventionally returns what is
39
+ * available instead of waiting for more.
40
+ *
41
+ * When `readSync()` encounters end-of-file condition, it returns EOF
42
+ * (`null`).
43
+ *
44
+ * When `readSync()` encounters an error, it throws with an error.
45
+ *
46
+ * Callers should always process the `n` > `0` bytes returned before
47
+ * considering the EOF (`null`). Doing so correctly handles I/O errors that happen
48
+ * after reading some bytes and also both of the allowed EOF behaviors.
49
+ *
50
+ * Implementations should not retain a reference to `p`.
51
+ *
52
+ * Use
53
+ * {@linkcode https://deno.land/std@$STD_VERSION/io/to_iterator.ts?s=toIteratorSync}
54
+ * to turn a {@linkcode ReaderSync} into an {@linkcode IterableIterator}.
55
+ */
56
+ readSync(p: Uint8Array): number | null;
57
+ }
58
+ /**
59
+ * An abstract interface which when implemented provides an interface to write bytes from an array buffer to a file/resource asynchronously.
60
+ */
61
+ export interface Writer {
62
+ /** Writes `p.byteLength` bytes from `p` to the underlying data stream. It
63
+ * resolves to the number of bytes written from `p` (`0` <= `n` <=
64
+ * `p.byteLength`) or reject with the error encountered that caused the
65
+ * write to stop early. `write()` must reject with a non-null error if
66
+ * would resolve to `n` < `p.byteLength`. `write()` must not modify the
67
+ * slice data, even temporarily.
68
+ *
69
+ * Implementations should not retain a reference to `p`.
70
+ */
71
+ write(p: Uint8Array): Promise<number>;
72
+ }
73
+ /**
74
+ * An abstract interface which when implemented provides an interface to write bytes from an array buffer to a file/resource synchronously.
75
+ */
76
+ export interface WriterSync {
77
+ /** Writes `p.byteLength` bytes from `p` to the underlying data
78
+ * stream. It returns the number of bytes written from `p` (`0` <= `n`
79
+ * <= `p.byteLength`) and any error encountered that caused the write to
80
+ * stop early. `writeSync()` must throw a non-null error if it returns `n` <
81
+ * `p.byteLength`. `writeSync()` must not modify the slice data, even
82
+ * temporarily.
83
+ *
84
+ * Implementations should not retain a reference to `p`.
85
+ */
86
+ writeSync(p: Uint8Array): number;
87
+ }
88
+ /**
89
+ * An abstract interface which when implemented provides an interface to close files/resources that were previously opened.
90
+ */
91
+ export interface Closer {
92
+ /** Closes the resource, "freeing" the backing file/resource. */
93
+ close(): void;
94
+ }
95
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/deps/deno.land/std@0.224.0/io/types.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;OAQG;IACH,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvC;AACD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,SAAS,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,gEAAgE;IAChE,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -0,0 +1,3 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { Writer, WriterSync } from "./types.js";
2
+ /**
3
+ * Write all the content of the array buffer (`arr`) to the writer (`w`).
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { writeAll } from "https://deno.land/std@$STD_VERSION/io/write_all.ts";
8
+
9
+ * // Example writing to stdout
10
+ * let contentBytes = new TextEncoder().encode("Hello World");
11
+ * await writeAll(Deno.stdout, contentBytes);
12
+ *
13
+ * // Example writing to file
14
+ * contentBytes = new TextEncoder().encode("Hello World");
15
+ * using file = await Deno.open('test.file', {write: true});
16
+ * await writeAll(file, contentBytes);
17
+ * ```
18
+ */
19
+ export declare function writeAll(writer: Writer, data: Uint8Array): Promise<void>;
20
+ /**
21
+ * Synchronously write all the content of the array buffer (`arr`) to the
22
+ * writer (`w`).
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { writeAllSync } from "https://deno.land/std@$STD_VERSION/io/write_all.ts";
27
+ *
28
+ * // Example writing to stdout
29
+ * let contentBytes = new TextEncoder().encode("Hello World");
30
+ * writeAllSync(Deno.stdout, contentBytes);
31
+ *
32
+ * // Example writing to file
33
+ * contentBytes = new TextEncoder().encode("Hello World");
34
+ * using file = Deno.openSync('test.file', {write: true});
35
+ * writeAllSync(file, contentBytes);
36
+ * ```
37
+ */
38
+ export declare function writeAllSync(writer: WriterSync, data: Uint8Array): void;
39
+ //# sourceMappingURL=write_all.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write_all.d.ts","sourceRoot":"","sources":["../../../../../src/deps/deno.land/std@0.224.0/io/write_all.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,iBAK9D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,QAKhE"}
@@ -0,0 +1,49 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ /**
4
+ * Write all the content of the array buffer (`arr`) to the writer (`w`).
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { writeAll } from "https://deno.land/std@$STD_VERSION/io/write_all.ts";
9
+
10
+ * // Example writing to stdout
11
+ * let contentBytes = new TextEncoder().encode("Hello World");
12
+ * await writeAll(Deno.stdout, contentBytes);
13
+ *
14
+ * // Example writing to file
15
+ * contentBytes = new TextEncoder().encode("Hello World");
16
+ * using file = await Deno.open('test.file', {write: true});
17
+ * await writeAll(file, contentBytes);
18
+ * ```
19
+ */
20
+ export async function writeAll(writer, data) {
21
+ let nwritten = 0;
22
+ while (nwritten < data.length) {
23
+ nwritten += await writer.write(data.subarray(nwritten));
24
+ }
25
+ }
26
+ /**
27
+ * Synchronously write all the content of the array buffer (`arr`) to the
28
+ * writer (`w`).
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { writeAllSync } from "https://deno.land/std@$STD_VERSION/io/write_all.ts";
33
+ *
34
+ * // Example writing to stdout
35
+ * let contentBytes = new TextEncoder().encode("Hello World");
36
+ * writeAllSync(Deno.stdout, contentBytes);
37
+ *
38
+ * // Example writing to file
39
+ * contentBytes = new TextEncoder().encode("Hello World");
40
+ * using file = Deno.openSync('test.file', {write: true});
41
+ * writeAllSync(file, contentBytes);
42
+ * ```
43
+ */
44
+ export function writeAllSync(writer, data) {
45
+ let nwritten = 0;
46
+ while (nwritten < data.length) {
47
+ nwritten += writer.writeSync(data.subarray(nwritten));
48
+ }
49
+ }
@@ -0,0 +1,45 @@
1
+ import * as dntShim from "../../../../../_dnt.shims.js";
2
+ export declare const SOCKS_VERSION = 5;
3
+ export declare const USERNAME_PASSWORD_AUTH_VERSION = 1;
4
+ export declare enum AddrType {
5
+ IPv4 = 1,
6
+ DomainName = 3,
7
+ IPv6 = 4
8
+ }
9
+ export declare enum AuthMethod {
10
+ NoAuth = 0,
11
+ UsernamePassword = 2,
12
+ NoneAcceptable = 255
13
+ }
14
+ export declare enum ReplyStatus {
15
+ Success = 0,
16
+ GeneralError = 1,
17
+ RulesetError = 2,
18
+ NetworkUnreachable = 3,
19
+ HostUnreachable = 4,
20
+ ConnectionRefused = 5,
21
+ TTLExpired = 6,
22
+ UnsupportedCommand = 7,
23
+ UnsupportedAddress = 8
24
+ }
25
+ export declare enum Command {
26
+ Connect = 1,
27
+ Bind = 2,
28
+ UdpAssociate = 3
29
+ }
30
+ interface AddrConfig {
31
+ hostname: string;
32
+ port?: number;
33
+ }
34
+ interface AuthConfig {
35
+ username: string;
36
+ password: string;
37
+ }
38
+ export type ClientConfig = AddrConfig | (AddrConfig & AuthConfig);
39
+ export declare class Client {
40
+ #private;
41
+ constructor(config: ClientConfig);
42
+ connect(opts: dntShim.Deno.ConnectOptions): Promise<dntShim.Deno.TcpConn>;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AAIxD,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,UAAU,IAAI;IACd,IAAI,IAAI;CACT;AACD,oBAAY,UAAU;IACpB,MAAM,IAAI;IACV,gBAAgB,IAAI;IACpB,cAAc,MAAO;CACtB;AACD,oBAAY,WAAW;IACrB,OAAO,IAAI;IACX,YAAY,IAAA;IACZ,YAAY,IAAA;IACZ,kBAAkB,IAAA;IAClB,eAAe,IAAA;IACf,iBAAiB,IAAA;IACjB,UAAU,IAAA;IACV,kBAAkB,IAAA;IAClB,kBAAkB,IAAA;CACnB;AACD,oBAAY,OAAO;IACjB,OAAO,IAAI;IACX,IAAI,IAAA;IACJ,YAAY,IAAA;CACb;AAuFD,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;AAElE,qBAAa,MAAM;;gBAGL,MAAM,EAAE,YAAY;IAwG1B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;CA8ChF"}
@@ -0,0 +1,253 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _Client_config, _Client_connectAndRequest;
13
+ import * as dntShim from "../../../../../_dnt.shims.js";
14
+ import { writeAll } from "./deps.js";
15
+ import { readN } from "./utils.js";
16
+ export const SOCKS_VERSION = 5;
17
+ export const USERNAME_PASSWORD_AUTH_VERSION = 1;
18
+ export var AddrType;
19
+ (function (AddrType) {
20
+ AddrType[AddrType["IPv4"] = 1] = "IPv4";
21
+ AddrType[AddrType["DomainName"] = 3] = "DomainName";
22
+ AddrType[AddrType["IPv6"] = 4] = "IPv6";
23
+ })(AddrType || (AddrType = {}));
24
+ export var AuthMethod;
25
+ (function (AuthMethod) {
26
+ AuthMethod[AuthMethod["NoAuth"] = 0] = "NoAuth";
27
+ AuthMethod[AuthMethod["UsernamePassword"] = 2] = "UsernamePassword";
28
+ AuthMethod[AuthMethod["NoneAcceptable"] = 255] = "NoneAcceptable";
29
+ })(AuthMethod || (AuthMethod = {}));
30
+ export var ReplyStatus;
31
+ (function (ReplyStatus) {
32
+ ReplyStatus[ReplyStatus["Success"] = 0] = "Success";
33
+ ReplyStatus[ReplyStatus["GeneralError"] = 1] = "GeneralError";
34
+ ReplyStatus[ReplyStatus["RulesetError"] = 2] = "RulesetError";
35
+ ReplyStatus[ReplyStatus["NetworkUnreachable"] = 3] = "NetworkUnreachable";
36
+ ReplyStatus[ReplyStatus["HostUnreachable"] = 4] = "HostUnreachable";
37
+ ReplyStatus[ReplyStatus["ConnectionRefused"] = 5] = "ConnectionRefused";
38
+ ReplyStatus[ReplyStatus["TTLExpired"] = 6] = "TTLExpired";
39
+ ReplyStatus[ReplyStatus["UnsupportedCommand"] = 7] = "UnsupportedCommand";
40
+ ReplyStatus[ReplyStatus["UnsupportedAddress"] = 8] = "UnsupportedAddress";
41
+ })(ReplyStatus || (ReplyStatus = {}));
42
+ export var Command;
43
+ (function (Command) {
44
+ Command[Command["Connect"] = 1] = "Connect";
45
+ Command[Command["Bind"] = 2] = "Bind";
46
+ Command[Command["UdpAssociate"] = 3] = "UdpAssociate";
47
+ })(Command || (Command = {}));
48
+ function decodeError(status) {
49
+ switch (status) {
50
+ case ReplyStatus.GeneralError:
51
+ return "general SOCKS server failure";
52
+ case ReplyStatus.RulesetError:
53
+ return "connection not allowed by ruleset";
54
+ case ReplyStatus.NetworkUnreachable:
55
+ return "Network unreachable";
56
+ case ReplyStatus.HostUnreachable:
57
+ return "Host unreachable";
58
+ case ReplyStatus.ConnectionRefused:
59
+ return "Connection refused";
60
+ case ReplyStatus.TTLExpired:
61
+ return "TTL expired";
62
+ case ReplyStatus.UnsupportedCommand:
63
+ return "Command not supported";
64
+ case ReplyStatus.UnsupportedAddress:
65
+ return "Address type not supported";
66
+ default:
67
+ return "unknown SOCKS error";
68
+ }
69
+ }
70
+ const v4Pattern = /^(?:\d{1,3}\.){3}\d{1,3}/;
71
+ const v6Pattern = /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/i;
72
+ function serializeAddress(hostname, port) {
73
+ const portBytes = [port >> 8, port % 256];
74
+ if (v4Pattern.test(hostname)) {
75
+ return Uint8Array.from([
76
+ AddrType.IPv4,
77
+ ...hostname.split(".").map(Number),
78
+ ...portBytes,
79
+ ]);
80
+ }
81
+ if (v6Pattern.test(hostname)) {
82
+ return Uint8Array.from([
83
+ AddrType.IPv6,
84
+ ...hostname.split(":").flatMap((x) => {
85
+ const num = parseInt(x, 16);
86
+ return [num >> 8, num % 256];
87
+ }),
88
+ ...portBytes,
89
+ ]);
90
+ }
91
+ const bytes = new TextEncoder().encode(hostname);
92
+ return Uint8Array.from([
93
+ AddrType.DomainName,
94
+ bytes.length,
95
+ ...bytes,
96
+ ...portBytes,
97
+ ]);
98
+ }
99
+ async function deserializeAddress(r) {
100
+ const [type] = await readN(r, 1);
101
+ const hostname = await (async () => {
102
+ if (type === AddrType.IPv4) {
103
+ const parts = [...(await readN(r, 4))];
104
+ return { value: parts.map(String).join("."), length: 4 };
105
+ }
106
+ if (type === AddrType.IPv6) {
107
+ const parts = [];
108
+ const buff = await readN(r, 16);
109
+ for (let i = 0; i < buff.length; i += 2) {
110
+ parts.push((buff[i] << 8) + buff[i + 1]);
111
+ }
112
+ return { value: parts.map(String).join(":"), length: 16 };
113
+ }
114
+ if (type === AddrType.DomainName) {
115
+ const [length] = await readN(r, 1);
116
+ return {
117
+ value: new TextDecoder().decode(await readN(r, length)),
118
+ length: length + 1,
119
+ };
120
+ }
121
+ throw new Error(`unexpected address type: ${type}`);
122
+ })();
123
+ const [portUpper, portLower] = await readN(r, 2);
124
+ const port = (portUpper << 8) + portLower;
125
+ return { hostname: hostname.value, port, bytesRead: hostname.length + 3 };
126
+ }
127
+ export class Client {
128
+ constructor(config) {
129
+ _Client_config.set(this, void 0);
130
+ _Client_connectAndRequest.set(this, async (cmd, hostname, port) => {
131
+ // @ts-ignore: lib
132
+ const conn = await dntShim.Deno.connect({
133
+ hostname: __classPrivateFieldGet(this, _Client_config, "f").hostname,
134
+ port: __classPrivateFieldGet(this, _Client_config, "f").port,
135
+ });
136
+ // handle auth negotiation
137
+ const methods = [AuthMethod.NoAuth];
138
+ if ("username" in __classPrivateFieldGet(this, _Client_config, "f")) {
139
+ methods.push(AuthMethod.UsernamePassword);
140
+ }
141
+ await writeAll(conn, Uint8Array.from([SOCKS_VERSION, methods.length, ...methods]));
142
+ const [negotiationVersion, method] = await readN(conn, 2);
143
+ if (negotiationVersion !== SOCKS_VERSION ||
144
+ method === AuthMethod.NoneAcceptable) {
145
+ try {
146
+ conn.close();
147
+ }
148
+ catch {
149
+ // ignore
150
+ }
151
+ throw new Error(negotiationVersion !== SOCKS_VERSION
152
+ ? `unsupported SOCKS version number: ${negotiationVersion}`
153
+ : "no acceptable authentication methods");
154
+ }
155
+ if (method === AuthMethod.UsernamePassword) {
156
+ const cfg = __classPrivateFieldGet(this, _Client_config, "f");
157
+ const te = new TextEncoder();
158
+ const username = te.encode(cfg.username);
159
+ const password = te.encode(cfg.password);
160
+ await writeAll(conn, Uint8Array.from([
161
+ USERNAME_PASSWORD_AUTH_VERSION,
162
+ username.length,
163
+ ...username,
164
+ password.length,
165
+ ...password,
166
+ ]));
167
+ const [authVersion, status] = await readN(conn, 2);
168
+ if (authVersion !== USERNAME_PASSWORD_AUTH_VERSION ||
169
+ status !== ReplyStatus.Success) {
170
+ try {
171
+ conn.close();
172
+ }
173
+ catch {
174
+ // ignore
175
+ }
176
+ throw new Error(authVersion !== USERNAME_PASSWORD_AUTH_VERSION
177
+ ? `unsupported authentication version number: ${authVersion}`
178
+ : "authentication failed");
179
+ }
180
+ }
181
+ // handle actual message
182
+ await writeAll(conn, Uint8Array.from([
183
+ SOCKS_VERSION,
184
+ cmd,
185
+ 0,
186
+ ...serializeAddress(hostname, port),
187
+ ]));
188
+ const [replyVersion, status, _] = await readN(conn, 3);
189
+ if (replyVersion !== SOCKS_VERSION || status !== ReplyStatus.Success) {
190
+ try {
191
+ conn.close();
192
+ }
193
+ catch {
194
+ // ignore
195
+ }
196
+ throw new Error(replyVersion !== SOCKS_VERSION
197
+ ? `unsupported SOCKS version number: ${replyVersion}`
198
+ : decodeError(status));
199
+ }
200
+ return {
201
+ conn,
202
+ ...(await deserializeAddress(conn)),
203
+ };
204
+ });
205
+ __classPrivateFieldSet(this, _Client_config, {
206
+ ...config,
207
+ port: config.port ?? 1080,
208
+ }, "f");
209
+ }
210
+ // @ts-ignore: lib
211
+ async connect(opts) {
212
+ const remoteAddr = {
213
+ hostname: opts.hostname ?? "127.0.0.1",
214
+ port: opts.port,
215
+ transport: "tcp",
216
+ };
217
+ const { conn, hostname, port } = await __classPrivateFieldGet(this, _Client_connectAndRequest, "f").call(this, Command.Connect, remoteAddr.hostname, remoteAddr.port);
218
+ const localAddr = {
219
+ hostname,
220
+ port,
221
+ transport: "tcp",
222
+ };
223
+ return {
224
+ setKeepAlive(keepalive) {
225
+ conn.setKeepAlive(keepalive);
226
+ },
227
+ setNoDelay(nodelay) {
228
+ conn.setNoDelay(nodelay);
229
+ },
230
+ get localAddr() {
231
+ return localAddr;
232
+ },
233
+ get remoteAddr() {
234
+ return remoteAddr;
235
+ },
236
+ get rid() {
237
+ return conn.rid;
238
+ },
239
+ get readable() {
240
+ return conn.readable;
241
+ },
242
+ get writable() {
243
+ return conn.writable;
244
+ },
245
+ read: conn.read.bind(conn),
246
+ write: conn.write.bind(conn),
247
+ close: conn.close.bind(conn),
248
+ closeWrite: conn.closeWrite.bind(conn),
249
+ // @ts-ignore: lib
250
+ };
251
+ }
252
+ }
253
+ _Client_config = new WeakMap(), _Client_connectAndRequest = new WeakMap();
@@ -0,0 +1,3 @@
1
+ export { writeAll } from "../../../../deno.land/std@0.224.0/io/write_all.js";
2
+ export { type Reader } from "../../../../deno.land/std@0.224.0/io/types.js";
3
+ //# sourceMappingURL=deps.d.ts.map