用途
cli-tunnel 用于在命令行中管理隧道连接。它支持启动和停止隧道,隧道类型包括 ngrok、Cloudflare 以及自定义隧道。借助该工具,用户可以检查当前活动的隧道 URL、配置认证信息,并测试外部可达性。
cli-tunnel 属于 omniroute 项目(来源 diegosouzapw/omniroute)。
安装
通过 npm 全局安装:
npm install -g omniroute # or: npx omniroute
omniroute --version
也可以使用 npx omniroute 直接运行。
主要命令
工具以 tunnel 为入口,提供以下子命令:
tunnel:基础隧道命令,示例:omniroute tunneltunnel list:列出隧道。支持参数--json,示例:omniroute tunnel listtunnel create [type]:创建指定类型的隧道,示例:omniroute tunnel create [type]tunnel stop <type>:停止指定类型的隧道。支持参数--yes,示例:omniroute tunnel stop <type>tunnel status <type>:查看指定类型隧道的状态。支持参数--json,示例:omniroute tunnel status <type>tunnel logs <type>:查看指定类型隧道的日志。支持参数--tail <n>,示例:omniroute tunnel logs <type>tunnel info <type>:查看指定类型隧道的信息。支持参数--json,示例:omniroute tunnel info <type>tunnel rotate <type>:轮换指定类型的隧道。支持参数--yes,示例:omniroute tunnel rotate <type>
使用方式
安装后通过 omniroute CLI 调用 tunnel 及其子命令,按需传入隧道类型和各子命令支持的参数。支持 --json 输出的子命令便于进行程序化处理,--yes 用于跳过确认,--tail <n> 用于控制日志显示行数。
适用场景
需要在命令行中统一管理多种隧道服务、查看隧道状态与日志、获取活动隧道 URL、配置认证并验证外部可达性的场景。
限制
关于支持的隧道类型完整列表、认证配置的具体方式、外部可达性测试的具体机制,以及各子命令的详细行为,资料中未提供,暂未明确。