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

@cppupu/tcpmapping

v2.0.0

Published

TCP端口转发服务器,支持多端口映射、WebUI管理界面和实时连接监控

Readme

TCP转发服务器

一个功能强大、安全可靠的TCP端口转发服务器,支持多端口映射、WebUI管理界面和实时连接监控。

功能特性

核心功能

  • TCP协议端口转发 - 将TCP请求转发到后端服务器
  • 多端口映射配置 - 同时支持多个端口转发规则
  • 动态配置管理 - 通过WebUI实时添加/删除/启动/停止端口映射
  • 连接监控 - 实时显示每个映射的连接数和流量统计

WebUI管理界面

  • 现代化响应式Web界面
  • 实时系统状态监控(映射数、连接数、运行时间)
  • 每个端口映射的连接数和流量统计
  • 映射的启动/停止控制

安全特性

  • 强密码策略(8字符+大小写+数字)
  • 登录失败保护(5次失败锁定30分钟)
  • 会话管理(24小时自动超时)
  • bcrypt 12轮密码哈希加密
  • 自动生成的Session Secret

快速开始

安装

# 安装依赖
npm install

# 设置管理员密码
npm run setup-password

# 启动服务器
npm start

访问

启动后访问 http://localhost:9999 进入管理界面。

配置说明

编辑 config.json 配置端口映射:

{
  "mappings": [
    {
      "name": "服务名称",
      "listen": { "host": "0.0.0.0", "port": 8080 },
      "target": { "host": "192.168.1.100", "port": 3000 }
    }
  ],
  "webui": { "enabled": true, "port": 9999, "host": "0.0.0.0" },
  "logging": { "enabled": true, "level": "info" }
}

项目结构

├── server.js           # 主服务器
├── config.json         # 端口映射配置
├── auth-config.json    # 认证配置(敏感)
├── setup-password.js   # 密码设置工具
├── package.json        # 项目配置
├── .gitignore          # Git忽略规则
├── public/             # Web界面
│   ├── login.html      # 登录页面
│   └── dashboard.html  # 管理面板
└── docs/               # 文档目录
    ├── API.md          # API接口文档
    ├── 功能总结.md      # 功能清单
    └── 安全配置说明.md  # 安全指南

API接口

详细API文档请参阅 docs/API.md

主要接口:

  • GET /api/health - 健康检查(无需认证)
  • POST /api/login - 登录
  • GET /api/mappings - 获取映射列表(含连接数统计)
  • POST /api/mappings - 添加映射
  • PUT /api/mappings/:id - 更新映射
  • DELETE /api/mappings/:id - 删除映射
  • POST /api/mappings/:id/start - 启动映射
  • POST /api/mappings/:id/stop - 停止映射
  • GET /api/connections - 获取连接状态
  • GET /api/status - 获取系统状态

技术栈

  • 后端: Node.js, Express.js, bcryptjs
  • 前端: 原生HTML/CSS/JavaScript
  • 安全: bcrypt密码哈希, Session管理

许可证

MIT License