使用 Cloudflare 快速隧道将您的本地 HTTP(s) 服务器连接到全球!
[![npm 版本][npm-version-src]][npm-version-href] [![npm 下载量][npm-downloads-src]][npm-downloads-href] [![bundle][bundle-src]][bundle-href] [![许可证][license-src]][license-href] 将您的本地 HTTP(s) 服务器隧道到全球! 由 Cloudflare 快速隧道 提供支持,并由 unjs/listhen 使用。
使用 npx 在全球运行隧道:
npx untun@latest tunnel http://localhost:3000◐ Starting cloudflared tunnel to http://localhost:3000
ℹ Waiting for tunnel URL...
✔ Tunnel ready at https://unjs-is-awesome.trycloudflare.com要了解更多使用信息,请使用 npx untun tunnel --help。
安装包:
# 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。port3000本地服务器端口(仅当 url 未提供时生效)。
hostnamelocalhost本地服务器主机名(仅当 url 未提供时生效)。
protocolhttp本地服务器协议(仅当 url 未提供时生效)。
verifyTLSfalse验证本地服务器 TLS 证书。
暂无开放 Issues,或尚未同步最近议题。