# qydny **Repository Path**: fullstackclub/qydny ## Basic Information - **Project Name**: qydny - **Description**: 乾坤大挪移 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-09-07 - **Last Updated**: 2022-11-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 乾坤大挪移 ## 安装 ``` npm i git+https://git.oschina.net/goodidea/qydny.git -g ``` ## 使用 首先要在中转服务器上启动 Master , 在目标服务器(或可直接访问到目标服务器的同子网服务器)上开启 Proxy。 Proxy 会在中转服务器上申请一个新端口,映射给目标服务器。 用真正的客户端发请求给中转服务器的新端口,从而实现访问目标服务器。 Options: -V, --version output the version number -m Master 模式,在服务端执行。 -p Proxy 模式,在目标端执行。 --pwd (必填) Master 的口令。 --mport Master 监听的端口。默认 10000 --mip (Proxy 必填) Master 的 ip。 --lip (Proxy 选填) 目标服务的 ip。默认 localhost --lport (Proxy 必填) 目标服务监听的端口。 --rport (Proxy 必填) 映射到远程的端口。 -h, --help output usage information ### Master 模式 ``` node src/index.js -m --pwd qiankundanuoyi ``` ### Proxy 模式 ``` node src/index.js -p --pwd qiankundanuoyi --mip localhost --lport 33333 --rport 18848 ``` ## 说明 基础通信格式 4 字节长度后跟数据。数据必须是 json 字符串。 应用在数据量并发量不大、数据时序性要求不高的场景。 长链接维持心跳包 Master 和 Proxy 都是: 1. 每 15 秒,如果没有收到数据,就发送一次 Ping。 2. 收到 Ping 的马上回复 Pong。 3. 60 秒没有收到任何东西,则主动断开链接。