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/chuantou-client

v0.0.5

Published

内网穿透转发系统的客户端,运行在内网机器上,将本地服务暴露到公网。

Readme

@feng3d/chuantou-client

内网穿透转发系统的客户端,运行在内网机器上,将本地服务暴露到公网。

特性

  • WebSocket 控制通道
  • 自动重连机制
  • HTTP/HTTPS 代理
  • WebSocket 代理
  • 多代理支持

安装

npm install @feng3d/chuantou-client

使用

作为独立服务运行

# 使用默认配置
chuantou-client

# 指定服务器地址
chuantou-client --server ws://your-server.com:9000

# 指定认证令牌
chuantou-client --token your-token

# 指定代理配置
chuantou-client --proxies "8080:http:3000:localhost,8081:ws:3001"

# 使用配置文件
chuantou-client --config /path/to/config.json

作为库使用

import { Controller, ProxyManager } from '@feng3d/chuantou-client';

const config = {
  serverUrl: 'ws://your-server.com:9000',
  token: 'your-token',
  proxies: [
    { remotePort: 8080, protocol: 'http', localPort: 3000, localHost: 'localhost' },
    { remotePort: 8081, protocol: 'websocket', localPort: 3001, localHost: 'localhost' }
  ]
};

const controller = new Controller(config);
const proxyManager = new ProxyManager(controller);

await controller.connect();

配置

命令行参数

| 参数 | 说明 | 默认值 | |------|------|--------| | --config | 配置文件路径 | ~/.chuantou/client.json | | --server | 服务器地址 | ws://localhost:9000 | | --token | 认证令牌 | jidexiugaio | | --proxies | 代理配置 | 8080:http:3000:localhost,8081:ws:3001 |

代理配置格式

remotePort:protocol:localPort:localHost
  • remotePort - 公网端口
  • protocol - 协议类型 (httpws)
  • localPort - 本地端口
  • localHost - 本地地址(可选,默认 localhost)

示例:

  • 8080:http:3000:localhost - 将公网 8080 端口的 HTTP 请求转发到本地 3000 端口
  • 8081:ws:3001 - 将公网 8081 端口的 WebSocket 连接转发到本地 3001 端口

配置文件

配置文件路径:~/.chuantou/client.json

{
  "serverUrl": "ws://your-server.com:9000",
  "token": "your-token",
  "reconnectInterval": 5000,
  "maxReconnectAttempts": 10,
  "proxies": [
    { "remotePort": 8080, "protocol": "http", "localPort": 3000, "localHost": "localhost" },
    { "remotePort": 8081, "protocol": "websocket", "localPort": 3001, "localHost": "localhost" }
  ]
}

工作流程

  1. 客户端连接到服务器
  2. 发送认证令牌
  3. 注册代理服务(指定公网端口和本地服务)
  4. 保持心跳连接
  5. 接收服务器的转发请求,转发到本地服务
  6. 将本地服务的响应返回给服务器

断线重连

客户端具有自动重连功能,当与服务器的连接断开时,会自动尝试重新连接。

许可证

ISC