untun
将您的本地 HTTP(s) 服务器隧道连接到全球!由 Cloudflare Quick Tunnels 提供支持。
将您的本地 HTTP(s) 服务器隧道连接到全球!
由 🔥 Cloudflare Quick Tunnels 提供支持,并被 👂 unjs/listhen 使用。
用法(CLI)
使用 npx
全局运行隧道
npx untun@latest tunnel https://:3000
◐ Starting cloudflared tunnel to https://:3000
ℹ Waiting for tunnel URL...
✔ Tunnel ready at https://unjs-is-awesome.trycloudflare.com
有关更多使用信息,请使用 npx untun tunnel --help
。
用法(API)
安装包
# npm
npm install untun
# yarn
yarn add untun
# pnpm
pnpm install untun
导入
// ESM
import { startTunnel } from "untun";
// CommonJS
const { startTunnel } = require("untun");
启动隧道
const tunnel = await startTunnel({ port: 3000 });
选项
url
- 默认值:
{protocol}://{hostname}:{port}
要隧道连接的本地服务器 URL。
port
- 默认值:
3000
本地服务器端口(仅在未提供 url
时生效)。
hostname
- 默认值:
localhost
本地服务器主机名(仅在未提供 url
时生效)。
protocol
- 默认值:
http
本地服务器协议(仅在未提供 url
时生效)。
verifyTLS
- 默认值:
false
验证本地服务器 TLS 证书。
acceptCloudflareNotice
- 默认值:
false
- 环境变量:
UNTUN_ACCEPT_CLOUDFLARE_NOTICE
默认接受 Cloudflare 服务条款。
开发
许可
用心制作 💛
根据 MIT 许可证 发布。
cloudflared 集成基于 JacobLinCool/node-cloudflared 的一个分支