npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@feng3d/cts

v0.0.20

Published

**cts** 是 **穿透服务器**(Chuantou Server)的缩写。

Readme

@feng3d/cts

cts穿透服务器(Chuantou Server)的缩写。

内网穿透转发系统的服务端,负责接收公网请求并转发给内网客户端。

特性

  • 三通道架构:WebSocket 控制通道 + TCP 二进制数据通道 + UDP 数据通道
  • 每个代理端口同时支持 HTTP/WebSocket/TCP/UDP 四种协议,自动识别协议类型
  • 控制端口复用:同一端口处理 WebSocket 控制连接、TCP 数据通道和 UDP 数据通道
  • 动态端口分配
  • 自动心跳检测
  • 多客户端支持
  • Token 认证
  • TLS 加密支持
  • 开机自启动
  • Web 状态监控

快速开始

推荐使用 npx 直接运行,无需全局安装:

# 启动服务器
npx @feng3d/cts start -p 9000 -t "my-token"

# 查询状态
npx @feng3d/cts status

# 停止服务器
npx @feng3d/cts stop

命令说明

start - 启动服务器

npx @feng3d/cts start [选项]

常用示例:

# 默认配置启动
npx @feng3d/cts start

# 指定端口和 token
npx @feng3d/cts start -p 9000 -t "my-token"

# 多个 token(逗号分隔)
npx @feng3d/cts start -p 9000 -t "token1,token2,token3"

# 完整参数示例
npx @feng3d/cts start -p 9000 -a 0.0.0.0 -t "my-token" --heartbeat-interval 30000 --session-timeout 60000

# 启动后打开浏览器监控页面
npx @feng3d/cts start -p 9000 -t "my-token" --open

# 不注册开机自启动
npx @feng3d/cts start --no-boot

参数说明:

| 参数 | 说明 | 默认值 | |------|------|--------| | -p, --port <port> | 控制端口 | 9000 | | -a, --host <address> | 监听地址 | 0.0.0.0 | | -t, --tokens <tokens> | 认证令牌(逗号分隔) | - | | --tls-key <path> | TLS 私钥文件路径 | - | | --tls-cert <path> | TLS 证书文件路径 | - | | --heartbeat-interval <ms> | 心跳间隔(毫秒) | 30000 | | --session-timeout <ms> | 会话超时(毫秒) | 60000 | | -o, --open | 启动后在浏览器中打开状态页面 | - | | --no-boot | 不注册开机自启动 | - |

status - 查询服务器状态

npx @feng3d/cts status

输出示例:

穿透服务器状态
  运行中: 是
  主机: 0.0.0.0:9000
  TLS: 已禁用
  运行时长: 3600秒
  客户端: 2
  端口: 4
  连接数: 12
  开机自启: 已注册

stop - 停止服务器

npx @feng3d/cts stop

停止服务器并取消开机自启动。

Web 状态监控

服务器启动后,可以通过浏览器访问状态监控页面:

http://127.0.0.1:9000/

状态页面显示:

  • 服务器运行状态(运行中/已停止)
  • 监听地址和端口
  • 运行时长
  • 已认证客户端数量
  • 已注册端口数量
  • 活跃连接数
  • TLS 状态
  • 客户端会话列表
  • 每 3 秒自动刷新

使用 --open 参数启动时可自动打开浏览器:

npx @feng3d/cts start --open

多 Token 配置

支持配置多个认证令牌,允许不同的客户端使用各自的令牌连接:

# 三个客户端使用不同的 token
npx @feng3d/cts start -t "client1-token,client2-token,client3-token"

每个客户端连接时使用对应的 token 即可认证成功。

架构

控制端口(复用):
  ├─ WebSocket 控制通道 ── JSON 消息(认证/注册/心跳/连接通知)
  ├─ TCP 数据通道 ─────── 二进制帧(HTTP/WS/TCP 数据转发)
  └─ UDP 数据通道 ─────── UDP 数据帧(UDP 数据转发)

代理端口(每端口同时监听 TCP + UDP):
  ├─ TCP 服务器 → 自动识别 HTTP/WebSocket/TCP 协议
  └─ UDP 服务器 → 转发 UDP 数据

每个代理端口同时支持 HTTP/WebSocket/TCP/UDP 四种协议,客户端无需指定协议类型。

许可证

ISC