Compare commits

...
20 Commits
Author SHA1 Message Date
刘河 0819afc9da version 2019-03-03 23:17:45 +08:00
刘河 eecf1c6c69 Key bug 2019-03-03 23:15:47 +08:00
刘河 9428457487 Readme 2019-03-03 07:38:15 +08:00
刘河 f3e90f146d readme error page 2019-03-03 07:28:50 +08:00
刘河 7bf54b608d Rate bug 2019-03-02 22:57:05 +08:00
刘河 496d9f52f9 no message 2019-03-02 21:56:11 +08:00
刘河 d97b18f51f config 2019-03-02 21:49:43 +08:00
刘河 037e7b28f1 Public key add bug 2019-03-02 20:56:57 +08:00
刘河 b3660c3b8d web display bug 2019-03-02 20:45:55 +08:00
刘河 cbc3bd2afe Clear bug 2019-03-02 20:12:58 +08:00
刘河 5fc51f40a7 iamge 2019-03-02 18:12:11 +08:00
刘河 fbbd4bace2 http post large file bug 2019-02-27 13:02:34 +08:00
刘河 0492268190 Secret mode add bug 2019-02-25 20:25:23 +08:00
刘河 01fca7d568 nps test bug 2019-02-25 16:41:10 +08:00
刘河 0711b9befb Start link clean 2019-02-25 14:39:48 +08:00
刘河 2c13a02bdc conn limit bug 2019-02-25 13:55:10 +08:00
刘河 6788f24821 npc file load bug 2019-02-25 10:20:46 +08:00
刘河 e65ab33749 Clean bug 2019-02-24 16:51:54 +08:00
he liu 7f94b3871a Update client.go 2019-02-24 16:43:26 +08:00
he liu aa5b869da9 Update bridge.go 2019-02-24 16:42:53 +08:00
10 changed files with 499 additions and 204 deletions
+180 -180
View File
@@ -1,12 +1,8 @@
# nps
![](https://img.shields.io/github/stars/cnlh/nps.svg) ![](https://img.shields.io/github/forks/cnlh/nps.svg) ![](https://img.shields.io/github/license/cnlh/nps.svg)
nps是一款轻量级、高性能、功能强大的**内网穿透**代理服务器。目前支持**tcp、udp流量转发**,可支持任何tcp、udp上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析等等……),此外还**支持内网http代理、内网socks5代理**,可实现在非内网环境下如同使用vpn一样访问内网资源和设备的效果。
nps是一款轻量级、高性能、功能强大的**内网穿透**代理服务器。目前支持**tcp、udp流量转发**,可支持任何**tcp、udp**上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析等等……),此外还**支持内网http代理、内网socks5代理**、**p2p等**,并带有功能强大的web管理端。
目前市面上提供类似服务的有花生壳、TeamView、GoToMyCloud等等,但要使用第三方的公网服务器就必须为第三方付费,并且这些服务都有各种各样的限制,此外,由于数据包会流经第三方,因此对数据安全也是一大隐患。
go语言编写,无第三方依赖,各个平台都已经编译在release中。
## 背景
![image](https://github.com/cnlh/nps/blob/master/image/web.png?raw=true)
@@ -28,6 +24,16 @@ go语言编写,无第三方依赖,各个平台都已经编译在release中
* [安装](#安装)
* [编译安装](#源码安装)
* [release安装](#release安装)
* [使用示例(以web主控模式为主)](#使用示例)
* [统一准备工作](#统一准备工作)
* [http|https域名解析](#域名解析)
* [内网ssh连接即tcp隧道](#tcp隧道)
* [内网dns解析即udp隧道](#udp隧道)
* [内网socks5代理](#socks5代理)
* [内网http正向代理](#http正向代理)
* [内网安全私密代理](#私密代理)
* [p2p穿透](#p2p服务)
* [简单的内网文件访问服务](#文件访问模式)
* [服务端](#web管理模式)
* [服务端启动](#服务端启动)
* [服务端测试](#服务端测试)
@@ -35,13 +41,7 @@ go语言编写,无第三方依赖,各个平台都已经编译在release中
* [web管理](#web管理)
* [服务端停止或重启](#服务端停止或重启)
* [配置文件说明](#服务端配置文件)
* [详细使用说明](#详细说明)
* [http|https域名解析](#域名解析)
* [tcp隧道](#tcp隧道)
* [udp隧道](#udp隧道)
* [socks5代理](#socks5代理)
* [http正向代理](#http正向代理)
* [私密代理](#私密代理)
* [使用https](#使用https)
* [与nginx配合](#与nginx配合)
* [关闭http|https代理](#关闭代理)
@@ -121,6 +121,135 @@ go语言编写,无第三方依赖,各个平台都已经编译在release中
> go build cmd/npc/npc.go
## 使用示例
### 统一准备工作(必做)
- 开启服务端,假设公网服务器ip为1.1.1.1,配置文件中`bridgePort`为8284,配置文件中`httpport`为8080
- 访问1.1.1.1:8080
- 在客户端管理中创建一个客户端,记录下验证密钥
- 内网客户端运行(windows使用cmd运行加.exe)
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
### 域名解析
**适用范围:** 小程序开发、微信公众号开发、产品演示
**假设场景:**
- 有一个域名proxy.com,有一台公网机器ip为1.1.1.1
- 两个内网开发站点127.0.0.1:81,127.0.0.1:82
- 想通过(http|https://)a.proxy.com访问127.0.0.1:81,通过(http|https://)b.proxy.com访问127.0.0.1:82
**使用步骤**
- 将*.proxy.com解析到公网服务器1.1.1.1
- 点击刚才创建的客户端的域名管理,添加两条规则规则:1、域名:`a.proxy.com`,内网目标:`127.0.0.1:81`,2、域名:`b.proxy.com`,内网目标:`127.0.0.1:82`
现在访问(http|https://)`a.proxy.com`,`b.proxy.com`即可成功
**https:** 如需使用https请在配置文件中将https端口设置为443,和将对应的证书文件路径添加到配置文件中,上面添加的这条记录将会把http、https都转发到内网目标
### tcp隧道
**适用范围:** ssh、远程桌面等tcp连接场景
**假设场景:**
想通过访问公网服务器1.1.1.1的8001端口,连接内网机器10.1.50.101的22端口,实现ssh连接
**使用步骤**
- 在刚才创建的客户端隧道管理中添加一条tcp隧道,填写监听的端口(8001)、内网目标ip和目标端口(10.1.50.101:22),保存。
- 访问公网服务器ip(1.1.1.1),填写的监听端口(8001),相当于访问内网ip(10.1.50.101):目标端口(22),例如:`ssh -p 8001 root@1.1.1.1`
### udp隧道
**适用范围:** 内网dns解析等udp连接场景
**假设场景:**
内网有一台dns(10.1.50.102:53),在非内网环境下想使用该dns,公网服务器为1.1.1.1
**使用步骤**
- 在刚才创建的客户端的隧道管理中添加一条udp隧道,填写监听的端口(53)、内网目标ip和目标端口(10.1.50.102:53),保存。
- 修改需要使用的内网dns为127.0.0.1,则相当于使用10.1.50.202作为dns服务器
### socks5代理
**适用范围:** 在外网环境下如同使用vpn一样访问内网设备或者资源
**假设场景:**
想将公网服务器1.1.1.1的8003端口作为socks5代理,达到访问内网任意设备或者资源的效果
**使用步骤**
- 在刚才创建的客户端隧道管理中添加一条socks5代理,填写监听的端口(8003),保存。
- 在外网环境的本机配置socks5代理,ip为公网服务器ip(1.1.1.1),端口为填写的监听端口(8003),即可畅享内网了
### http正向代理
**适用范围:** 在外网环境下使用http正向代理访问内网站点
**假设场景:**
想将公网服务器1.1.1.1的8004端口作为http代理,访问内网网站
**使用步骤**
- 在刚才创建的客户端隧道管理中添加一条http代理,填写监听的端口(8004),保存。
- 在外网环境的本机配置http代理,ip为公网服务器ip(1.1.1.1),端口为填写的监听端口(8004),即可访问了
### 私密代理
**适用范围:** 无需占用多余的端口、安全性要求较高可以防止其他人连接的tcp服务,例如ssh。
**假设场景:**
无需新增多的端口实现访问内网服务器10.1.50.2的22端口
**使用步骤**
- 在刚才创建的客户端中添加一条私密代理,并设置唯一密钥和内网目标10.1.50.2:22
- 在需要连接ssh的机器上以配置文件模式启动客户端,内容如下
```ini
[common]
server=1.1.1.1:8284
tp=tcp
vkey=123
[secret_ssh]
password=1111
port=1000
```
**注意:** secret前缀必须存在,password为web管理上添加的唯一密钥
假设用户名为root,现在执行`ssh -p 1000 root@127.0.0.1`即可访问ssh
### p2p服务
**适用范围:** 大流量传输场景,流量不经过公网服务器,但是由于p2p穿透和nat类型关系较大,成功率一般,可穿透所有非对称型nat。
**假设场景:**
内网1机器ip为10.1.50.2 内网2机器ip为10.2.50.2
想通过访问机器1的2001端口---->访问到内网2机器的22端口
**使用步骤**
- 在`nps.conf`中设置`serverIp`和`p2pPort`
- 在刚才刚才创建的客户端中添加一条p2p代理,并设置唯一密钥p2pssh
- 在需要连接的机器上(即机器1)以配置文件模式启动客户端,内容如下
```ini
[common]
server=1.1.1.1:8284
tp=tcp
vkey=123
[p2p_ssh]
password=p2pssh
port=2001
```
**注意:** p2p前缀必须存在,password为web管理上添加的唯一密钥
假设机器2用户名为root,现在在机器1上执行`ssh -p 2001 root@127.0.0.1`即可访问机器2的ssh
## web管理模式
![image](https://github.com/cnlh/nps/blob/master/image/web2.png?raw=true)
@@ -180,161 +309,6 @@ cryptKey | 获取服务端authKey时的aes加密密钥,16位
serverIp| 服务端Ip,使用p2p模式必填
p2pPort|p2p模式开启的udp端口
### 详细说明
#### 域名解析
**适用范围:** 小程序开发、微信公众号开发、产品演示
**假设场景:**
- 有一个域名proxy.com,有一台公网机器ip为1.1.1.1
- 两个内网开发站点127.0.0.1:81,127.0.0.1:82
- 想通过(http|https://)a.proxy.com访问127.0.0.1:81,通过(http|https://)b.proxy.com访问127.0.0.1:82
- 例如配置文件中bridgePort为8284
**使用步骤**
- 将*.proxy.com解析到公网服务器1.1.1.1
- 在客户端管理中创建一个客户端,记录下验证密钥
- 点击该客户端的域名管理,添加两条规则规则:1、域名:`a.proxy.com`,内网目标:`127.0.0.1:81`,2、域名:`b.proxy.com`,内网目标:`127.0.0.1:82`
- 内网客户端运行
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
现在访问(http|https://)`a.proxy.com`,`b.proxy.com`即可成功
**https:** 如需使用https请在配置文件中将https端口设置为443,和将对应的证书文件路径添加到配置文件中,上面添加的这条记录将会把http、https都转发到内网目标
#### tcp隧道
**适用范围:** ssh、远程桌面等tcp连接场景
**假设场景:**
想通过访问公网服务器1.1.1.1的8001端口,连接内网机器10.1.50.101的22端口,实现ssh连接,例如配置文件中bridgePort为8284
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- -内网客户端运行
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 在该客户端隧道管理中添加一条tcp隧道,填写监听的端口(8001)、内网目标ip和目标端口(10.1.50.101:22),选择压缩方式,保存。
- 访问公网服务器ip(127.0.0.1),填写的监听端口(8001),相当于访问内网ip(10.1.50.101):目标端口(22),例如:`ssh -p 8001 root@1.1.1.1`
#### udp隧道
**适用范围:** 内网dns解析等udp连接场景
**假设场景:**
内网有一台dns(10.1.50.102:53),在非内网环境下想使用该dns,公网服务器为1.1.1.1,例如配置文件中bridgePort为8284
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- -内网客户端运行
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 在该客户端的隧道管理中添加一条udp隧道,填写监听的端口(53)、内网目标ip和目标端口(10.1.50.102:53),选择压缩方式,保存。
- 修改本机dns为127.0.0.1,则相当于使用10.1.50.202作为dns服务器
#### socks5代理
**适用范围:** 在外网环境下如同使用vpn一样访问内网设备或者资源
**假设场景:**
想将公网服务器1.1.1.1的8003端口作为socks5代理,达到访问内网任意设备或者资源的效果,例如配置文件中bridgePort为8284
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- -内网客户端运行
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 在该客户端隧道管理中添加一条socks5代理,填写监听的端口(8003),验证用户名和密码自行选择(建议先不填,部分客户端不支持,proxifer支持),选择压缩方式,保存。
- 在外网环境的本机配置socks5代理,ip为公网服务器ip(127.0.0.1),端口为填写的监听端口(8003),即可畅享内网了
#### http正向代理
**适用范围:** 在外网环境下使用http代理访问内网站点
**假设场景:**
想将公网服务器1.1.1.1的8004端口作为http代理,访问内网网站,例如配置文件中bridgePort为8284
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- -内网客户端运行
```shell
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 在该客户端隧道管理中添加一条http代理,填写监听的端口(8004),选择压缩方式,保存。
- 在外网环境的本机配置http代理,ip为公网服务器ip(127.0.0.1),端口为填写的监听端口(8004),即可访问了
#### 私密代理
**适用范围:** 无需占用多余的端口、安全性要求较高可以防止其他人连接的TCP服务,例如ssh。
**假设场景:**
无需新增多的端将映射内网服务器10.1.50.2的22端口,公网服务器ip为1.1.1.1,网桥端口为8284
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- 内网客户端运行
```
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 添加一条私密代理,并设置唯一密钥和内网目标10.1.50.2:22
- 在需要连接ssh的机器上以配置文件模式启动客户端,内容如下
```ini
[common]
server=1.1.1.1:8284
tp=tcp
vkey=123
[secret_ssh]
password=1111
port=1000
```
**注意:** secret前缀必须存在,password为web管理上添加的唯一密钥
假设用户名为root,现在执行`ssh -p 1000 root@127.0.0.1`即可访问ssh
#### p2p服务
**适用范围:** 大流量传输场景,流量不经过公网服务器,但是由于p2p穿透和nat类型关系较大,成功率不高。
**假设场景:**
内网1机器ip为10.1.50.2 内网2机器ip为10.2.50.2 口,公网服务器ip为1.1.1.1,网桥端口为8284
想通过访问机器1的2001端口---->访问到内网2机器的22端口
**使用步骤**
- 在客户端管理中创建一个客户端,记录下验证密钥
- 内网机器2客户端运行
```
./npc -server=1.1.1.1:8284 -vkey=客户端的密钥
```
- 添加一条p2p代理,并设置唯一密钥p2pssh
- 在需要连接的机器上(即机器1)以配置文件模式启动客户端,内容如下
```ini
[common]
server=1.1.1.1:8284
tp=tcp
vkey=123
[p2p_ssh]
password=p2pssh
port=2001
```
**注意:** p2p前缀必须存在,password为web管理上添加的唯一密钥
假设机器2用户名为root,现在执行`ssh -p 2001 root@127.0.0.1`即可访问机器2的ssh
### 使用https
在配置文件中将httpsProxyPort设置为443或者其他你想配置的端口,和将对应的证书文件路径添加到配置文件中,然后就和http代理一样了,例如
@@ -413,12 +387,12 @@ web上可以自定义客户端连接的密钥,但是必须具有唯一性
### 客户端启动
#### 无配置文件模式
此模式的各种配置在服务端web管理中完成
此模式的各种配置在服务端web管理中完成,客户端除运行一条命令外无需任何其他设置
```
./npc -server=ip:port -vkey=web界面中显示的密钥
```
#### 配置文件模式
此模式使用nps的公钥验证,各种配置在客户端完成,同时服务端web也可以进行管理
此模式使用nps的公钥或者客户端私钥验证,各种配置在客户端完成,同时服务端web也可以进行管理
```
./npc -config=npc配置文件路径
```
@@ -427,12 +401,12 @@ web上可以自定义客户端连接的密钥,但是必须具有唯一性
##### 全局配置
```ini
[common]
server=127.0.0.1:8284
server=1.1.1.1:8284
tp=tcp
vkey=123
username=111
password=222
compress=snappy
compress=true
crypt=true
rate_limit=10000
flow_limit=100
@@ -446,7 +420,7 @@ tp | 与服务端通信模式(tcp或kcp)
vkey|服务端配置文件中的密钥(非web)
username|socks5或http(s)密码保护用户名(可忽略)
username|socks5或http(s)密码保护密码(可忽略)
compress|是否压缩传输(snappy或空或忽略)
compress|是否压缩传输(true或false或忽略)
crypt|是否加密传输(true或false或忽略)
rate_limit|速度限制,可忽略
flow_limit|流量限制,可忽略
@@ -455,8 +429,11 @@ max_conn|最大连接数,可忽略
##### 域名代理
```ini
[common]
server=1.1.1.1:8284
vkey=123
[web1]
host=a.o.com
host=a.proxy.com
target=127.0.0.1:8080,127.0.0.1:8082
host_change=www.proxy.com
header_set_proxy=nps
@@ -472,8 +449,11 @@ header_xxx|请求header修改或添加,header_proxy表示添加header proxy:np
##### tcp隧道模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[tcp]
mode=tcpServer
mode=tcp
target=127.0.0.1:8080
port=9001
```
@@ -486,8 +466,11 @@ target|内网目标
##### udp隧道模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[udp]
mode=udpServer
mode=udp
target=127.0.0.1:8080
port=9002
```
@@ -499,8 +482,11 @@ target|内网目标
##### http代理模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[http]
mode=httpProxyServer
mode=httpProxy
port=9003
```
项 | 含义
@@ -510,8 +496,11 @@ port | 在服务端的代理端口
##### socks5代理模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[socks5]
mode=socks5Server
mode=socks5
port=9004
```
项 | 含义
@@ -521,6 +510,9 @@ port | 在服务端的代理端口
##### 私密代理模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[secret_ssh]
mode=secret
password=ssh2
@@ -528,13 +520,16 @@ target=10.1.50.2:22
```
项 | 含义
---|---
mode | secretServer
mode | secret
password | 唯一密钥
target|内网目标
##### p2p代理模式
```ini
[common]
server=1.1.1.1:8284
vkey=123
[p2p_ssh]
mode=p2p
password=ssh2
@@ -546,10 +541,14 @@ mode | p2p
password | 唯一密钥
target|内网目标
##### 文件访问模式
利用nps提供一个公网可访问的本地文件服务
利用nps提供一个公网可访问的本地文件服务,此模式仅客户端使用配置文件模式方可启动
```ini
[common]
server=1.1.1.1:8284
vkey=123
[file]
mode=file
port=9100
@@ -778,7 +777,7 @@ time为有效小时数,例如time=2,在当前时间后的两小时内,本
![image](https://github.com/cnlh/nps/blob/master/image/cpu2.png?raw=true)
### 额外消耗连接数
为了最大化的提升效率和并发,客户端与服务端之间仅两条tcp连接,减少建立连接的时间消耗和多余tcp连接对机器性能的影响。
为了最大化的提升效率和并发,客户端与服务端之间仅两条tcp连接,减少建立连接的时间消耗和多余socket连接对机器性能的影响。
## webAPI
@@ -813,6 +812,7 @@ POST /auth/getauthkey
[webAPI文档](https://github.com/cnlh/nps/wiki/webAPI%E6%96%87%E6%A1%A3)
## 贡献
#### **欢迎参与到制作docker、图标、文档翻译等工作**
- 如果遇到bug可以直接提交至dev分支
- 使用遇到问题可以通过issues反馈
- 项目处于开发阶段,还有很多待完善的地方,如果可以贡献代码,请提交 PR 至 dev 分支
+16 -13
View File
@@ -321,7 +321,7 @@ func (s *Bridge) ping() {
s.clientLock.Lock()
arr := make([]int, 0)
for k, v := range s.Client {
if v.tunnel == nil {
if v.tunnel == nil || v.signal == nil {
v.retryTime += 1
if v.retryTime >= 3 {
arr = append(arr, k)
@@ -344,7 +344,7 @@ func (s *Bridge) ping() {
//get config and add task from client config
func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
var fail bool
loop:
for {
flag, err := c.ReadFlag()
if err != nil {
@@ -353,12 +353,12 @@ func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
switch flag {
case common.WORK_STATUS:
if b, err := c.GetShortContent(32); err != nil {
break
break loop
} else {
var str string
id, err := file.GetCsvDb().GetClientIdByVkey(string(b))
if err != nil {
break
break loop
}
for _, v := range file.GetCsvDb().Hosts {
if v.Client.Id == id {
@@ -378,22 +378,25 @@ func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
if client, err = c.GetConfigInfo(); err != nil {
fail = true
c.WriteAddFail()
break
break loop
} else {
if err = file.GetCsvDb().NewClient(client); err != nil {
fail = true
c.WriteAddFail()
break
break loop
}
c.WriteAddOk()
c.Write([]byte(client.VerifyKey))
s.clientLock.Lock()
s.Client[client.Id] = NewClient(nil, nil, nil)
s.clientLock.Unlock()
}
case common.NEW_HOST:
h, err := c.GetHostInfo()
if err != nil {
fail = true
c.WriteAddFail()
break
break loop
}
h.Client = client
if h.Location == "" {
@@ -403,7 +406,7 @@ func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
if file.GetCsvDb().IsHostExist(h) {
fail = true
c.WriteAddFail()
break
break loop
} else {
file.GetCsvDb().NewHost(h)
c.WriteAddOk()
@@ -415,21 +418,21 @@ func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
if t, err := c.GetTaskInfo(); err != nil {
fail = true
c.WriteAddFail()
break
break loop
} else {
ports := common.GetPorts(t.Ports)
targets := common.GetPorts(t.Target)
if len(ports) > 1 && (t.Mode == "tcp" || t.Mode == "udp") && (len(ports) != len(targets)) {
fail = true
c.WriteAddFail()
break
break loop
} else if t.Mode == "secret" {
ports = append(ports, 0)
}
if len(ports) == 0 {
fail = true
c.WriteAddFail()
break
break loop
}
for i := 0; i < len(ports); i++ {
tl := new(file.Tunnel)
@@ -459,12 +462,12 @@ func (s *Bridge) getConfig(c *conn.Conn, isPub bool, client *file.Client) {
logs.Notice("Add task error ", err.Error())
fail = true
c.WriteAddFail()
break
break loop
}
if b := tool.TestServerPort(tl.Port, tl.Mode); !b && t.Mode != "secret" && t.Mode != "p2p" {
fail = true
c.WriteAddFail()
break
break loop
} else {
s.OpenTask <- tl
}
+3 -2
View File
@@ -53,8 +53,9 @@ publicVkey=123
#Whether to restrict IP access, true or false or ignore
#ipLimit=true
serverIp=127.0.0.1
#must set when use p2p
#serverIp=127.0.0.1
#p2p udp port
p2pPort=6000
#p2pPort=6000
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 290 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 KiB

After

Width:  |  Height:  |  Size: 232 KiB

+1 -1
View File
@@ -7,7 +7,7 @@ import (
const PoolSize = 64 * 1024
const PoolSizeSmall = 100
const PoolSizeUdp = 1472
const PoolSizeCopy = 32 << 6
const PoolSizeCopy = 32 << 10
var BufPool = sync.Pool{
New: func() interface{} {
+1 -1
View File
@@ -1,6 +1,6 @@
package version
const VERSION = "0.17.0"
const VERSION = "0.17.1"
func GetVersion() string {
return VERSION
+288
View File
@@ -0,0 +1,288 @@
/*
*
* INSPINIA - Responsive Admin Theme
* version 2.4
*
*/
$(document).ready(function () {
// Add body-small class if window less than 768px
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
// MetsiMenu
// $('#side-menu').metisMenu();
// Collapse ibox function
$('.collapse-link').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$('.close-link').click(function () {
var content = $(this).closest('div.ibox');
content.remove();
});
// Fullscreen ibox function
$('.fullscreen-link').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
$('body').toggleClass('fullscreen-ibox-mode');
button.toggleClass('fa-expand').toggleClass('fa-compress');
ibox.toggleClass('fullscreen');
setTimeout(function () {
$(window).trigger('resize');
}, 100);
});
// Close menu in canvas mode
$('.close-canvas-menu').click(function () {
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Run menu of canvas
// $('body.canvas-menu .sidebar-collapse').slimScroll({
// height: '100%',
// railOpacity: 0.9
// });
// Open close right sidebar
$('.right-sidebar-toggle').click(function () {
$('#right-sidebar').toggleClass('sidebar-open');
});
// // Initialize slimscroll for right sidebar
// $('.sidebar-container').slimScroll({
// height: '100%',
// railOpacity: 0.4,
// wheelStep: 10
// });
// // Open close small chat
// $('.open-small-chat').click(function () {
// $(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
// $('.small-chat-box').toggleClass('active');
// });
// // Initialize slimscroll for small chat
// $('.small-chat-box .content').slimScroll({
// height: '234px',
// railOpacity: 0.4
// });
// Small todo handler
$('.check-link').click(function () {
var button = $(this).find('i');
var label = $(this).next('span');
button.toggleClass('fa-check-square').toggleClass('fa-square-o');
label.toggleClass('todo-completed');
return false;
});
// Minimalize menu
$('.navbar-minimalize').click(function () {
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Move modal to body
// Fix Bootstrap backdrop issu with animation.css
$('.modal').appendTo("body");
// Full height of sidebar
function fix_height() {
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebard-panel").css("min-height", heightWithoutNavbar + "px");
var navbarHeigh = $('nav.navbar-default').height();
var wrapperHeigh = $('#page-wrapper').height();
if (navbarHeigh > wrapperHeigh) {
$('#page-wrapper').css("min-height", navbarHeigh + "px");
}
if (navbarHeigh < wrapperHeigh) {
$('#page-wrapper').css("min-height", $(window).height() + "px");
}
if ($('body').hasClass('fixed-nav')) {
if (navbarHeigh > wrapperHeigh) {
$('#page-wrapper').css("min-height", navbarHeigh - 60 + "px");
} else {
$('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
}
}
}
fix_height();
// Fixed Sidebar
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
// Move right sidebar top after scroll
$(window).scroll(function () {
if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
$('#right-sidebar').addClass('sidebar-top');
} else {
$('#right-sidebar').removeClass('sidebar-top');
}
});
$(window).bind("load resize scroll", function () {
if (!$("body").hasClass('body-small')) {
fix_height();
}
});
$("[data-toggle=popover]")
.popover();
// Add slimscroll to element
});
// Minimalize menu when screen is less than 768px
$(window).bind("resize", function () {
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
});
// Local Storage functions
// Set proper body class and plugins based on user configuration
$(document).ready(function () {
if (localStorageSupport) {
var collapse = localStorage.getItem("collapse_menu");
var fixedsidebar = localStorage.getItem("fixedsidebar");
var fixednavbar = localStorage.getItem("fixednavbar");
var boxedlayout = localStorage.getItem("boxedlayout");
var fixedfooter = localStorage.getItem("fixedfooter");
var body = $('body');
if (fixedsidebar == 'on') {
body.addClass('fixed-sidebar');
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
if (collapse == 'on') {
if (body.hasClass('fixed-sidebar')) {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
} else {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
}
}
if (fixednavbar == 'on') {
$(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
body.addClass('fixed-nav');
}
if (boxedlayout == 'on') {
body.addClass('boxed-layout');
}
if (fixedfooter == 'on') {
$(".footer").addClass('fixed');
}
}
});
// check if browser support HTML5 local storage
function localStorageSupport() {
return (('localStorage' in window) && window['localStorage'] !== null)
}
// For demo purpose - animation css script
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
// Hide menu in order to smoothly turn on when maximize menu
$('#side-menu').hide();
// For smoothly turn on menu
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 200);
} else if ($('body').hasClass('fixed-sidebar')) {
$('#side-menu').hide();
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 100);
} else {
// Remove all inline style from jquery fadeIn function to reset menu state
$('#side-menu').removeAttr('style');
}
}
// Dragable panels
function WinMove() {
var element = "[class*=col]";
var handle = ".ibox-title";
var connect = "[class*=col]";
$(element).sortable(
{
handle: handle,
connectWith: connect,
tolerance: 'pointer',
forcePlaceholderSize: true,
opacity: 0.8
})
.disableSelection();
}
+2 -2
View File
@@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>easyProxy error</title>
<title>nps error</title>
</head>
<body>
404 not found,power by easyProxy
404 not found,power by <a href="//github.com/cnlh/nps">nps</a>
</body>
</html>
+8 -5
View File
@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
@@ -23,6 +22,7 @@
<!-- Latest compiled and minified JavaScript -->
<script src="/static/js/bootstrap-table.min.js"></script>
<script src="/static/js/inspinia.js"></script>
<!-- Latest compiled and minified Locales -->
@@ -35,8 +35,8 @@
<ul class="nav metismenu" id="side-menu">
<li class="nav-header">
<div class="dropdown profile-element"> <span>
{{/*<img alt="image" class="img-circle" src="/static/img/profile_small.jpg"/>*/}}
</span>
{{/*<img alt="image" class="img-circle" src="/static/img/profile_small.jpg"/>*/}}
</span>
<a href="#">
<span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">admin</strong>
</span> <span class="text-muted text-xs block">system </span> </span>
@@ -89,7 +89,8 @@
</div>
<ul class="nav navbar-top-links navbar-right">
<li>
<span class="m-r-sm text-muted welcome-message">Welcome to use <a href="https://github.com/cnlh/nps">NPS</a></span>
<span class="m-r-sm text-muted welcome-message">Welcome to use <a
href="https://github.com/cnlh/nps">NPS</a></span>
</li>
<li>
@@ -106,7 +107,7 @@
{{.LayoutContent}}
<div class="footer">
<div class="pull-right">
read more <strong><a href="https://github.com/cnlh/nps">go</a></strong>
read more <strong><a href="https://github.com/cnlh/nps">go</a></strong>
</div>
<div>
<strong>Copyright</strong> nps &copy; 2018-2019
@@ -118,3 +119,5 @@
</body>
</html>