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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cros

v1.0.1

Published

* ### tcp内网穿透 * ### http内网穿透 * ### 其他功能暂时不想开发

Downloads

3,916

Readme

cros 内网穿透工具

现阶段工具支持功能

  • tcp内网穿透

  • http内网穿透

  • 其他功能暂时不想开发

项目说明

  • 项目分为服务端和客户端
  • 服务端 为部署在公网服务器的一端接收整个请求
  • 客户端 为部署在用户内网中,转发公网过来的请求,路由到指定服务
  • 项目可以采用如下两种方式部署
  • 一、采用脚手架部署客户端和服务端
  • npm install cros -g
  • 运行服务端 cros server serverConfig.json
  • serverConfig.json 是服务端的配置文件路径,具体配置在下面
  • 运行客户端 cros client clientConfig.json
  • clientConfig.json 是服务端的配置文件路径,具体配置在下面
  • 二、采用源码方式部署客户端和服务端
  • 项目clone下来 git clone https://github.com/zhihuihu/cros.git
  • 执行 npm install
  • 然后配置一下文件,分为服务端和客户端

服务端nginx配置(如果需要域名穿透)

# node内网穿透
server {
  listen 80;
  # 泛型域名
  server_name *.crosn.aaa.com;
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host:80;
    proxy_set_header X-Nginx-Proxy true;
    proxy_set_header Connection "";
    # 服务端配置的http的端口
    proxy_pass http://127.0.0.1:7101/;
  }
}

server.config配置

* 服务端启动 node ./server/server.js 或者脚手架启动 cros server serverConfig.json *
{
  // 服务开启的tcp端口供服务端和客户端通信
  "bindPort": 8080,
  // 服务支持http内网穿透的端口
  "bindHttpPort": 8081,
  // 客户端连接认证的token
  "token": "12345676788",
  // 通过域名内网穿透的基础域名
  "subdomainHost": "huzhihui.com"
}

client.json配置

* 客户端启动 node ./client/client.js 或者脚手架启动 cros client clientConfig.json *
{
  // 服务端的IP地址
  "serverIp": "127.0.0.1",
  // 服务端的tcp端口
  "serverPort": 8080,
  // 认证的token
  "token": "12345676788",
  // 需要绑定的穿透服务
  "registers": [
    // tcp端口穿透
    {
      // 穿透类型
      "type": "tcp",
      // 外网暴露端口
      "port": 8082,
      // 内网服务IP
      "localIp": "192.168.8.11",
      // 内网服务端口
      "localPort": 58001
    },
    {
      // 穿透类型
      "type": "http",
      // 外网暴露子域名 需要和 subdomainHost 拼接在一起才是完整域名
      "subdomain": "cos",
      // 内网服务IP
      "localIp": "192.168.8.11",
      // 内网服务端口
      "localPort": 58001
    }
  ]
}
* registers中可以配置多个{},穿透多个不同的服务 *
* 采用tcp方式最后访问地址是  serverIp:port 如 106.12.3.22:8082 *
* 采用http方式最后访问地址是   subdomain.subdomainHost 如  cos.huzhihui.com *