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.
- package/CHANGELOG.md +45 -0
- package/README.md +158 -67
- package/bin/tunli +4 -5
- package/dist/api-client/ApiClient.d.ts +18 -0
- package/dist/api-client/ApiClient.d.ts.map +1 -0
- package/dist/api-client/ApiClient.js +100 -0
- package/dist/api-client/ApiClient.js.map +1 -0
- package/dist/api-client/types.d.ts +26 -0
- package/dist/api-client/types.d.ts.map +1 -0
- package/dist/api-client/types.js +2 -0
- package/dist/api-client/types.js.map +1 -0
- package/dist/api-client/utils.d.ts +4 -0
- package/dist/api-client/utils.d.ts.map +1 -0
- package/dist/api-client/utils.js +13 -0
- package/dist/api-client/utils.js.map +1 -0
- package/dist/cli-app/AppEventEmitter.d.ts +57 -0
- package/dist/cli-app/AppEventEmitter.d.ts.map +1 -0
- package/dist/cli-app/AppEventEmitter.js +11 -0
- package/dist/cli-app/AppEventEmitter.js.map +1 -0
- package/dist/cli-app/Dashboard.d.ts +4 -0
- package/dist/cli-app/Dashboard.d.ts.map +1 -0
- package/dist/cli-app/Dashboard.js +241 -0
- package/dist/cli-app/Dashboard.js.map +1 -0
- package/dist/cli-app/LiveLog.d.ts +4 -0
- package/dist/cli-app/LiveLog.d.ts.map +1 -0
- package/dist/cli-app/LiveLog.js +28 -0
- package/dist/cli-app/LiveLog.js.map +1 -0
- package/dist/cli-app/types.d.ts +10 -0
- package/dist/cli-app/types.d.ts.map +1 -0
- package/dist/cli-app/types.js +2 -0
- package/dist/cli-app/types.js.map +1 -0
- package/dist/cli-app/versionCheck.d.ts +4 -0
- package/dist/cli-app/versionCheck.d.ts.map +1 -0
- package/dist/cli-app/versionCheck.js +46 -0
- package/dist/cli-app/versionCheck.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +75 -0
- package/dist/client.js.map +1 -0
- package/dist/commander/Argument.d.ts +19 -0
- package/dist/commander/Argument.d.ts.map +1 -0
- package/dist/commander/Argument.js +25 -0
- package/dist/commander/Argument.js.map +1 -0
- package/dist/commander/Command.d.ts +23 -0
- package/dist/commander/Command.d.ts.map +1 -0
- package/dist/commander/Command.js +159 -0
- package/dist/commander/Command.js.map +1 -0
- package/dist/commander/InvalidArgumentError.d.ts +5 -0
- package/dist/commander/InvalidArgumentError.d.ts.map +1 -0
- package/dist/commander/InvalidArgumentError.js +8 -0
- package/dist/commander/InvalidArgumentError.js.map +1 -0
- package/dist/commander/Option.d.ts +15 -0
- package/dist/commander/Option.d.ts.map +1 -0
- package/dist/commander/Option.js +43 -0
- package/dist/commander/Option.js.map +1 -0
- package/dist/commander/index.d.ts +7 -0
- package/dist/commander/index.d.ts.map +1 -0
- package/dist/commander/index.js +5 -0
- package/dist/commander/index.js.map +1 -0
- package/dist/commander/types.d.ts +2 -0
- package/dist/commander/types.d.ts.map +1 -0
- package/dist/commander/types.js +2 -0
- package/dist/commander/types.js.map +1 -0
- package/dist/commands/CommandAuth/CommandAuth.d.ts +4 -0
- package/dist/commands/CommandAuth/CommandAuth.d.ts.map +1 -0
- package/dist/commands/CommandAuth/CommandAuth.js +24 -0
- package/dist/commands/CommandAuth/CommandAuth.js.map +1 -0
- package/dist/commands/CommandConfig/CommandConfig.d.ts +4 -0
- package/dist/commands/CommandConfig/CommandConfig.d.ts.map +1 -0
- package/dist/commands/CommandConfig/CommandConfig.js +37 -0
- package/dist/commands/CommandConfig/CommandConfig.js.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.d.ts +4 -0
- package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.d.ts.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.js +20 -0
- package/dist/commands/CommandConfig/sub-commands/configDeleteCommand.js.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configGetCommand.d.ts +5 -0
- package/dist/commands/CommandConfig/sub-commands/configGetCommand.d.ts.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configGetCommand.js +23 -0
- package/dist/commands/CommandConfig/sub-commands/configGetCommand.js.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configSetCommand.d.ts +4 -0
- package/dist/commands/CommandConfig/sub-commands/configSetCommand.d.ts.map +1 -0
- package/dist/commands/CommandConfig/sub-commands/configSetCommand.js +69 -0
- package/dist/commands/CommandConfig/sub-commands/configSetCommand.js.map +1 -0
- package/dist/commands/CommandConfig/types.d.ts +6 -0
- package/dist/commands/CommandConfig/types.d.ts.map +1 -0
- package/dist/commands/CommandConfig/types.js +2 -0
- package/dist/commands/CommandConfig/types.js.map +1 -0
- package/dist/commands/CommandConfig/utils/preparePrimaryOptions.d.ts +3 -0
- package/dist/commands/CommandConfig/utils/preparePrimaryOptions.d.ts.map +1 -0
- package/dist/commands/CommandConfig/utils/preparePrimaryOptions.js +8 -0
- package/dist/commands/CommandConfig/utils/preparePrimaryOptions.js.map +1 -0
- package/dist/commands/CommandConfig/utils/resolveConfig.d.ts +8 -0
- package/dist/commands/CommandConfig/utils/resolveConfig.d.ts.map +1 -0
- package/dist/commands/CommandConfig/utils/resolveConfig.js +33 -0
- package/dist/commands/CommandConfig/utils/resolveConfig.js.map +1 -0
- package/dist/commands/CommandConfig/utils/sharedOptions.d.ts +3 -0
- package/dist/commands/CommandConfig/utils/sharedOptions.d.ts.map +1 -0
- package/dist/commands/CommandConfig/utils/sharedOptions.js +14 -0
- package/dist/commands/CommandConfig/utils/sharedOptions.js.map +1 -0
- package/dist/commands/CommandDaemon/CommandDaemon.d.ts +4 -0
- package/dist/commands/CommandDaemon/CommandDaemon.d.ts.map +1 -0
- package/dist/commands/CommandDaemon/CommandDaemon.js +57 -0
- package/dist/commands/CommandDaemon/CommandDaemon.js.map +1 -0
- package/dist/commands/CommandDashboard/CommandDashboard.d.ts +4 -0
- package/dist/commands/CommandDashboard/CommandDashboard.d.ts.map +1 -0
- package/dist/commands/CommandDashboard/CommandDashboard.js +54 -0
- package/dist/commands/CommandDashboard/CommandDashboard.js.map +1 -0
- package/dist/commands/CommandHTTP/CommandHttp.d.ts +4 -0
- package/dist/commands/CommandHTTP/CommandHttp.d.ts.map +1 -0
- package/dist/commands/CommandHTTP/CommandHttp.js +50 -0
- package/dist/commands/CommandHTTP/CommandHttp.js.map +1 -0
- package/dist/commands/CommandInit/CommandInit.d.ts +4 -0
- package/dist/commands/CommandInit/CommandInit.d.ts.map +1 -0
- package/dist/commands/CommandInit/CommandInit.js +36 -0
- package/dist/commands/CommandInit/CommandInit.js.map +1 -0
- package/dist/commands/CommandList/CommandList.d.ts +4 -0
- package/dist/commands/CommandList/CommandList.d.ts.map +1 -0
- package/dist/commands/CommandList/CommandList.js +54 -0
- package/dist/commands/CommandList/CommandList.js.map +1 -0
- package/dist/commands/CommandLogs/CommandLogs.d.ts +4 -0
- package/dist/commands/CommandLogs/CommandLogs.d.ts.map +1 -0
- package/dist/commands/CommandLogs/CommandLogs.js +33 -0
- package/dist/commands/CommandLogs/CommandLogs.js.map +1 -0
- package/dist/commands/CommandProfile/CommandProfile.d.ts +5 -0
- package/dist/commands/CommandProfile/CommandProfile.d.ts.map +1 -0
- package/dist/commands/CommandProfile/CommandProfile.js +64 -0
- package/dist/commands/CommandProfile/CommandProfile.js.map +1 -0
- package/dist/commands/CommandRegister/CommandRegister.d.ts +4 -0
- package/dist/commands/CommandRegister/CommandRegister.d.ts.map +1 -0
- package/dist/commands/CommandRegister/CommandRegister.js +43 -0
- package/dist/commands/CommandRegister/CommandRegister.js.map +1 -0
- package/dist/commands/CommandRestart/CommandRestart.d.ts +4 -0
- package/dist/commands/CommandRestart/CommandRestart.d.ts.map +1 -0
- package/dist/commands/CommandRestart/CommandRestart.js +62 -0
- package/dist/commands/CommandRestart/CommandRestart.js.map +1 -0
- package/dist/commands/CommandServer/CommandServer.d.ts +4 -0
- package/dist/commands/CommandServer/CommandServer.d.ts.map +1 -0
- package/dist/commands/CommandServer/CommandServer.js +24 -0
- package/dist/commands/CommandServer/CommandServer.js.map +1 -0
- package/dist/commands/CommandStop/CommandStop.d.ts +4 -0
- package/dist/commands/CommandStop/CommandStop.d.ts.map +1 -0
- package/dist/commands/CommandStop/CommandStop.js +25 -0
- package/dist/commands/CommandStop/CommandStop.js.map +1 -0
- package/dist/commands/CommandUpdate/CommandUpdate.d.ts +4 -0
- package/dist/commands/CommandUpdate/CommandUpdate.d.ts.map +1 -0
- package/dist/commands/CommandUpdate/CommandUpdate.js +38 -0
- package/dist/commands/CommandUpdate/CommandUpdate.js.map +1 -0
- package/dist/commands/CommandUseProfile/CommandUseProfile.d.ts +4 -0
- package/dist/commands/CommandUseProfile/CommandUseProfile.d.ts.map +1 -0
- package/dist/commands/CommandUseProfile/CommandUseProfile.js +63 -0
- package/dist/commands/CommandUseProfile/CommandUseProfile.js.map +1 -0
- package/dist/commands/helper/Help.d.ts +4 -0
- package/dist/commands/helper/Help.d.ts.map +1 -0
- package/dist/commands/helper/Help.js +134 -0
- package/dist/commands/helper/Help.js.map +1 -0
- package/dist/commands/helper/Parser.d.ts +55 -0
- package/dist/commands/helper/Parser.d.ts.map +1 -0
- package/dist/commands/helper/Parser.js +280 -0
- package/dist/commands/helper/Parser.js.map +1 -0
- package/dist/commands/shared/allowDenyCidrCommand.d.ts +3 -0
- package/dist/commands/shared/allowDenyCidrCommand.d.ts.map +1 -0
- package/dist/commands/shared/allowDenyCidrCommand.js +10 -0
- package/dist/commands/shared/allowDenyCidrCommand.js.map +1 -0
- package/dist/commands/shared/configServersCommand.d.ts +4 -0
- package/dist/commands/shared/configServersCommand.d.ts.map +1 -0
- package/dist/commands/shared/configServersCommand.js +19 -0
- package/dist/commands/shared/configServersCommand.js.map +1 -0
- package/dist/commands/utils.d.ts +3 -0
- package/dist/commands/utils.d.ts.map +1 -0
- package/dist/commands/utils.js +17 -0
- package/dist/commands/utils.js.map +1 -0
- package/dist/config/ParsedConfig.d.ts +31 -0
- package/dist/config/ParsedConfig.d.ts.map +1 -0
- package/dist/config/ParsedConfig.js +116 -0
- package/dist/config/ParsedConfig.js.map +1 -0
- package/dist/config/ParsedGlobalConfig.d.ts +5 -0
- package/dist/config/ParsedGlobalConfig.d.ts.map +1 -0
- package/dist/config/ParsedGlobalConfig.js +7 -0
- package/dist/config/ParsedGlobalConfig.js.map +1 -0
- package/dist/config/ParsedLocalConfig.d.ts +5 -0
- package/dist/config/ParsedLocalConfig.d.ts.map +1 -0
- package/dist/config/ParsedLocalConfig.js +7 -0
- package/dist/config/ParsedLocalConfig.js.map +1 -0
- package/dist/config/ParsedProfileConfig.d.ts +46 -0
- package/dist/config/ParsedProfileConfig.d.ts.map +1 -0
- package/dist/config/ParsedProfileConfig.js +120 -0
- package/dist/config/ParsedProfileConfig.js.map +1 -0
- package/dist/config/ParsedServerConfig.d.ts +20 -0
- package/dist/config/ParsedServerConfig.d.ts.map +1 -0
- package/dist/config/ParsedServerConfig.js +55 -0
- package/dist/config/ParsedServerConfig.js.map +1 -0
- package/dist/config/TempProfileConfig.d.ts +8 -0
- package/dist/config/TempProfileConfig.d.ts.map +1 -0
- package/dist/config/TempProfileConfig.js +13 -0
- package/dist/config/TempProfileConfig.js.map +1 -0
- package/dist/config/utils.d.ts +2 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +8 -0
- package/dist/config/utils.js.map +1 -0
- package/dist/config/validations/validateProfileConfig.d.ts +4 -0
- package/dist/config/validations/validateProfileConfig.d.ts.map +1 -0
- package/dist/config/validations/validateProfileConfig.js +76 -0
- package/dist/config/validations/validateProfileConfig.js.map +1 -0
- package/dist/core/FS/utils.d.ts +12 -0
- package/dist/core/FS/utils.d.ts.map +1 -0
- package/dist/core/FS/utils.js +55 -0
- package/dist/core/FS/utils.js.map +1 -0
- package/dist/daemon/DaemonClient.d.ts +16 -0
- package/dist/daemon/DaemonClient.d.ts.map +1 -0
- package/dist/daemon/DaemonClient.js +158 -0
- package/dist/daemon/DaemonClient.js.map +1 -0
- package/dist/daemon/DaemonServer.d.ts +8 -0
- package/dist/daemon/DaemonServer.d.ts.map +1 -0
- package/dist/daemon/DaemonServer.js +201 -0
- package/dist/daemon/DaemonServer.js.map +1 -0
- package/dist/daemon/protocol.d.ts +101 -0
- package/dist/daemon/protocol.d.ts.map +1 -0
- package/dist/daemon/protocol.js +2 -0
- package/dist/daemon/protocol.js.map +1 -0
- package/dist/daemon-main.d.ts +2 -0
- package/dist/daemon-main.d.ts.map +1 -0
- package/dist/daemon-main.js +13 -0
- package/dist/daemon-main.js.map +1 -0
- package/dist/launcher-main.d.ts +2 -0
- package/dist/launcher-main.d.ts.map +1 -0
- package/dist/launcher-main.js +57 -0
- package/dist/launcher-main.js.map +1 -0
- package/dist/lib/Flow/applyUpdate.d.ts +3 -0
- package/dist/lib/Flow/applyUpdate.d.ts.map +1 -0
- package/dist/lib/Flow/applyUpdate.js +34 -0
- package/dist/lib/Flow/applyUpdate.js.map +1 -0
- package/dist/lib/Flow/downloadBinaryUpdate.d.ts +3 -0
- package/dist/lib/Flow/downloadBinaryUpdate.d.ts.map +1 -0
- package/dist/lib/Flow/downloadBinaryUpdate.js +54 -0
- package/dist/lib/Flow/downloadBinaryUpdate.js.map +1 -0
- package/dist/lib/Flow/getLatestVersion.d.ts +2 -0
- package/dist/lib/Flow/getLatestVersion.d.ts.map +1 -0
- package/dist/lib/Flow/getLatestVersion.js +13 -0
- package/dist/lib/Flow/getLatestVersion.js.map +1 -0
- package/dist/lib/defs.d.ts +18 -0
- package/dist/lib/defs.d.ts.map +1 -0
- package/dist/lib/defs.js +33 -0
- package/dist/lib/defs.js.map +1 -0
- package/dist/logger/logger.d.ts +6 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +34 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/output-formats/colors.d.ts +7 -0
- package/dist/output-formats/colors.d.ts.map +1 -0
- package/dist/output-formats/colors.js +8 -0
- package/dist/output-formats/colors.js.map +1 -0
- package/dist/output-formats/formatConfig.d.ts +3 -0
- package/dist/output-formats/formatConfig.d.ts.map +1 -0
- package/dist/output-formats/formatConfig.js +59 -0
- package/dist/output-formats/formatConfig.js.map +1 -0
- package/dist/output-formats/formatConfigPath.d.ts +4 -0
- package/dist/output-formats/formatConfigPath.d.ts.map +1 -0
- package/dist/output-formats/formatConfigPath.js +7 -0
- package/dist/output-formats/formatConfigPath.js.map +1 -0
- package/dist/output-formats/formatPath.d.ts +2 -0
- package/dist/output-formats/formatPath.d.ts.map +1 -0
- package/dist/output-formats/formatPath.js +6 -0
- package/dist/output-formats/formatPath.js.map +1 -0
- package/dist/output-formats/formatProfile.d.ts +3 -0
- package/dist/output-formats/formatProfile.d.ts.map +1 -0
- package/dist/output-formats/formatProfile.js +35 -0
- package/dist/output-formats/formatProfile.js.map +1 -0
- package/dist/output-formats/formatProfilesShort.d.ts +3 -0
- package/dist/output-formats/formatProfilesShort.d.ts.map +1 -0
- package/dist/output-formats/formatProfilesShort.js +19 -0
- package/dist/output-formats/formatProfilesShort.js.map +1 -0
- package/dist/output-formats/formatSaveResult.d.ts +4 -0
- package/dist/output-formats/formatSaveResult.d.ts.map +1 -0
- package/dist/output-formats/formatSaveResult.js +7 -0
- package/dist/output-formats/formatSaveResult.js.map +1 -0
- package/dist/output-formats/table.d.ts +8 -0
- package/dist/output-formats/table.d.ts.map +1 -0
- package/dist/output-formats/table.js +15 -0
- package/dist/output-formats/table.js.map +1 -0
- package/dist/package-json/packageJson.d.ts +6 -0
- package/dist/package-json/packageJson.d.ts.map +1 -0
- package/dist/package-json/packageJson.js +12 -0
- package/dist/package-json/packageJson.js.map +1 -0
- package/dist/proxy/Proxy.d.ts +6 -0
- package/dist/proxy/Proxy.d.ts.map +1 -0
- package/dist/proxy/Proxy.js +203 -0
- package/dist/proxy/Proxy.js.map +1 -0
- package/dist/sea-main.d.ts +2 -0
- package/dist/sea-main.d.ts.map +1 -0
- package/dist/sea-main.js +20 -0
- package/dist/sea-main.js.map +1 -0
- package/dist/types/types.d.ts +55 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/arrayFunctions.d.ts +24 -0
- package/dist/utils/arrayFunctions.d.ts.map +1 -0
- package/dist/utils/arrayFunctions.js +43 -0
- package/dist/utils/arrayFunctions.js.map +1 -0
- package/dist/utils/assertFunctions.d.ts +7 -0
- package/dist/utils/assertFunctions.d.ts.map +1 -0
- package/dist/utils/assertFunctions.js +20 -0
- package/dist/utils/assertFunctions.js.map +1 -0
- package/dist/utils/checkFunctions.d.ts +34 -0
- package/dist/utils/checkFunctions.d.ts.map +1 -0
- package/dist/utils/checkFunctions.js +87 -0
- package/dist/utils/checkFunctions.js.map +1 -0
- package/dist/utils/cliFunctions.d.ts +10 -0
- package/dist/utils/cliFunctions.d.ts.map +1 -0
- package/dist/utils/cliFunctions.js +68 -0
- package/dist/utils/cliFunctions.js.map +1 -0
- package/dist/utils/hashFunctions.d.ts +10 -0
- package/dist/utils/hashFunctions.d.ts.map +1 -0
- package/dist/utils/hashFunctions.js +11 -0
- package/dist/utils/hashFunctions.js.map +1 -0
- package/dist/utils/npmFunctions.d.ts +3 -0
- package/dist/utils/npmFunctions.d.ts.map +1 -0
- package/dist/utils/npmFunctions.js +28 -0
- package/dist/utils/npmFunctions.js.map +1 -0
- package/dist/utils/stringFunctions.d.ts +12 -0
- package/dist/utils/stringFunctions.d.ts.map +1 -0
- package/dist/utils/stringFunctions.js +37 -0
- package/dist/utils/stringFunctions.js.map +1 -0
- package/package.json +39 -16
- package/client.js +0 -33
- package/src/cli-app/Dashboard.js +0 -220
- package/src/cli-app/Screen/FullScreenModal.js +0 -63
- package/src/cli-app/Screen.js +0 -140
- package/src/cli-app/elements/ElementNode.js +0 -97
- package/src/cli-app/elements/Line.js +0 -21
- package/src/cli-app/elements/List/List.js +0 -227
- package/src/cli-app/elements/List/ListCell.js +0 -83
- package/src/cli-app/elements/List/ListColumn.js +0 -52
- package/src/cli-app/elements/List/ListRow.js +0 -118
- package/src/cli-app/elements/Row.js +0 -38
- package/src/cli-app/helper/utils.js +0 -42
- package/src/commands/Action/addDelValuesAction.js +0 -56
- package/src/commands/CommandAuth.js +0 -32
- package/src/commands/CommandClearAll.js +0 -27
- package/src/commands/CommandConfig.js +0 -59
- package/src/commands/CommandHTTP.js +0 -192
- package/src/commands/CommandInvite.js +0 -38
- package/src/commands/CommandRefresh.js +0 -35
- package/src/commands/CommandRegister.js +0 -48
- package/src/commands/Option/DeleteOption.js +0 -6
- package/src/commands/Option/ProfileListOption.js +0 -65
- package/src/commands/Option/SelectConfigOption.js +0 -52
- package/src/commands/SubCommand/AllowDenyCidrCommand.js +0 -28
- package/src/commands/SubCommand/HostCommand.js +0 -22
- package/src/commands/SubCommand/PortCommand.js +0 -20
- package/src/commands/SubCommand/ProtocolCommand.js +0 -21
- package/src/commands/helper/AliasResolver.js +0 -13
- package/src/commands/helper/BindArgs.js +0 -53
- package/src/commands/helper/SharedArg.js +0 -32
- package/src/commands/utils.js +0 -96
- package/src/config/ConfigAbstract.js +0 -353
- package/src/config/ConfigManager.js +0 -70
- package/src/config/GlobalConfig.js +0 -14
- package/src/config/GlobalLocalShardConfigAbstract.js +0 -98
- package/src/config/LocalConfig.js +0 -7
- package/src/config/PropertyConfig.js +0 -122
- package/src/config/SystemConfig.js +0 -31
- package/src/core/FS/utils.js +0 -60
- package/src/core/Ref.js +0 -70
- package/src/lib/Flow/getCurrentIp.js +0 -18
- package/src/lib/Flow/getLatestVersion.js +0 -13
- package/src/lib/Flow/proxyUrl.js +0 -35
- package/src/lib/Flow/validateAuthToken.js +0 -19
- package/src/lib/HttpClient.js +0 -61
- package/src/lib/Proxy.js +0 -42
- package/src/lib/defs.js +0 -13
- package/src/net/IPV4.js +0 -139
- package/src/net/http/IncomingMessage.js +0 -92
- package/src/net/http/ServerResponse.js +0 -126
- package/src/net/http/TunliRequest.js +0 -1
- package/src/net/http/TunliResponse.js +0 -1
- package/src/net/http/TunnelRequest.js +0 -229
- package/src/net/http/TunnelResponse.js +0 -119
- package/src/tunnel-client/TunnelClient.js +0 -144
- package/src/utils/arrayFunctions.js +0 -45
- package/src/utils/checkFunctions.js +0 -182
- package/src/utils/cliFunctions.js +0 -63
- package/src/utils/createRequest.js +0 -12
- package/src/utils/hashFunctions.js +0 -9
- package/src/utils/httpFunction.js +0 -23
- package/src/utils/npmFunctions.js +0 -27
- package/src/utils/stringFunctions.js +0 -59
- package/types/index.d.ts +0 -119
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes duplicate elements from an array.
|
|
3
|
-
* @param {any[]} value - The array from which to remove duplicates.
|
|
4
|
-
* @returns {any[]|null} - A new array with unique elements, or null if the input is not an array.
|
|
5
|
-
*/
|
|
6
|
-
export const arrayUnique = (value) => {
|
|
7
|
-
if (!Array.isArray(value)) {
|
|
8
|
-
return null
|
|
9
|
-
}
|
|
10
|
-
return Array.from(new Set(value))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @template A
|
|
15
|
-
* @template B
|
|
16
|
-
* Merges two arrays into one.
|
|
17
|
-
* @param {A[]} arr1 - The first array.
|
|
18
|
-
* @param {B[]} arr2 - The second array.
|
|
19
|
-
* @returns {[A, B]} - A new array containing elements from both input arrays.
|
|
20
|
-
*/
|
|
21
|
-
export const arrayMerge = (arr1, arr2) => {
|
|
22
|
-
arr1 ??= []
|
|
23
|
-
arr2 ??= []
|
|
24
|
-
return [...arr1, ...arr2]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Subtracts elements of the second array from the first array.
|
|
29
|
-
* @param {any[]} arr1 - The array from which to subtract elements.
|
|
30
|
-
* @param {any[]} arr2 - The array containing elements to subtract.
|
|
31
|
-
* @returns {any[]} - A new array containing elements from arr1 that are not in arr2.
|
|
32
|
-
*/
|
|
33
|
-
export const arraySub = (arr1, arr2) => {
|
|
34
|
-
arr1 ??= []
|
|
35
|
-
arr2 ??= []
|
|
36
|
-
return arr1.filter(x => !arr2.includes(x))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const arrayRemoveEntry = (array, search) => {
|
|
40
|
-
const delPos = array.indexOf(search)
|
|
41
|
-
if (delPos > -1) {
|
|
42
|
-
array = [...array.slice(0, delPos), ...array.slice(delPos + 1)]
|
|
43
|
-
}
|
|
44
|
-
return array
|
|
45
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import {InvalidArgumentError} from "commander"
|
|
2
|
-
import {ipV4} from "#src/net/IPV4";
|
|
3
|
-
import {isSharedArg} from "#commands/helper/SharedArg";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Validate and format an IPv4 address with CIDR notation.
|
|
7
|
-
* This function checks if the provided value is a valid IPv4 address with or without CIDR suffix.
|
|
8
|
-
* If valid, it returns the address formatted with its CIDR suffix.
|
|
9
|
-
* If invalid, it throws an InvalidArgumentError with an appropriate message.
|
|
10
|
-
*
|
|
11
|
-
* @param {string} value - The IPv4 address (with or without CIDR) to validate.
|
|
12
|
-
* @returns {string} - The validated and formatted IPv4 address with CIDR suffix.
|
|
13
|
-
* @throws {InvalidArgumentError} - If the IPv4 address is not valid.
|
|
14
|
-
*/
|
|
15
|
-
export const checkIpV4Cidr = (value) => {
|
|
16
|
-
const val = ipV4(value)
|
|
17
|
-
if (!val.isValid) {
|
|
18
|
-
throw new InvalidArgumentError('The provided value must be a valid IPv4 address, with or without CIDR notation.')
|
|
19
|
-
}
|
|
20
|
-
return `${val}/${val.cidrSuffix}`
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the value is an integer.
|
|
24
|
-
* @param {any} value - The value to check.
|
|
25
|
-
* @param {string} [errorMessage='Value must be an integer'] - The error message to throw if validation fails.
|
|
26
|
-
* @returns {number} - The validated integer.
|
|
27
|
-
* @throws {InvalidArgumentError} - If the value is not a valid integer.
|
|
28
|
-
*/
|
|
29
|
-
export const checkInt = (value, errorMessage = 'Value must be an integer') => {
|
|
30
|
-
value = value.toString()
|
|
31
|
-
|
|
32
|
-
if (!/^\d+$/.test(value)) {
|
|
33
|
-
throw new InvalidArgumentError(errorMessage);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return parseInt(value)
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Checks if the value is a valid URL.
|
|
40
|
-
* @param {string} value - The value to check.
|
|
41
|
-
* @returns {string} - The validated URL.
|
|
42
|
-
* @throws {InvalidArgumentError} - If the value is not a valid URL.
|
|
43
|
-
*/
|
|
44
|
-
export const checkUrl = (value) => {
|
|
45
|
-
try {
|
|
46
|
-
return new URL(value).toString()
|
|
47
|
-
} catch (e) {
|
|
48
|
-
throw new InvalidArgumentError('Invalid URL')
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Checks if the value is a valid host.
|
|
53
|
-
* @param {Ref|*} valueOrSharedArg - The value or shared argument to check.
|
|
54
|
-
* @param {boolean} [isArgument=false] - Whether the value is an argument.
|
|
55
|
-
* @param {*} [value] - The value to check.
|
|
56
|
-
* @returns {string} - The validated host.
|
|
57
|
-
* @throws {InvalidArgumentError} - If the value is not a valid host.
|
|
58
|
-
*/
|
|
59
|
-
export const checkHost = (valueOrSharedArg, isArgument = false, value) => {
|
|
60
|
-
if (isSharedArg(valueOrSharedArg)) {
|
|
61
|
-
const {url, host} = valueOrSharedArg.value
|
|
62
|
-
if (url) {
|
|
63
|
-
throw new InvalidArgumentError('You must not set a host if the port argument is a URL')
|
|
64
|
-
} else if (host) {
|
|
65
|
-
throw new InvalidArgumentError('You must not set a host argument if the host option has been set')
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
value = valueOrSharedArg
|
|
69
|
-
valueOrSharedArg = undefined
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const check = new URL('http://localhost')
|
|
73
|
-
check.hostname = value
|
|
74
|
-
|
|
75
|
-
if (check.hostname !== value.toLowerCase()) {
|
|
76
|
-
throw new InvalidArgumentError('Invalid host');
|
|
77
|
-
}
|
|
78
|
-
if (isSharedArg(valueOrSharedArg) && !isArgument) {
|
|
79
|
-
valueOrSharedArg.value.host = check.host
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return check.host
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Checks if the value is a valid port.
|
|
86
|
-
* @param {Ref|*} valueOrSharedArg - The value or shared argument to check.
|
|
87
|
-
* @param {boolean} [isArgument=false] - Whether the value is an argument.
|
|
88
|
-
* @param {*} [value] - The value to check.
|
|
89
|
-
* @returns {number|Ref} - The validated port or shared argument with port.
|
|
90
|
-
* @throws {InvalidArgumentError} - If the value is not a valid port.
|
|
91
|
-
*/
|
|
92
|
-
export const checkPort = (valueOrSharedArg, isArgument = false, value) => {
|
|
93
|
-
const handleUrlArg = (value) => {
|
|
94
|
-
try {
|
|
95
|
-
const url = new URL(value)
|
|
96
|
-
|
|
97
|
-
let port = url.port
|
|
98
|
-
const protocol = url.protocol.substring(0, url.protocol.length - 1)
|
|
99
|
-
|
|
100
|
-
if (!port) {
|
|
101
|
-
if (protocol === 'http') {
|
|
102
|
-
port = 80
|
|
103
|
-
} else if (protocol === 'https') {
|
|
104
|
-
port = 443
|
|
105
|
-
}
|
|
106
|
-
url.port = port.toString()
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
valueOrSharedArg.value.url = {
|
|
110
|
-
protocol,
|
|
111
|
-
host: url.hostname,
|
|
112
|
-
port: parseInt(port)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return port
|
|
116
|
-
} catch (e) {
|
|
117
|
-
return null
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let portFromUrl
|
|
122
|
-
|
|
123
|
-
if (isSharedArg(valueOrSharedArg)) {
|
|
124
|
-
const {url, port, host} = valueOrSharedArg.value
|
|
125
|
-
portFromUrl = isArgument ? handleUrlArg(value) : null
|
|
126
|
-
|
|
127
|
-
if (host && portFromUrl) {
|
|
128
|
-
throw new InvalidArgumentError('You must not set a URL as port argument if the host option is already set')
|
|
129
|
-
} else if (port) {
|
|
130
|
-
if (portFromUrl) {
|
|
131
|
-
throw new InvalidArgumentError('You must not set a port option if the port argument is a URL')
|
|
132
|
-
}
|
|
133
|
-
throw new InvalidArgumentError('You must not set a port option if the port argument is set')
|
|
134
|
-
} else if (url) {
|
|
135
|
-
if (port) {
|
|
136
|
-
throw new InvalidArgumentError('You must not set a port option if the port argument is a URL')
|
|
137
|
-
}
|
|
138
|
-
throw new InvalidArgumentError('Unexpected: You must not set a port argument')
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
value = portFromUrl ?? value
|
|
142
|
-
} else {
|
|
143
|
-
value = valueOrSharedArg
|
|
144
|
-
valueOrSharedArg = undefined
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
value = checkInt(value, 'Port must be a valid integer')
|
|
148
|
-
|
|
149
|
-
if (value > 65535) {
|
|
150
|
-
throw new InvalidArgumentError('Port exceeds maximum value of 65535');
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (isSharedArg(valueOrSharedArg)) {
|
|
154
|
-
if (!portFromUrl) {
|
|
155
|
-
valueOrSharedArg.value.port = value
|
|
156
|
-
}
|
|
157
|
-
return valueOrSharedArg
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return value
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const checkProtocol = (value) => {
|
|
164
|
-
return checkInArray(value, ['http', 'https'])
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export const checkInArray = (val, arr) => {
|
|
168
|
-
if (!arr.includes(val)) {
|
|
169
|
-
throw new InvalidArgumentError(`Value must be one of (${arr.join(', ')})`)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return val
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export const checkMd5 = (hash) => {
|
|
176
|
-
|
|
177
|
-
if (!hash?.match(/^[0-9a-f]{32}$/i)) {
|
|
178
|
-
throw new InvalidArgumentError(`Value is not a valid md5 hash`)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return hash.toLowerCase()
|
|
182
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {argv, stdout} from 'node:process';
|
|
2
|
-
import EventEmitter from "node:events";
|
|
3
|
-
import {spawn} from "child_process";
|
|
4
|
-
|
|
5
|
-
export const setCursorVisibility = (visible) => {
|
|
6
|
-
if (visible) {
|
|
7
|
-
stdout.write('\x1B[?25h');
|
|
8
|
-
} else {
|
|
9
|
-
stdout.write('\x1B[?25l');
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const clearTerminal = () => {
|
|
14
|
-
stdout.write('\x1B[2J\x1B[0f');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Runs a child process and proxies its output.
|
|
20
|
-
* @param {string} pathToExecutable - Relative or absolute path to the executable script
|
|
21
|
-
* @param {array} [proxyArguments=process.argv.slice(2)] - Arguments to pass to the child process (default: process arguments)
|
|
22
|
-
* @returns {Promise<number|null>} - Exit code of the child process
|
|
23
|
-
*/
|
|
24
|
-
export const proxyChildProcess = (pathToExecutable, proxyArguments = argv.slice(2)) => {
|
|
25
|
-
|
|
26
|
-
const eventEmitter = new EventEmitter()
|
|
27
|
-
const createSpawnProcessPromise = () => {
|
|
28
|
-
const onError = (error) => {
|
|
29
|
-
eventEmitter.emit('close', 1)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const onClose = (code) => {
|
|
33
|
-
if (code === null) {
|
|
34
|
-
clearTerminal()
|
|
35
|
-
}
|
|
36
|
-
eventEmitter.emit('close', code)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const onMessage = (message) => {
|
|
40
|
-
if (message === 'restart') {
|
|
41
|
-
child.off('close', onClose)
|
|
42
|
-
child.kill()
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
eventEmitter.emit('spawn')
|
|
45
|
-
}, 10)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const child = spawn('node', [pathToExecutable, ...proxyArguments], {
|
|
50
|
-
stdio: ['inherit', 'inherit', 'inherit', 'ipc'] // Proxy standard output and error to the main process, enable IPC channel
|
|
51
|
-
})
|
|
52
|
-
.on('close', onClose)
|
|
53
|
-
.on('error', onError)
|
|
54
|
-
.on('message', onMessage)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
eventEmitter.on('spawn', () => createSpawnProcessPromise(pathToExecutable))
|
|
58
|
-
|
|
59
|
-
return new Promise((resolve) => {
|
|
60
|
-
eventEmitter.once('close', resolve)
|
|
61
|
-
eventEmitter.emit('spawn')
|
|
62
|
-
})
|
|
63
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {Socket} from "socket.io-client";
|
|
2
|
-
import {IncomingRequest} from "#lib/Tunnel/IncomingRequest";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {IncomingSocketIoRequest} incomingSocketIoRequest
|
|
6
|
-
* @param {RequestId} requestId
|
|
7
|
-
* @param {Socket} socket
|
|
8
|
-
* @returns {IncomingRequest}
|
|
9
|
-
*/
|
|
10
|
-
export const createRequestFromSocketIoRequest = (incomingSocketIoRequest, requestId, socket) => {
|
|
11
|
-
return new IncomingRequest(incomingSocketIoRequest, requestId, socket)
|
|
12
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {IncomingMessage} from "#src/net/http/IncomingMessage"
|
|
2
|
-
import {Socket} from "socket.io-client"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Retrieves the remote address from the request headers.
|
|
6
|
-
* @param {http.IncomingMessage|SocketIoRawRequestObject} request - The incoming HTTP or Socket.IO request object.
|
|
7
|
-
* @return {string} - The remote address.
|
|
8
|
-
*/
|
|
9
|
-
export const getRemoteAddress = (request) => {
|
|
10
|
-
return request.headers['x-real-ip']
|
|
11
|
-
?? request.headers['x-forwarded-for']
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Creates an IncomingMessage instance from a raw Socket.IO request object.
|
|
16
|
-
* @param {SocketIoRawRequestObject} req - The raw Socket.IO request object.
|
|
17
|
-
* @param {string} requestId - The unique request identifier.
|
|
18
|
-
* @param {Socket} socket - The socket associated with the request.
|
|
19
|
-
* @return {IncomingMessage} - The created IncomingMessage instance.
|
|
20
|
-
*/
|
|
21
|
-
export const createRequestFromRaw = (req, requestId, socket) => {
|
|
22
|
-
return new IncomingMessage(req, requestId, socket)
|
|
23
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {exec} from 'child_process';
|
|
2
|
-
import {dirname, join} from 'path';
|
|
3
|
-
|
|
4
|
-
export const checkGlobalInstallation = (packageName) => {
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
exec(`npm list -g --depth=0 ${packageName}`, (error, stdout, stderr) => {
|
|
7
|
-
if (stdout.includes(packageName)) {
|
|
8
|
-
resolve(true)
|
|
9
|
-
} else {
|
|
10
|
-
resolve(false)
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const checkLocalInstallation = (packageName) => {
|
|
17
|
-
const localPath = join(process.cwd(), 'node_modules', packageName)
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
exec(`npm list --depth=0 ${packageName}`, {cwd: dirname(process.argv[1])}, (error, stdout, stderr) => {
|
|
20
|
-
if (stdout.includes(localPath)) {
|
|
21
|
-
resolve(true)
|
|
22
|
-
} else {
|
|
23
|
-
resolve(false)
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export const trimEnd = (string, trimChar = ' ') => {
|
|
2
|
-
const regex = new RegExp(`${trimChar}+$`)
|
|
3
|
-
return string.replace(regex, '')
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const trimStart = (string, trimChar) => {
|
|
7
|
-
const regex = new RegExp(`^${trimChar}+`)
|
|
8
|
-
return string.replace(regex, '')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const removeControlChars = (string) => {
|
|
12
|
-
const removeControlCharsRegex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g
|
|
13
|
-
return string.replace(removeControlCharsRegex, '')
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const padEndIgnoreControlChars = (string, maxLength, fillString = ' ', autoSubstring = false) => {
|
|
17
|
-
|
|
18
|
-
if (maxLength < 0) {
|
|
19
|
-
return string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const stringWithoutCC = removeControlChars(string)
|
|
23
|
-
|
|
24
|
-
if (autoSubstring !== false && stringWithoutCC.length > maxLength) {
|
|
25
|
-
if (autoSubstring !== true) {
|
|
26
|
-
return stringWithoutCC.substring(0, maxLength - autoSubstring.length) + autoSubstring
|
|
27
|
-
} else {
|
|
28
|
-
return stringWithoutCC.substring(0, maxLength)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const padding = ''.padEnd(maxLength - stringWithoutCC.length, fillString)
|
|
33
|
-
return `${string}${padding}`
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Replaces template placeholders in a string with corresponding values from a replacements object.
|
|
38
|
-
*
|
|
39
|
-
* @param {string} template - The string containing placeholders in the format {{ placeholder }}.
|
|
40
|
-
* @param {object} replacements - The object containing replacement values. Nested placeholders can be accessed using dot notation.
|
|
41
|
-
*/
|
|
42
|
-
export const replaceTemplatePlaceholders = (template, replacements) => {
|
|
43
|
-
|
|
44
|
-
return template.replace(/{{\s*([^{}|]+)\s*(\|[^{}]+)*\s*}}/ig, (match, placeholder) => {
|
|
45
|
-
|
|
46
|
-
placeholder = placeholder.trim()
|
|
47
|
-
const keys = placeholder.split('.')
|
|
48
|
-
|
|
49
|
-
let value = replacements
|
|
50
|
-
for (const part of keys) {
|
|
51
|
-
if (!value) {
|
|
52
|
-
break
|
|
53
|
-
}
|
|
54
|
-
value = value [part]
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return value ?? ''
|
|
58
|
-
})
|
|
59
|
-
}
|
package/types/index.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {Socket} from 'socket.io-client';
|
|
2
|
-
|
|
3
|
-
export interface Headers {
|
|
4
|
-
|
|
5
|
-
host: string
|
|
6
|
-
|
|
7
|
-
[name: string]: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type RequestMethod = "GET" | "POST" | "PATCH" | "DELETE" | "HEAD" | "OPTION" | "PUT"
|
|
11
|
-
|
|
12
|
-
export type RequestId = string
|
|
13
|
-
|
|
14
|
-
export type IncomingSocketIoRequest = {
|
|
15
|
-
method: RequestMethod
|
|
16
|
-
headers: Headers
|
|
17
|
-
path: string
|
|
18
|
-
port: number
|
|
19
|
-
hostname: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type SocketIoRawRequestObject = {
|
|
23
|
-
method: RequestMethod
|
|
24
|
-
headers: Headers
|
|
25
|
-
path: string
|
|
26
|
-
requestId?: string
|
|
27
|
-
tunnelSocket?: Socket
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type cliListOption = {
|
|
31
|
-
maxLength?: number
|
|
32
|
-
minLength?: number
|
|
33
|
-
length?: number
|
|
34
|
-
reverse?: boolean
|
|
35
|
-
minWidth?: number | Array<number | string | boolean>
|
|
36
|
-
maxWidth?: number | Array<number | string | boolean>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type profileDump = {}
|
|
40
|
-
export type proxyURL = string
|
|
41
|
-
export type profileConfig = {
|
|
42
|
-
system: {}
|
|
43
|
-
profile: {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface ConfigAbstract {
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface AppConfig {
|
|
50
|
-
|
|
51
|
-
protocol: protocol
|
|
52
|
-
port: number
|
|
53
|
-
host: string
|
|
54
|
-
authToken: string
|
|
55
|
-
proxyURL: proxyURL
|
|
56
|
-
proxyURLs: proxyURL[]
|
|
57
|
-
path: undefined
|
|
58
|
-
origin: string
|
|
59
|
-
denyCidr?: ipCidr[]
|
|
60
|
-
allowCidr?: ipCidr[]
|
|
61
|
-
|
|
62
|
-
get fallbackConfig(): AppConfig
|
|
63
|
-
|
|
64
|
-
get profileData(): profileConfig
|
|
65
|
-
|
|
66
|
-
get configPath(): string
|
|
67
|
-
|
|
68
|
-
get profile(): profileAlias
|
|
69
|
-
|
|
70
|
-
copyCurrentProfileTo(profile: profileAlias): this
|
|
71
|
-
|
|
72
|
-
save(): this
|
|
73
|
-
|
|
74
|
-
update(value: { [p: string]: any }): this
|
|
75
|
-
|
|
76
|
-
useSystem(): AppConfig
|
|
77
|
-
|
|
78
|
-
use(profile: profileAlias): AppConfig
|
|
79
|
-
|
|
80
|
-
del(configKey: string): AppConfig
|
|
81
|
-
|
|
82
|
-
copyCurrentProfileTo(profile: profileAlias): this
|
|
83
|
-
|
|
84
|
-
dump(): profileDump
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export type protocol = "http" | "https"
|
|
88
|
-
export type ipCidr = string
|
|
89
|
-
export type profileAlias = string
|
|
90
|
-
export type tunnelClientOptions = {
|
|
91
|
-
protocol: protocol
|
|
92
|
-
self: boolean
|
|
93
|
-
port: number
|
|
94
|
-
host: string
|
|
95
|
-
authToken: string
|
|
96
|
-
server: proxyURL
|
|
97
|
-
path?: string
|
|
98
|
-
origin?: string
|
|
99
|
-
save?: profileAlias | true
|
|
100
|
-
denyCidr?: ipCidr[]
|
|
101
|
-
allowCidr?: ipCidr[]
|
|
102
|
-
allowSelf?: ipCidr[]
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type keypressEventDetails = {
|
|
106
|
-
sequence: string
|
|
107
|
-
name: string
|
|
108
|
-
ctrl: boolean
|
|
109
|
-
meta: boolean
|
|
110
|
-
shift: boolean
|
|
111
|
-
full: string
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface keypressEventListener {
|
|
115
|
-
(char: string, details: keypressEventDetails): void
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
export type tunliProxyOptions = {}
|