@easytunnel/et-sdk

中文文档
1.6.8发布于 2026/11/13MITCommonJS零依赖构建来源已验证近 30 天下载 2574

Expose local services to the internet in one line of code: instant public HTTPS URLs with automatic TLS, through NAT and firewalls, no signup. Webhook-friendly ngrok-style reverse tunnel, with SDKs in 20 languages and a single-binary Go server.

原始使用文档
文档目录6 节
  1. Install
  2. CLI
  3. Embed
  4. Environment variables
  5. License
  6. Service terms

etunnel for Node.js

npm

Expose a local service through an etunnel reverse-tunnel server. Zero dependencies (Node >= 22 built-in WebSocket).

Zero registration: every SDK client speaks the same tiny wire protocol (PROTOCOL.md) against any etunnel server (default wss://t.etun.uk/tunnel).

Install

npm install @easytunnel/et-sdk

Requires Node >= 22.

CLI

npx @easytunnel/et-sdk 3000

Prints TUNNEL_URL: https://<subdomain>.t.etun.uk — that URL now routes to your local service. Ctrl-C closes the tunnel.

Reconnects automatically. If the connection drops (including a server restart) the CLI re-dials with exponential backoff (500ms → 30s, ±20% jitter, reset on success) and prints TUNNEL_URL: again. The subdomain is reclaimed, not re-randomised: the client replays the server's signed resumeToken in hello.resume, so links already shared keep working (the server needs a stable SESSION_SECRET; see PROTOCOL.md §1). Set ETUNNEL_RECONNECT=0 to restore the old one-shot behaviour.

Embed

const { connect } = require('@easytunnel/et-sdk');
const t = await connect('wss://t.etun.uk/tunnel', 3000);
console.log(t.url);

connect(server, local, opts) takes an optional third argument: token, subdomain, resume (strings), and wsFactory — a (serverUrl) => WebSocket constructor injection used instead of the global WebSocket (the CLI passes a factory that captures the socket it creates). Library embedders with their own WebSocket implementation or per-connection sockets should inject wsFactory; the global is never patched.

Environment variables

VariableMeaningDefault
ETUNNEL_SERVERtunnel server WebSocket URLwss://t.etun.uk/tunnel
ETUNNEL_LOCALlocal port or host:port (or 1st CLI arg)3000
ETUNNEL_TOKENpaid-plan API key (optional)-
ETUNNEL_RECONNECT0 disables auto-reconnect (one-shot CLI)enabled
ETUNNEL_SUBDOMAINcustom subdomain (paid plans)random

License

MIT — see LICENSE. Buffer-based protocol client: request and response bodies are buffered per stream (fine for webhooks/dashboards/demos; use the Go SDK for streaming and WebSocket pass-through).

Service terms

Use of the etunnel relay service (default wss://t.etun.uk/tunnel) is governed by its Terms of Service and Privacy Policy.

版本与发布记录

@easytunnel/et-sdk 共发布 20 个版本,首次发布于 2026/11/08;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.6.8latest2026/11/13今天
1.6.72026/11/13今天
1.6.62026/11/13今天
1.6.52026/11/121 天前
1.6.42026/11/121 天前
1.6.32026/11/121 天前

关于 @easytunnel/et-sdk 的常见问题

@easytunnel/et-sdk 是什么?

Expose local services to the internet in one line of code: instant public HTTPS URLs with automatic TLS, through NAT and firewalls, no signup. Webhook-friendly ngrok-style reverse tunnel, with SDKs in 20 languages and a single-binary Go server.

如何安装 @easytunnel/et-sdk?

在项目目录运行 npm install @easytunnel/et-sdk,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 etunnel,可以用 npx etunnel 直接运行。

@easytunnel/et-sdk 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/easytunnel__et-sdk 是否存在。

@easytunnel/et-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@easytunnel/et-sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@easytunnel/et-sdk 可以商用吗?

@easytunnel/et-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@easytunnel/et-sdk 的下载量有多少?

根据 npm 官方下载统计,@easytunnel/et-sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,574 次,日均约 86 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@easytunnel/et-sdk 还在维护吗?

最新版本 1.6.8 发布于 2026/11/13(今天);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/11/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。