tunli 0.0.27 → 0.2.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 (388) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +158 -67
  3. package/bin/tunli +4 -5
  4. package/dist/api-client/ApiClient.d.ts +18 -0
  5. package/dist/api-client/ApiClient.d.ts.map +1 -0
  6. package/dist/api-client/ApiClient.js +100 -0
  7. package/dist/api-client/ApiClient.js.map +1 -0
  8. package/dist/api-client/types.d.ts +26 -0
  9. package/dist/api-client/types.d.ts.map +1 -0
  10. package/dist/api-client/types.js +2 -0
  11. package/dist/api-client/types.js.map +1 -0
  12. package/dist/api-client/utils.d.ts +4 -0
  13. package/dist/api-client/utils.d.ts.map +1 -0
  14. package/dist/api-client/utils.js +13 -0
  15. package/dist/api-client/utils.js.map +1 -0
  16. package/dist/cli-app/AppEventEmitter.d.ts +57 -0
  17. package/dist/cli-app/AppEventEmitter.d.ts.map +1 -0
  18. package/dist/cli-app/AppEventEmitter.js +11 -0
  19. package/dist/cli-app/AppEventEmitter.js.map +1 -0
  20. package/dist/cli-app/Dashboard.d.ts +4 -0
  21. package/dist/cli-app/Dashboard.d.ts.map +1 -0
  22. package/dist/cli-app/Dashboard.js +241 -0
  23. package/dist/cli-app/Dashboard.js.map +1 -0
  24. package/dist/cli-app/LiveLog.d.ts +4 -0
  25. package/dist/cli-app/LiveLog.d.ts.map +1 -0
  26. package/dist/cli-app/LiveLog.js +28 -0
  27. package/dist/cli-app/LiveLog.js.map +1 -0
  28. package/dist/cli-app/types.d.ts +10 -0
  29. package/dist/cli-app/types.d.ts.map +1 -0
  30. package/dist/cli-app/types.js +2 -0
  31. package/dist/cli-app/types.js.map +1 -0
  32. package/dist/cli-app/versionCheck.d.ts +4 -0
  33. package/dist/cli-app/versionCheck.d.ts.map +1 -0
  34. package/dist/cli-app/versionCheck.js +46 -0
  35. package/dist/cli-app/versionCheck.js.map +1 -0
  36. package/dist/client.d.ts +2 -0
  37. package/dist/client.d.ts.map +1 -0
  38. package/dist/client.js +75 -0
  39. package/dist/client.js.map +1 -0
  40. package/dist/commander/Argument.d.ts +19 -0
  41. package/dist/commander/Argument.d.ts.map +1 -0
  42. package/dist/commander/Argument.js +25 -0
  43. package/dist/commander/Argument.js.map +1 -0
  44. package/dist/commander/Command.d.ts +23 -0
  45. package/dist/commander/Command.d.ts.map +1 -0
  46. package/dist/commander/Command.js +159 -0
  47. package/dist/commander/Command.js.map +1 -0
  48. package/dist/commander/InvalidArgumentError.d.ts +5 -0
  49. package/dist/commander/InvalidArgumentError.d.ts.map +1 -0
  50. package/dist/commander/InvalidArgumentError.js +8 -0
  51. package/dist/commander/InvalidArgumentError.js.map +1 -0
  52. package/dist/commander/Option.d.ts +15 -0
  53. package/dist/commander/Option.d.ts.map +1 -0
  54. package/dist/commander/Option.js +43 -0
  55. package/dist/commander/Option.js.map +1 -0
  56. package/dist/commander/index.d.ts +7 -0
  57. package/dist/commander/index.d.ts.map +1 -0
  58. package/dist/commander/index.js +5 -0
  59. package/dist/commander/index.js.map +1 -0
  60. package/dist/commander/types.d.ts +2 -0
  61. package/dist/commander/types.d.ts.map +1 -0
  62. package/dist/commander/types.js +2 -0
  63. package/dist/commander/types.js.map +1 -0
  64. package/dist/commands/CommandAuth/CommandAuth.d.ts +4 -0
  65. package/dist/commands/CommandAuth/CommandAuth.d.ts.map +1 -0
  66. package/dist/commands/CommandAuth/CommandAuth.js +24 -0
  67. package/dist/commands/CommandAuth/CommandAuth.js.map +1 -0
  68. package/dist/commands/CommandConfig/CommandConfig.d.ts +4 -0
  69. package/dist/commands/CommandConfig/CommandConfig.d.ts.map +1 -0
  70. package/dist/commands/CommandConfig/CommandConfig.js +37 -0
  71. package/dist/commands/CommandConfig/CommandConfig.js.map +1 -0
  72. package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.d.ts +4 -0
  73. package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.d.ts.map +1 -0
  74. package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.js +20 -0
  75. package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.js.map +1 -0
  76. package/dist/commands/CommandConfig/sub-commands/configGetCommand.d.ts +5 -0
  77. package/dist/commands/CommandConfig/sub-commands/configGetCommand.d.ts.map +1 -0
  78. package/dist/commands/CommandConfig/sub-commands/configGetCommand.js +23 -0
  79. package/dist/commands/CommandConfig/sub-commands/configGetCommand.js.map +1 -0
  80. package/dist/commands/CommandConfig/sub-commands/configSetCommand.d.ts +4 -0
  81. package/dist/commands/CommandConfig/sub-commands/configSetCommand.d.ts.map +1 -0
  82. package/dist/commands/CommandConfig/sub-commands/configSetCommand.js +69 -0
  83. package/dist/commands/CommandConfig/sub-commands/configSetCommand.js.map +1 -0
  84. package/dist/commands/CommandConfig/types.d.ts +6 -0
  85. package/dist/commands/CommandConfig/types.d.ts.map +1 -0
  86. package/dist/commands/CommandConfig/types.js +2 -0
  87. package/dist/commands/CommandConfig/types.js.map +1 -0
  88. package/dist/commands/CommandConfig/utils/preparePrimaryOptions.d.ts +3 -0
  89. package/dist/commands/CommandConfig/utils/preparePrimaryOptions.d.ts.map +1 -0
  90. package/dist/commands/CommandConfig/utils/preparePrimaryOptions.js +8 -0
  91. package/dist/commands/CommandConfig/utils/preparePrimaryOptions.js.map +1 -0
  92. package/dist/commands/CommandConfig/utils/resolveConfig.d.ts +8 -0
  93. package/dist/commands/CommandConfig/utils/resolveConfig.d.ts.map +1 -0
  94. package/dist/commands/CommandConfig/utils/resolveConfig.js +33 -0
  95. package/dist/commands/CommandConfig/utils/resolveConfig.js.map +1 -0
  96. package/dist/commands/CommandConfig/utils/sharedOptions.d.ts +3 -0
  97. package/dist/commands/CommandConfig/utils/sharedOptions.d.ts.map +1 -0
  98. package/dist/commands/CommandConfig/utils/sharedOptions.js +14 -0
  99. package/dist/commands/CommandConfig/utils/sharedOptions.js.map +1 -0
  100. package/dist/commands/CommandDaemon/CommandDaemon.d.ts +4 -0
  101. package/dist/commands/CommandDaemon/CommandDaemon.d.ts.map +1 -0
  102. package/dist/commands/CommandDaemon/CommandDaemon.js +57 -0
  103. package/dist/commands/CommandDaemon/CommandDaemon.js.map +1 -0
  104. package/dist/commands/CommandDashboard/CommandDashboard.d.ts +4 -0
  105. package/dist/commands/CommandDashboard/CommandDashboard.d.ts.map +1 -0
  106. package/dist/commands/CommandDashboard/CommandDashboard.js +54 -0
  107. package/dist/commands/CommandDashboard/CommandDashboard.js.map +1 -0
  108. package/dist/commands/CommandHTTP/CommandHttp.d.ts +4 -0
  109. package/dist/commands/CommandHTTP/CommandHttp.d.ts.map +1 -0
  110. package/dist/commands/CommandHTTP/CommandHttp.js +50 -0
  111. package/dist/commands/CommandHTTP/CommandHttp.js.map +1 -0
  112. package/dist/commands/CommandInit/CommandInit.d.ts +4 -0
  113. package/dist/commands/CommandInit/CommandInit.d.ts.map +1 -0
  114. package/dist/commands/CommandInit/CommandInit.js +36 -0
  115. package/dist/commands/CommandInit/CommandInit.js.map +1 -0
  116. package/dist/commands/CommandList/CommandList.d.ts +4 -0
  117. package/dist/commands/CommandList/CommandList.d.ts.map +1 -0
  118. package/dist/commands/CommandList/CommandList.js +54 -0
  119. package/dist/commands/CommandList/CommandList.js.map +1 -0
  120. package/dist/commands/CommandLogs/CommandLogs.d.ts +4 -0
  121. package/dist/commands/CommandLogs/CommandLogs.d.ts.map +1 -0
  122. package/dist/commands/CommandLogs/CommandLogs.js +33 -0
  123. package/dist/commands/CommandLogs/CommandLogs.js.map +1 -0
  124. package/dist/commands/CommandProfile/CommandProfile.d.ts +5 -0
  125. package/dist/commands/CommandProfile/CommandProfile.d.ts.map +1 -0
  126. package/dist/commands/CommandProfile/CommandProfile.js +64 -0
  127. package/dist/commands/CommandProfile/CommandProfile.js.map +1 -0
  128. package/dist/commands/CommandRegister/CommandRegister.d.ts +4 -0
  129. package/dist/commands/CommandRegister/CommandRegister.d.ts.map +1 -0
  130. package/dist/commands/CommandRegister/CommandRegister.js +43 -0
  131. package/dist/commands/CommandRegister/CommandRegister.js.map +1 -0
  132. package/dist/commands/CommandRestart/CommandRestart.d.ts +4 -0
  133. package/dist/commands/CommandRestart/CommandRestart.d.ts.map +1 -0
  134. package/dist/commands/CommandRestart/CommandRestart.js +62 -0
  135. package/dist/commands/CommandRestart/CommandRestart.js.map +1 -0
  136. package/dist/commands/CommandServer/CommandServer.d.ts +4 -0
  137. package/dist/commands/CommandServer/CommandServer.d.ts.map +1 -0
  138. package/dist/commands/CommandServer/CommandServer.js +24 -0
  139. package/dist/commands/CommandServer/CommandServer.js.map +1 -0
  140. package/dist/commands/CommandStop/CommandStop.d.ts +4 -0
  141. package/dist/commands/CommandStop/CommandStop.d.ts.map +1 -0
  142. package/dist/commands/CommandStop/CommandStop.js +25 -0
  143. package/dist/commands/CommandStop/CommandStop.js.map +1 -0
  144. package/dist/commands/CommandUpdate/CommandUpdate.d.ts +4 -0
  145. package/dist/commands/CommandUpdate/CommandUpdate.d.ts.map +1 -0
  146. package/dist/commands/CommandUpdate/CommandUpdate.js +38 -0
  147. package/dist/commands/CommandUpdate/CommandUpdate.js.map +1 -0
  148. package/dist/commands/CommandUseProfile/CommandUseProfile.d.ts +4 -0
  149. package/dist/commands/CommandUseProfile/CommandUseProfile.d.ts.map +1 -0
  150. package/dist/commands/CommandUseProfile/CommandUseProfile.js +63 -0
  151. package/dist/commands/CommandUseProfile/CommandUseProfile.js.map +1 -0
  152. package/dist/commands/helper/Help.d.ts +4 -0
  153. package/dist/commands/helper/Help.d.ts.map +1 -0
  154. package/dist/commands/helper/Help.js +134 -0
  155. package/dist/commands/helper/Help.js.map +1 -0
  156. package/dist/commands/helper/Parser.d.ts +55 -0
  157. package/dist/commands/helper/Parser.d.ts.map +1 -0
  158. package/dist/commands/helper/Parser.js +280 -0
  159. package/dist/commands/helper/Parser.js.map +1 -0
  160. package/dist/commands/shared/allowDenyCidrCommand.d.ts +3 -0
  161. package/dist/commands/shared/allowDenyCidrCommand.d.ts.map +1 -0
  162. package/dist/commands/shared/allowDenyCidrCommand.js +10 -0
  163. package/dist/commands/shared/allowDenyCidrCommand.js.map +1 -0
  164. package/dist/commands/shared/configServersCommand.d.ts +4 -0
  165. package/dist/commands/shared/configServersCommand.d.ts.map +1 -0
  166. package/dist/commands/shared/configServersCommand.js +19 -0
  167. package/dist/commands/shared/configServersCommand.js.map +1 -0
  168. package/dist/commands/utils.d.ts +3 -0
  169. package/dist/commands/utils.d.ts.map +1 -0
  170. package/dist/commands/utils.js +17 -0
  171. package/dist/commands/utils.js.map +1 -0
  172. package/dist/config/ParsedConfig.d.ts +31 -0
  173. package/dist/config/ParsedConfig.d.ts.map +1 -0
  174. package/dist/config/ParsedConfig.js +116 -0
  175. package/dist/config/ParsedConfig.js.map +1 -0
  176. package/dist/config/ParsedGlobalConfig.d.ts +5 -0
  177. package/dist/config/ParsedGlobalConfig.d.ts.map +1 -0
  178. package/dist/config/ParsedGlobalConfig.js +7 -0
  179. package/dist/config/ParsedGlobalConfig.js.map +1 -0
  180. package/dist/config/ParsedLocalConfig.d.ts +5 -0
  181. package/dist/config/ParsedLocalConfig.d.ts.map +1 -0
  182. package/dist/config/ParsedLocalConfig.js +7 -0
  183. package/dist/config/ParsedLocalConfig.js.map +1 -0
  184. package/dist/config/ParsedProfileConfig.d.ts +46 -0
  185. package/dist/config/ParsedProfileConfig.d.ts.map +1 -0
  186. package/dist/config/ParsedProfileConfig.js +120 -0
  187. package/dist/config/ParsedProfileConfig.js.map +1 -0
  188. package/dist/config/ParsedServerConfig.d.ts +20 -0
  189. package/dist/config/ParsedServerConfig.d.ts.map +1 -0
  190. package/dist/config/ParsedServerConfig.js +55 -0
  191. package/dist/config/ParsedServerConfig.js.map +1 -0
  192. package/dist/config/TempProfileConfig.d.ts +8 -0
  193. package/dist/config/TempProfileConfig.d.ts.map +1 -0
  194. package/dist/config/TempProfileConfig.js +13 -0
  195. package/dist/config/TempProfileConfig.js.map +1 -0
  196. package/dist/config/utils.d.ts +2 -0
  197. package/dist/config/utils.d.ts.map +1 -0
  198. package/dist/config/utils.js +8 -0
  199. package/dist/config/utils.js.map +1 -0
  200. package/dist/config/validations/validateProfileConfig.d.ts +4 -0
  201. package/dist/config/validations/validateProfileConfig.d.ts.map +1 -0
  202. package/dist/config/validations/validateProfileConfig.js +76 -0
  203. package/dist/config/validations/validateProfileConfig.js.map +1 -0
  204. package/dist/core/FS/utils.d.ts +12 -0
  205. package/dist/core/FS/utils.d.ts.map +1 -0
  206. package/dist/core/FS/utils.js +55 -0
  207. package/dist/core/FS/utils.js.map +1 -0
  208. package/dist/daemon/DaemonClient.d.ts +16 -0
  209. package/dist/daemon/DaemonClient.d.ts.map +1 -0
  210. package/dist/daemon/DaemonClient.js +158 -0
  211. package/dist/daemon/DaemonClient.js.map +1 -0
  212. package/dist/daemon/DaemonServer.d.ts +8 -0
  213. package/dist/daemon/DaemonServer.d.ts.map +1 -0
  214. package/dist/daemon/DaemonServer.js +201 -0
  215. package/dist/daemon/DaemonServer.js.map +1 -0
  216. package/dist/daemon/protocol.d.ts +101 -0
  217. package/dist/daemon/protocol.d.ts.map +1 -0
  218. package/dist/daemon/protocol.js +2 -0
  219. package/dist/daemon/protocol.js.map +1 -0
  220. package/dist/daemon-main.d.ts +2 -0
  221. package/dist/daemon-main.d.ts.map +1 -0
  222. package/dist/daemon-main.js +13 -0
  223. package/dist/daemon-main.js.map +1 -0
  224. package/dist/launcher-main.d.ts +2 -0
  225. package/dist/launcher-main.d.ts.map +1 -0
  226. package/dist/launcher-main.js +57 -0
  227. package/dist/launcher-main.js.map +1 -0
  228. package/dist/lib/Flow/applyUpdate.d.ts +3 -0
  229. package/dist/lib/Flow/applyUpdate.d.ts.map +1 -0
  230. package/dist/lib/Flow/applyUpdate.js +34 -0
  231. package/dist/lib/Flow/applyUpdate.js.map +1 -0
  232. package/dist/lib/Flow/downloadBinaryUpdate.d.ts +3 -0
  233. package/dist/lib/Flow/downloadBinaryUpdate.d.ts.map +1 -0
  234. package/dist/lib/Flow/downloadBinaryUpdate.js +54 -0
  235. package/dist/lib/Flow/downloadBinaryUpdate.js.map +1 -0
  236. package/dist/lib/Flow/getLatestVersion.d.ts +2 -0
  237. package/dist/lib/Flow/getLatestVersion.d.ts.map +1 -0
  238. package/dist/lib/Flow/getLatestVersion.js +13 -0
  239. package/dist/lib/Flow/getLatestVersion.js.map +1 -0
  240. package/dist/lib/defs.d.ts +18 -0
  241. package/dist/lib/defs.d.ts.map +1 -0
  242. package/dist/lib/defs.js +33 -0
  243. package/dist/lib/defs.js.map +1 -0
  244. package/dist/logger/logger.d.ts +6 -0
  245. package/dist/logger/logger.d.ts.map +1 -0
  246. package/dist/logger/logger.js +34 -0
  247. package/dist/logger/logger.js.map +1 -0
  248. package/dist/output-formats/colors.d.ts +7 -0
  249. package/dist/output-formats/colors.d.ts.map +1 -0
  250. package/dist/output-formats/colors.js +8 -0
  251. package/dist/output-formats/colors.js.map +1 -0
  252. package/dist/output-formats/formatConfig.d.ts +3 -0
  253. package/dist/output-formats/formatConfig.d.ts.map +1 -0
  254. package/dist/output-formats/formatConfig.js +59 -0
  255. package/dist/output-formats/formatConfig.js.map +1 -0
  256. package/dist/output-formats/formatConfigPath.d.ts +4 -0
  257. package/dist/output-formats/formatConfigPath.d.ts.map +1 -0
  258. package/dist/output-formats/formatConfigPath.js +7 -0
  259. package/dist/output-formats/formatConfigPath.js.map +1 -0
  260. package/dist/output-formats/formatPath.d.ts +2 -0
  261. package/dist/output-formats/formatPath.d.ts.map +1 -0
  262. package/dist/output-formats/formatPath.js +6 -0
  263. package/dist/output-formats/formatPath.js.map +1 -0
  264. package/dist/output-formats/formatProfile.d.ts +3 -0
  265. package/dist/output-formats/formatProfile.d.ts.map +1 -0
  266. package/dist/output-formats/formatProfile.js +35 -0
  267. package/dist/output-formats/formatProfile.js.map +1 -0
  268. package/dist/output-formats/formatProfilesShort.d.ts +3 -0
  269. package/dist/output-formats/formatProfilesShort.d.ts.map +1 -0
  270. package/dist/output-formats/formatProfilesShort.js +19 -0
  271. package/dist/output-formats/formatProfilesShort.js.map +1 -0
  272. package/dist/output-formats/formatSaveResult.d.ts +4 -0
  273. package/dist/output-formats/formatSaveResult.d.ts.map +1 -0
  274. package/dist/output-formats/formatSaveResult.js +7 -0
  275. package/dist/output-formats/formatSaveResult.js.map +1 -0
  276. package/dist/output-formats/table.d.ts +8 -0
  277. package/dist/output-formats/table.d.ts.map +1 -0
  278. package/dist/output-formats/table.js +15 -0
  279. package/dist/output-formats/table.js.map +1 -0
  280. package/dist/package-json/packageJson.d.ts +6 -0
  281. package/dist/package-json/packageJson.d.ts.map +1 -0
  282. package/dist/package-json/packageJson.js +12 -0
  283. package/dist/package-json/packageJson.js.map +1 -0
  284. package/dist/proxy/Proxy.d.ts +6 -0
  285. package/dist/proxy/Proxy.d.ts.map +1 -0
  286. package/dist/proxy/Proxy.js +203 -0
  287. package/dist/proxy/Proxy.js.map +1 -0
  288. package/dist/sea-main.d.ts +2 -0
  289. package/dist/sea-main.d.ts.map +1 -0
  290. package/dist/sea-main.js +20 -0
  291. package/dist/sea-main.js.map +1 -0
  292. package/dist/types/types.d.ts +55 -0
  293. package/dist/types/types.d.ts.map +1 -0
  294. package/dist/types/types.js +2 -0
  295. package/dist/types/types.js.map +1 -0
  296. package/dist/utils/arrayFunctions.d.ts +24 -0
  297. package/dist/utils/arrayFunctions.d.ts.map +1 -0
  298. package/dist/utils/arrayFunctions.js +43 -0
  299. package/dist/utils/arrayFunctions.js.map +1 -0
  300. package/dist/utils/assertFunctions.d.ts +7 -0
  301. package/dist/utils/assertFunctions.d.ts.map +1 -0
  302. package/dist/utils/assertFunctions.js +20 -0
  303. package/dist/utils/assertFunctions.js.map +1 -0
  304. package/dist/utils/checkFunctions.d.ts +34 -0
  305. package/dist/utils/checkFunctions.d.ts.map +1 -0
  306. package/dist/utils/checkFunctions.js +87 -0
  307. package/dist/utils/checkFunctions.js.map +1 -0
  308. package/dist/utils/cliFunctions.d.ts +10 -0
  309. package/dist/utils/cliFunctions.d.ts.map +1 -0
  310. package/dist/utils/cliFunctions.js +68 -0
  311. package/dist/utils/cliFunctions.js.map +1 -0
  312. package/dist/utils/hashFunctions.d.ts +10 -0
  313. package/dist/utils/hashFunctions.d.ts.map +1 -0
  314. package/dist/utils/hashFunctions.js +11 -0
  315. package/dist/utils/hashFunctions.js.map +1 -0
  316. package/dist/utils/npmFunctions.d.ts +3 -0
  317. package/dist/utils/npmFunctions.d.ts.map +1 -0
  318. package/dist/utils/npmFunctions.js +28 -0
  319. package/dist/utils/npmFunctions.js.map +1 -0
  320. package/dist/utils/stringFunctions.d.ts +12 -0
  321. package/dist/utils/stringFunctions.d.ts.map +1 -0
  322. package/dist/utils/stringFunctions.js +37 -0
  323. package/dist/utils/stringFunctions.js.map +1 -0
  324. package/package.json +39 -16
  325. package/client.js +0 -33
  326. package/src/cli-app/Dashboard.js +0 -220
  327. package/src/cli-app/Screen/FullScreenModal.js +0 -63
  328. package/src/cli-app/Screen.js +0 -140
  329. package/src/cli-app/elements/ElementNode.js +0 -97
  330. package/src/cli-app/elements/Line.js +0 -21
  331. package/src/cli-app/elements/List/List.js +0 -227
  332. package/src/cli-app/elements/List/ListCell.js +0 -83
  333. package/src/cli-app/elements/List/ListColumn.js +0 -52
  334. package/src/cli-app/elements/List/ListRow.js +0 -118
  335. package/src/cli-app/elements/Row.js +0 -38
  336. package/src/cli-app/helper/utils.js +0 -42
  337. package/src/commands/Action/addDelValuesAction.js +0 -56
  338. package/src/commands/CommandAuth.js +0 -32
  339. package/src/commands/CommandClearAll.js +0 -27
  340. package/src/commands/CommandConfig.js +0 -59
  341. package/src/commands/CommandHTTP.js +0 -192
  342. package/src/commands/CommandInvite.js +0 -38
  343. package/src/commands/CommandRefresh.js +0 -35
  344. package/src/commands/CommandRegister.js +0 -48
  345. package/src/commands/Option/DeleteOption.js +0 -6
  346. package/src/commands/Option/ProfileListOption.js +0 -65
  347. package/src/commands/Option/SelectConfigOption.js +0 -52
  348. package/src/commands/SubCommand/AllowDenyCidrCommand.js +0 -28
  349. package/src/commands/SubCommand/HostCommand.js +0 -22
  350. package/src/commands/SubCommand/PortCommand.js +0 -20
  351. package/src/commands/SubCommand/ProtocolCommand.js +0 -21
  352. package/src/commands/helper/AliasResolver.js +0 -13
  353. package/src/commands/helper/BindArgs.js +0 -53
  354. package/src/commands/helper/SharedArg.js +0 -32
  355. package/src/commands/utils.js +0 -96
  356. package/src/config/ConfigAbstract.js +0 -353
  357. package/src/config/ConfigManager.js +0 -70
  358. package/src/config/GlobalConfig.js +0 -14
  359. package/src/config/GlobalLocalShardConfigAbstract.js +0 -98
  360. package/src/config/LocalConfig.js +0 -7
  361. package/src/config/PropertyConfig.js +0 -122
  362. package/src/config/SystemConfig.js +0 -31
  363. package/src/core/FS/utils.js +0 -60
  364. package/src/core/Ref.js +0 -70
  365. package/src/lib/Flow/getCurrentIp.js +0 -18
  366. package/src/lib/Flow/getLatestVersion.js +0 -13
  367. package/src/lib/Flow/proxyUrl.js +0 -35
  368. package/src/lib/Flow/validateAuthToken.js +0 -19
  369. package/src/lib/HttpClient.js +0 -61
  370. package/src/lib/Proxy.js +0 -42
  371. package/src/lib/defs.js +0 -13
  372. package/src/net/IPV4.js +0 -139
  373. package/src/net/http/IncomingMessage.js +0 -92
  374. package/src/net/http/ServerResponse.js +0 -126
  375. package/src/net/http/TunliRequest.js +0 -1
  376. package/src/net/http/TunliResponse.js +0 -1
  377. package/src/net/http/TunnelRequest.js +0 -229
  378. package/src/net/http/TunnelResponse.js +0 -119
  379. package/src/tunnel-client/TunnelClient.js +0 -144
  380. package/src/utils/arrayFunctions.js +0 -45
  381. package/src/utils/checkFunctions.js +0 -182
  382. package/src/utils/cliFunctions.js +0 -63
  383. package/src/utils/createRequest.js +0 -12
  384. package/src/utils/hashFunctions.js +0 -9
  385. package/src/utils/httpFunction.js +0 -23
  386. package/src/utils/npmFunctions.js +0 -27
  387. package/src/utils/stringFunctions.js +0 -59
  388. package/types/index.d.ts +0 -119
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveConfig.d.ts","sourceRoot":"","sources":["../../../../src/commands/CommandConfig/utils/resolveConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGvD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAA;AACvG,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,mBAAmB,CAAA;AAC1G,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,YAAY,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { DEFAULT_PROFILE_NAME } from "#lib/defs";
2
+ export function resolveConfig(ctx, options, mode = 'profile') {
3
+ if (options.local && !ctx.config.local) {
4
+ ctx.logger.warn(' No local config found. Run `tunli init` to create one.');
5
+ ctx.exit(1);
6
+ }
7
+ if (options.global && !ctx.config.global.exists()) {
8
+ ctx.logger.warn(' No global config found. Run `tunli register` to create one.');
9
+ ctx.exit(1);
10
+ }
11
+ let config;
12
+ if (!options.global && ctx.config.local) {
13
+ config = ctx.config.local;
14
+ }
15
+ else {
16
+ config = ctx.config.global;
17
+ }
18
+ if (mode === 'save') {
19
+ if (!options.profile) {
20
+ return config.temporaryProfile();
21
+ }
22
+ return config.profile(options.profile);
23
+ }
24
+ if (mode === 'profile') {
25
+ const profileName = options.profile ?? config.defaultProfile ?? DEFAULT_PROFILE_NAME;
26
+ const profile = config.profile(profileName);
27
+ if (profile.exists())
28
+ return profile;
29
+ return config.profile(config.defaultProfile ?? DEFAULT_PROFILE_NAME);
30
+ }
31
+ return config;
32
+ }
33
+ //# sourceMappingURL=resolveConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveConfig.js","sourceRoot":"","sources":["../../../../src/commands/CommandConfig/utils/resolveConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAK/C,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,OAAsB,EAAE,OAA2C,SAAS;IACtH,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAA;QAC1E,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QAClD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAA;QAC/E,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACb,CAAC;IAED,IAAI,MAAM,CAAA;IAEV,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAA;IAC5B,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC,gBAAgB,EAAE,CAAA;QAClC,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,cAAc,IAAI,oBAAoB,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAC3C,IAAI,OAAO,CAAC,MAAM,EAAE;YAAE,OAAO,OAAO,CAAA;QACpC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,oBAAoB,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Command } from "#commander/index";
2
+ export declare const addSharedOptions: (cmd: Command, mode?: "save" | "no-profile" | "profile") => Command;
3
+ //# sourceMappingURL=sharedOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/CommandConfig/utils/sharedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,OAAO,EAAS,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,EAAE,OAAM,MAAM,GAAG,YAAY,GAAG,SAAqB,KAAG,OAWpG,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { Option } from "#commander/index";
2
+ import { DEFAULT_PROFILE_NAME } from "#lib/defs";
3
+ export const addSharedOptions = (cmd, mode = "profile") => {
4
+ cmd.addOption(new Option('global', 'Use the global configuration').short('g'))
5
+ .addOption(new Option('local', 'Use the local configuration').short('l'));
6
+ if (mode === 'profile') {
7
+ cmd.addOption(new Option('profile', 'Profile to use').short('p').argument('name').default(DEFAULT_PROFILE_NAME));
8
+ }
9
+ else if (mode === 'save') {
10
+ cmd.addOption(new Option('save', 'Profile to use').argument('profile'));
11
+ }
12
+ return cmd;
13
+ };
14
+ //# sourceMappingURL=sharedOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedOptions.js","sourceRoot":"","sources":["../../../../src/commands/CommandConfig/utils/sharedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAE,OAA0C,SAAS,EAAW,EAAE;IAC7G,GAAG,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,8BAA8B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAC3E,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAE3E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,GAAG,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAClH,CAAC;SAAM,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,GAAG,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandDaemon: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandDaemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandDaemon.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandDaemon/CommandDaemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAI1C,eAAO,MAAM,mBAAmB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAoElE,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { Command } from "#commander/index";
2
+ import { DaemonClient } from "#daemon/DaemonClient";
3
+ import { dumpAndStopDaemon } from "#lib/Flow/applyUpdate";
4
+ export const createCommandDaemon = (ctx, _program) => {
5
+ const cmd = new Command('daemon')
6
+ .description('Manage the tunli background daemon');
7
+ cmd.addCommand(new Command('start')
8
+ .description('Start the daemon in the background')
9
+ .action(async () => {
10
+ if (await DaemonClient.isRunning()) {
11
+ ctx.logger.info('Daemon is already running.');
12
+ return;
13
+ }
14
+ await DaemonClient.start();
15
+ ctx.logger.info('Daemon started.');
16
+ }));
17
+ cmd.addCommand(new Command('stop')
18
+ .description('Stop the running daemon')
19
+ .action(async () => {
20
+ if (!await DaemonClient.isRunning()) {
21
+ ctx.logger.info('Daemon is not running.');
22
+ return;
23
+ }
24
+ await DaemonClient.stop();
25
+ ctx.logger.info('Daemon stopped.');
26
+ }));
27
+ cmd.addCommand(new Command('restart')
28
+ .description('Restart the daemon')
29
+ .action(async () => {
30
+ if (await DaemonClient.isRunning()) {
31
+ await DaemonClient.stop();
32
+ ctx.logger.info('Daemon stopped.');
33
+ }
34
+ await DaemonClient.start();
35
+ ctx.logger.info('Daemon started.');
36
+ }));
37
+ cmd.addCommand(new Command('reload')
38
+ .description('Dump active tunnels, restart daemon and restore them')
39
+ .action(async () => {
40
+ if (!await DaemonClient.isRunning()) {
41
+ ctx.logger.info('Daemon is not running.');
42
+ return;
43
+ }
44
+ await dumpAndStopDaemon();
45
+ ctx.logger.info('Daemon stopped.');
46
+ await DaemonClient.start();
47
+ ctx.logger.info('Daemon restarted. Tunnels restored.');
48
+ }));
49
+ cmd.addCommand(new Command('status')
50
+ .description('Show daemon status')
51
+ .action(async () => {
52
+ const running = await DaemonClient.isRunning();
53
+ ctx.logger.info(running ? 'Daemon is running.' : 'Daemon is not running.');
54
+ }));
55
+ return cmd;
56
+ };
57
+ //# sourceMappingURL=CommandDaemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandDaemon.js","sourceRoot":"","sources":["../../../src/commands/CommandDaemon/CommandDaemon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAAE,EAAE;IACrE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,oCAAoC,CAAC,CAAA;IAEpD,GAAG,CAAC,UAAU,CACZ,IAAI,OAAO,CAAC,OAAO,CAAC;SACjB,WAAW,CAAC,oCAAoC,CAAC;SACjD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,MAAM,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC;YACnC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;YAC7C,OAAM;QACR,CAAC;QACD,MAAM,YAAY,CAAC,KAAK,EAAE,CAAA;QAC1B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IACpC,CAAC,CAAC,CACL,CAAA;IAED,GAAG,CAAC,UAAU,CACZ,IAAI,OAAO,CAAC,MAAM,CAAC;SAChB,WAAW,CAAC,yBAAyB,CAAC;SACtC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC,MAAM,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC;YACpC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,C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jB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,SAAS,EAAE,CAAA;QAC9C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;IAC5E,CAAC,CAAC,CACL,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandDashboard: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandDashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandDashboard.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandDashboard/CommandDashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAK1C,eAAO,MAAM,sBAAsB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAmDrE,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { Argument, Command } from "#commander/index";
2
+ import { DaemonClient } from "#daemon/DaemonClient";
3
+ import { AppEventEmitter } from "#cli-app/AppEventEmitter";
4
+ import { initDashboard } from "#cli-app/Dashboard";
5
+ export const createCommandDashboard = (ctx, _program) => {
6
+ return new Command('dashboard')
7
+ .description('Attach to a running tunnel and show the live dashboard')
8
+ .addArgument(new Argument('profile', 'Profile name to attach to'))
9
+ .action(async ({ args }) => {
10
+ if (!await DaemonClient.isRunning()) {
11
+ ctx.logger.error('No daemon running. Start a tunnel first with `tunli http <port>`.');
12
+ return ctx.exit(1);
13
+ }
14
+ const listResult = await new DaemonClient().send({ type: 'list' });
15
+ if (listResult.type !== 'list')
16
+ return ctx.exit(1);
17
+ const profileName = args.profile ?? listResult.tunnels[0]?.profileName;
18
+ if (!profileName) {
19
+ ctx.logger.error('No active tunnels.');
20
+ return ctx.exit(1);
21
+ }
22
+ const appEmitter = new AppEventEmitter();
23
+ const attachResult = await DaemonClient.attach(profileName, appEmitter).catch((e) => {
24
+ ctx.logger.error(e.message);
25
+ ctx.exit(1);
26
+ });
27
+ const tunnelInfo = listResult.tunnels.find(t => t.profileName === profileName);
28
+ if (!tunnelInfo) {
29
+ ctx.logger.error(`No tunnel running for profile "${profileName}".`);
30
+ return ctx.exit(1);
31
+ }
32
+ const [host, portStr] = tunnelInfo.target.split(':');
33
+ const mockConfig = {
34
+ profileName,
35
+ filepath: '-',
36
+ allowedCidr: [],
37
+ deniedCidr: [],
38
+ proxy: { proxyIdent: '', proxyURL: tunnelInfo.proxyURL },
39
+ target: { host: host ?? 'localhost', port: Number(portStr ?? 80), protocol: 'http' },
40
+ serverConfig: { url: '', authToken: '' },
41
+ apiClient: ctx.apiClient,
42
+ };
43
+ initDashboard(mockConfig, appEmitter);
44
+ if (attachResult?.status === 'connected')
45
+ appEmitter.emit('connect');
46
+ if (attachResult?.status === 'disconnected')
47
+ appEmitter.emit('disconnect', 'io client disconnect');
48
+ if (attachResult?.lastLatency !== undefined)
49
+ appEmitter.emit('latency', attachResult.lastLatency);
50
+ if (attachResult?.requestCount)
51
+ appEmitter.emit('request-count', attachResult.requestCount);
52
+ });
53
+ };
54
+ //# sourceMappingURL=CommandDashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandDashboard.js","sourceRoot":"","sources":["../../../src/commands/CommandDashboard/CommandDashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAA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AAe,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IAC7F,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandHttp: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandHttp.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandHTTP/CommandHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAQ1C,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YA+ChE,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { Argument, Command } from "#commander/index";
2
+ import { checkPort } from "#utils/checkFunctions";
3
+ import { resolveConfig } from "#commands/CommandConfig/utils/resolveConfig";
4
+ import { addSharedOptions } from "#commands/CommandConfig/utils/sharedOptions";
5
+ import { validateProfileConfig } from "#config/validations/validateProfileConfig";
6
+ import { DaemonClient } from "#daemon/DaemonClient";
7
+ export const createCommandHttp = (ctx, _program) => {
8
+ const cmd = new Command('http')
9
+ .description('Start a tunnel to a local HTTP service')
10
+ .alias('https');
11
+ addSharedOptions(cmd, 'save');
12
+ cmd.addArgument(new Argument('port', 'Local port to forward (e.g. 3000)').required().parse(checkPort));
13
+ cmd.addArgument(new Argument('host', 'Local host to forward to (default: localhost)'));
14
+ cmd.action(async ({ args, options }) => {
15
+ const port = args.port;
16
+ const host = args.host ?? 'localhost';
17
+ const opts = options;
18
+ const config = resolveConfig(ctx, {
19
+ local: opts.local === true,
20
+ global: opts.global === true,
21
+ profile: opts.save
22
+ }, 'save');
23
+ config.update({ protocol: 'http', host, port });
24
+ const validated = await validateProfileConfig(ctx, config);
25
+ if (opts.save)
26
+ config.save();
27
+ await DaemonClient.ensureRunning();
28
+ const client = new DaemonClient();
29
+ const result = await client.send({
30
+ type: 'start',
31
+ profileName: validated.profileName,
32
+ proxyIdent: validated.proxy.proxyIdent,
33
+ proxyURL: validated.proxy.proxyURL,
34
+ serverUrl: validated.serverConfig.url,
35
+ authToken: validated.serverConfig.authToken,
36
+ target: validated.target,
37
+ filepath: validated.filepath,
38
+ allowedCidr: validated.allowedCidr,
39
+ deniedCidr: validated.deniedCidr,
40
+ });
41
+ if (result.type === 'error') {
42
+ ctx.logger.error(result.message);
43
+ return ctx.exit(1);
44
+ }
45
+ if (result.type === 'started')
46
+ ctx.logger.info(`Tunnel started: ${result.proxyURL}`);
47
+ });
48
+ return cmd;
49
+ };
50
+ //# sourceMappingURL=CommandHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandHttp.js","sourceRoot":"","sources":["../../../src/commands/CommandHTTP/CommandHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAC,gBAAgB,EAAC,MAAM,6CAA6C,CAAC;AAE7E,OAAO,EAAC,qBAAqB,EAAC,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAAE,EAAE;IACnE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,wCAAwC,CAAC;SACrD,KAAK,CAAC,OAAO,CAAC,CAAA;IACjB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC7B,GAAG,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,mCAAmC,C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AAC,SAAS;YAC7C,MAAM,EAAO,SAAS,CAAC,MAAM;YAC7B,QAAQ,EAAK,SAAS,CAAC,QAAQ;YAC/B,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,UAAU,EAAG,SAAS,CAAC,UAAU;SAClC,CAAC,CAAA;QAEF,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAChC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS;YAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IACtF,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandInit: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandInit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInit.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandInit/CommandInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAiD,MAAM,kBAAkB,CAAC;AACzF,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAI1C,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAyChE,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { Command, InvalidArgumentError, Option } from "#commander/index";
2
+ import { FOUND_LOCAL_CONFIG_FILEPATH, GLOBAL_CONFIG_FILEPATH, LOCAL_CONFIG_FILEPATH } from "#lib/defs";
3
+ import { removeFile } from "#core/FS/utils";
4
+ export const createCommandInit = (ctx, _program) => {
5
+ const cmd = new Command('init')
6
+ .description('Initialize a local config in the current directory')
7
+ .addOption(new Option('force', 'Overwrite existing local config').short('f'));
8
+ cmd.action(({ options }) => {
9
+ if (!ctx.config.global.exists()) {
10
+ ctx.logger.warn('No account found. Run `tunli register` to get started.');
11
+ }
12
+ const opt = options;
13
+ const force = opt.force === true;
14
+ if (ctx.config.local) {
15
+ if (force) {
16
+ if (FOUND_LOCAL_CONFIG_FILEPATH) {
17
+ removeFile(FOUND_LOCAL_CONFIG_FILEPATH);
18
+ }
19
+ }
20
+ else {
21
+ ctx.logger.error(`Local config already exists at ${FOUND_LOCAL_CONFIG_FILEPATH}`);
22
+ ctx.logger.error('Use --force to reinitialize.');
23
+ ctx.exit(1);
24
+ }
25
+ }
26
+ if (LOCAL_CONFIG_FILEPATH === GLOBAL_CONFIG_FILEPATH) {
27
+ throw new InvalidArgumentError(`Error: Cannot run \`tunli init\` in your home directory.\nThe global config already lives at ~/.tunli/config.json`);
28
+ }
29
+ ctx.config.createLocalConfig();
30
+ });
31
+ cmd.extendUsage();
32
+ cmd.addExample('init', 'Initialize a local config in the current directory');
33
+ cmd.addExample('init --force', 'Reinitialize and overwrite existing local config');
34
+ return cmd;
35
+ };
36
+ //# sourceMappingURL=CommandInit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInit.js","sourceRoot":"","sources":["../../../src/commands/CommandInit/CommandInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAAC,2BAA2B,EAAE,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC;AACrG,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAAE,EAAE;IAInE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,oDAAoD,CAAC;SACj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,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandList: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandList.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandList/CommandList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AA6C1C,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAoBhE,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { Command } from "#commander/index";
2
+ import { DaemonClient } from "#daemon/DaemonClient";
3
+ import { heading, row, separator, tableWidth } from "#output-formats/table";
4
+ import chalk from "chalk";
5
+ const statusColor = (status) => {
6
+ switch (status) {
7
+ case 'connected':
8
+ return chalk.green(status);
9
+ case 'connecting':
10
+ return chalk.yellow(status);
11
+ case 'disconnected':
12
+ return chalk.dim(status);
13
+ case 'error':
14
+ return chalk.red(status);
15
+ }
16
+ };
17
+ const formatTunnelList = (tunnels) => {
18
+ const profileW = Math.max(7, ...tunnels.map(t => t.profileName.length));
19
+ const urlW = Math.max(9, ...tunnels.map(t => t.proxyURL.length));
20
+ const statusW = Math.max(6, ...tunnels.map(t => t.status.length));
21
+ const targetW = Math.max(6, ...tunnels.map(t => t.target.length));
22
+ const widths = [profileW, urlW, statusW, targetW];
23
+ const aligns = ['left', 'left', 'left', 'left'];
24
+ const w = tableWidth(widths);
25
+ const lines = [
26
+ heading('Active Tunnels', w),
27
+ row(['PROFILE', 'PROXY URL', 'STATUS', 'TARGET'], widths, aligns),
28
+ separator(widths),
29
+ ...tunnels.map(t => row([t.profileName, t.proxyURL, t.status, t.target], widths, aligns, [undefined, chalk.cyan, statusColor, undefined])),
30
+ ];
31
+ return lines.join('\n');
32
+ };
33
+ export const createCommandList = (ctx, _program) => {
34
+ return new Command('list')
35
+ .description('List active tunnels')
36
+ .action(async () => {
37
+ if (!await DaemonClient.isRunning()) {
38
+ ctx.logger.info('No daemon running. Start a tunnel with `tunli http <port>`.');
39
+ return;
40
+ }
41
+ const client = new DaemonClient();
42
+ const result = await client.send({ type: 'list' });
43
+ if (result.type !== 'list') {
44
+ ctx.logger.error('Unexpected response from daemon.');
45
+ return;
46
+ }
47
+ if (!result.tunnels.length) {
48
+ ctx.logger.info('No active tunnels.');
49
+ return;
50
+ }
51
+ ctx.logger.info(formatTunnelList(result.tunnels));
52
+ });
53
+ };
54
+ //# sourceMappingURL=CommandList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandList.js","sourceRoot":"","sources":["../../../src/commands/CommandList/CommandList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAa,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,GAAG,CAAC,MAA4B,EAAE,EAAE;IACnD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC5B,KAAK,YAAY;YACf,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC7B,KAAK,cAAc;YACjB,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC1B,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;AACH,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,OAAqB,EAAU,EAAE;IACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE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SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,WAA2B,EAAE,SAAS,CAAC,CAChE,CACF;KACF,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAAE,EAAE;IACnE,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,qBAAqB,CAAC;SAClC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC,MAAM,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC;YACpC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;YAC9E,OAAM;QACR,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAA;QACjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;QAChD,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC3B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;YACpD,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC3B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;YACrC,OAAM;QACR,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandLogs: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandLogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLogs.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandLogs/CommandLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAK1C,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YA8BhE,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { Argument, Command } from "#commander/index";
2
+ import { DaemonClient } from "#daemon/DaemonClient";
3
+ import { AppEventEmitter } from "#cli-app/AppEventEmitter";
4
+ import { initLiveLog } from "#cli-app/LiveLog";
5
+ export const createCommandLogs = (ctx, _program) => {
6
+ return new Command('logs')
7
+ .alias('log')
8
+ .description('Attach to a running tunnel and stream live log output')
9
+ .addArgument(new Argument('profile', 'Profile name to attach to'))
10
+ .action(async ({ args }) => {
11
+ if (!await DaemonClient.isRunning()) {
12
+ ctx.logger.error('No daemon running. Start a tunnel first with `tunli http <port>`.');
13
+ return ctx.exit(1);
14
+ }
15
+ const listResult = await new DaemonClient().send({ type: 'list' });
16
+ if (listResult.type !== 'list')
17
+ return ctx.exit(1);
18
+ const profileName = args.profile ?? listResult.tunnels[0]?.profileName;
19
+ if (!profileName) {
20
+ ctx.logger.error('No active tunnels.');
21
+ return ctx.exit(1);
22
+ }
23
+ const appEmitter = new AppEventEmitter();
24
+ const status = await DaemonClient.attach(profileName, appEmitter).catch((e) => {
25
+ ctx.logger.error(e.message);
26
+ ctx.exit(1);
27
+ });
28
+ if (status?.status === 'connected')
29
+ appEmitter.emit('connect');
30
+ initLiveLog(undefined, appEmitter);
31
+ });
32
+ };
33
+ //# sourceMappingURL=CommandLogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandLogs.js","sourceRoot":"","sources":["../../../src/commands/CommandLogs/CommandLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;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,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;YACnF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YAC3B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACb,CAAC,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE,MAAM,KAAK,WAAW;YAAE,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC9D,WAAW,CAAC,SAAkB,EAAE,UAAU,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { Context } from "#types/types";
2
+ import { Command } from "#commander/index";
3
+ export declare const configProfilesCommand: (ctx: Context, cmdName?: string) => Command;
4
+ export declare const createCommandProfile: (ctx: Context, _program: Command) => Command;
5
+ //# sourceMappingURL=CommandProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandProfile.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandProfile/CommandProfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAW,OAAO,EAA+C,MAAM,kBAAkB,CAAC;AAQjG,eAAO,MAAM,qBAAqB,GAChC,KAAK,OAAO,EACZ,gBAAmB,YAgBpB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAgDnE,CAAA"}
@@ -0,0 +1,64 @@
1
+ import { Argument, Command, Option } from "#commander/index";
2
+ import { resolveConfig } from "#commands/CommandConfig/utils/resolveConfig";
3
+ import { addSharedOptions } from "#commands/CommandConfig/utils/sharedOptions";
4
+ import { formatSaveResult } from "#output-formats/formatSaveResult";
5
+ import { formatProfilesShort } from "#output-formats/formatProfilesShort";
6
+ import { confirm } from "#commands/utils";
7
+ export const configProfilesCommand = (ctx, cmdName = 'servers') => {
8
+ const cmd = new Command(cmdName)
9
+ .description('List all profiles in the active configuration');
10
+ cmd.action(({ options }) => {
11
+ const config = resolveConfig(ctx, options, 'config-only');
12
+ const profiles = config.profiles;
13
+ if (!profiles.length) {
14
+ ctx.logger.info('No profiles found. Run `tunli http 3000 --save <name>` to create one.');
15
+ return;
16
+ }
17
+ ctx.logger.info(formatProfilesShort(config));
18
+ });
19
+ return cmd;
20
+ };
21
+ export const createCommandProfile = (ctx, _program) => {
22
+ const cmd = new Command('profile').alias('profiles')
23
+ .description('Manage tunnel profiles')
24
+ .addCommand(configProfilesCommand(ctx, 'list'))
25
+ .addCommand(new Command('delete').description('Remove a profile from the configuration')
26
+ .addOption(new Option('force', 'Skip confirmation').short('f'))
27
+ .addArgument(new Argument('name', 'Profile name').required())
28
+ .action(async ({ args, options }) => {
29
+ const config = resolveConfig(ctx, options, 'config-only').profile(args.name);
30
+ if (!config.exists()) {
31
+ ctx.logger.error(`Profile "${args.name}" not found.`);
32
+ return ctx.exit(1);
33
+ }
34
+ const ok = options.force || await confirm(`Remove profile "${config.name}" from ${config.filepath} (${config.locationType})? [y/N] `);
35
+ if (!ok) {
36
+ ctx.logger.info('Aborted.');
37
+ return ctx.exit(0);
38
+ }
39
+ config.delete();
40
+ config.save();
41
+ ctx.logger.info(formatSaveResult(config));
42
+ ctx.logger.info(`Profile "${args.name}" deleted`);
43
+ }))
44
+ .addCommand(new Command('use').description('Set the default profile')
45
+ .addArgument(new Argument('name', 'Profile name').required()).action(({ args, options }) => {
46
+ const name = args.name;
47
+ const config = resolveConfig(ctx, options, 'config-only');
48
+ if (!config.profile(name).exists()) {
49
+ ctx.logger.warn(`Profile "${name}" not found.`);
50
+ }
51
+ else {
52
+ config.defaultProfile = name;
53
+ config.save();
54
+ ctx.logger.info(formatSaveResult(config));
55
+ ctx.logger.info(`Active profile set to "${name}"`);
56
+ }
57
+ }));
58
+ addSharedOptions(cmd, 'no-profile');
59
+ cmd.extendUsage();
60
+ cmd.addExample('profile list', 'List all registered profiles');
61
+ cmd.addExample('profile use staging', 'Set staging as the default profile');
62
+ return cmd;
63
+ };
64
+ //# sourceMappingURL=CommandProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandProfile.js","sourceRoot":"","sources":["../../../src/commands/CommandProfile/CommandProfile.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAuC,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EAAC,aAAa,EAAC,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAC,gBAAgB,EAAC,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAY,EACZ,OAAO,GAAG,SAAS,EACnB,EAAE;IACF,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;SAC7B,WAAW,CAAC,+CAA+C,CAAC,CAAA;IAE/D,GAAG,CAAC,MAAM,CAAC,CAAC,EAAC,OAAO,EAA4C,EAAE,EAAE;QAClE,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;QACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAA;YACxF,OAAM;QACR,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG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AqB,EAAE,oCAAoC,CAAC,CAAA;IAC3E,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Command } from "#commander/index";
2
+ import type { Context } from "#types/types";
3
+ export declare const createCommandRegister: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandRegister.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandRegister.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandRegister/CommandRegister.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAA2B,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAG1C,eAAO,MAAM,qBAAqB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YAsDpE,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { Command, Option } from "#commander/index";
2
+ import { DEFAULT_API_SERVER_URL, DEFAULT_SERVER_NAME } from "#lib/defs";
3
+ export const createCommandRegister = (ctx, _program) => {
4
+ const cmd = new Command('register')
5
+ .description('Register a new account and store the auth token')
6
+ .addOption(new Option('force', 'Force registration even if an auth token already exists').short('f'))
7
+ .addOption(new Option('relay', 'Register against a custom relay server instead of the default tunli relay').argument('url').default(DEFAULT_API_SERVER_URL))
8
+ .addOption(new Option('name', 'Alias for the relay, used to reference it later (e.g. tunli relay use myrelay)').argument('alias').default(DEFAULT_SERVER_NAME));
9
+ cmd.action(async ({ options }) => {
10
+ const opt = options;
11
+ const force = opt.force === true;
12
+ const serverName = opt.name ?? ctx.config.global.activeServer ?? DEFAULT_SERVER_NAME;
13
+ const serverConf = ctx.config.global.server(serverName);
14
+ if (serverConf.exists() && !force) {
15
+ ctx.logger.info('Auth token already exists. Use --force to renew.');
16
+ return ctx.exit(0);
17
+ }
18
+ const { data, error } = await ctx.apiClient.register(opt.relay);
19
+ if (error || !data) {
20
+ if (error) {
21
+ ctx.logger.error(error.message);
22
+ }
23
+ else {
24
+ ctx.logger.error('Registration failed. Please try again later.');
25
+ }
26
+ return ctx.exit(1);
27
+ }
28
+ if (!ctx.config.global.activeServer) {
29
+ ctx.config.global.activeServer = serverName;
30
+ }
31
+ serverConf
32
+ .setUrl(opt.relay)
33
+ .setAuthToken(data)
34
+ .save();
35
+ ctx.logger.info(`Registration successful. Relay: ${opt.relay} (${serverName})`);
36
+ });
37
+ cmd.extendUsage();
38
+ cmd.addExample('register', 'Register a new account against tunli.app');
39
+ cmd.addExample('register --relay https://api.myserver.com --name myrelay', 'Register against a self-hosted relay server');
40
+ cmd.addExample('register --force', 'Force re-registration and renew the auth token');
41
+ return cmd;
42
+ };
43
+ //# sourceMappingURL=CommandRegister.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandRegister.js","sourceRoot":"","sources":["../../../src/commands/CommandRegister/CommandRegister.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAmB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAEtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAY,EAAE,QAAiB,EAAE,EAAE;IAQvE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;SAChC,WAAW,CAAC,iDAAiD,CAAC;SAC9D,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,yDAAyD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpG,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,2EAA2E,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;SAC3J,SAAS,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,gFAAgF,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAEjK,GAAG,CAAC,MAAM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,CAAA;QAET,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,GAAG,CAAC,KAAK,KAAK,UAAU,GAAG,CAAC,CAAA;IACjF,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,WAAW,EAAE,CAAA;IACjB,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,0CAA0C,CAAC,CAAA;IACtE,GAAG,CAAC,UAAU,CAAC,0DAA0D,EAAE,6CAA6C,CAAC,CAAA;IACzH,GAAG,CAAC,UAAU,CAAC,kBAAkB,EAAE,gDAAgD,CAAC,CAAA;IAEpF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Context } from "#types/types";
2
+ import { Command } from "#commander/index";
3
+ export declare const createCommandRestart: (ctx: Context, _program: Command) => Command;
4
+ //# sourceMappingURL=CommandRestart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandRestart.d.ts","sourceRoot":"","sources":["../../../src/commands/CommandRestart/CommandRestart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAW,OAAO,EAAyC,MAAM,kBAAkB,CAAC;AAU3F,eAAO,MAAM,oBAAoB,GAAI,KAAK,OAAO,EAAE,UAAU,OAAO,YA+DnE,CAAA"}