From 8590dfde30113974a81c588377002aaacf3df330 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2020 15:55:19 +0800 Subject: [PATCH 01/13] change md --- README.md | 2 +- README_zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbd50c5..e0aeaad 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Build Status](https://travis-ci.org/cnlh/nps.svg?branch=master)](https://travis-ci.org/cnlh/nps) ![GitHub All Releases](https://img.shields.io/github/downloads/cnlh/nps/total) -[README](https://github.com/cnlh/nps/blob/master/README.md)|[中文文档](https://github.com/cnlh/nps/README_zh.md) +[README](https://github.com/cnlh/nps/blob/master/README.md)|[中文文档](https://github.com/cnlh/nps/blob/master/README_zh.md) NPS is a lightweight, high-performance, powerful **intranet penetration** proxy server, with a powerful web management terminal. diff --git a/README_zh.md b/README_zh.md index 64a1c47..03d7e58 100644 --- a/README_zh.md +++ b/README_zh.md @@ -5,7 +5,7 @@ [![Build Status](https://travis-ci.org/cnlh/nps.svg?branch=master)](https://travis-ci.org/cnlh/nps) ![GitHub All Releases](https://img.shields.io/github/downloads/cnlh/nps/total) -[README](https://github.com/cnlh/nps/blob/master/README.md)|[中文文档](https://github.com/cnlh/nps/README_zh.md) +[README](https://github.com/cnlh/nps/blob/master/README.md)|[中文文档](https://github.com/cnlh/nps/blob/master/README_zh.md) nps是一款轻量级、高性能、功能强大的**内网穿透**代理服务器。目前支持**tcp、udp流量转发**,可支持任何**tcp、udp**上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析等等……),此外还**支持内网http代理、内网socks5代理**、**p2p等**,并带有功能强大的web管理端。 From 6bbe276b18a088a21125966ce38a380aacd2f2df Mon Sep 17 00:00:00 2001 From: ffdfgdfg Date: Sat, 4 Jan 2020 20:49:17 +0800 Subject: [PATCH 02/13] change window calculation, bandwidth calculation --- lib/mux/conn.go | 72 +++++++++++++++++++++++++++++++++++++++++++------ lib/mux/mux.go | 2 +- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/lib/mux/conn.go b/lib/mux/conn.go index 6d65f7c..85ba1ef 100644 --- a/lib/mux/conn.go +++ b/lib/mux/conn.go @@ -202,7 +202,7 @@ type ReceiveWindow struct { bufQueue ReceiveWindowQueue element *common.ListElement count int8 - bw *bandwidth + bw *writeBandwidth once sync.Once // receive window send the current max size and read size to send window // means done size actually store the size receive window has read @@ -215,7 +215,7 @@ func (Self *ReceiveWindow) New(mux *Mux) { Self.maxSizeDone = Self.pack(common.MAXIMUM_SEGMENT_SIZE*30, 0, false) Self.mux = mux Self.window.New() - Self.bw = NewBandwidth(nil) + Self.bw = NewWriteBandwidth() } func (Self *ReceiveWindow) remainingSize(maxSize uint32, delta uint16) (n uint32) { @@ -232,9 +232,15 @@ func (Self *ReceiveWindow) calcSize() { // calculating maximum receive window size if Self.count == 0 { //logs.Warn("ping, bw", Self.mux.latency, Self.bw.Get()) - conns := Self.mux.connMap.Size() - n := uint32(math.Float64frombits(atomic.LoadUint64(&Self.mux.latency)) * - (Self.mux.bw.Get() + Self.bw.Get())) + //conns := Self.mux.connMap.Size() + muxBw := Self.mux.bw.Get() + connBw := Self.bw.Get() + //logs.Warn("muxbw connbw", muxBw, connBw) + var n uint32 + if connBw > 0 && muxBw > 0 { + n = uint32(math.Float64frombits(atomic.LoadUint64(&Self.mux.latency)) * + (muxBw + connBw)) + } //logs.Warn(n) if n < common.MAXIMUM_SEGMENT_SIZE*30 { //logs.Warn("window small", n, Self.mux.bw.Get(), Self.bw.Get()) @@ -252,9 +258,12 @@ func (Self *ReceiveWindow) calcSize() { n = 2 * size // twice grow } - if n > (common.MAXIMUM_WINDOW_SIZE / uint32(conns)) { - logs.Warn("window too large, calculated:", n, "limit:", common.MAXIMUM_WINDOW_SIZE/uint32(conns)) - n = common.MAXIMUM_WINDOW_SIZE / uint32(conns) + if connBw > 0 && muxBw > 0 { + limit := uint32(common.MAXIMUM_WINDOW_SIZE * (connBw / (muxBw + connBw))) + if n > limit { + logs.Warn("window too large, calculated:", n, "limit:", limit, connBw, muxBw) + n = limit + } } // set the maximum size //logs.Warn("n", n) @@ -664,3 +673,50 @@ func (Self *SendWindow) SetTimeOut(t time.Time) { // waiting for receive a receive window size Self.timeout = t } + +type writeBandwidth struct { + writeBW uint64 // store in bits, but it's float64 + readEnd time.Time + duration float64 + bufLength uint32 +} + +const writeCalcThreshold uint32 = 5 * 1024 * 1024 + +func NewWriteBandwidth() *writeBandwidth { + return &writeBandwidth{} +} + +func (Self *writeBandwidth) StartRead() { + if Self.readEnd.IsZero() { + Self.readEnd = time.Now() + } + Self.duration += time.Now().Sub(Self.readEnd).Seconds() + if Self.bufLength >= writeCalcThreshold { + Self.calcBandWidth() + } +} + +func (Self *writeBandwidth) SetCopySize(n uint16) { + Self.bufLength += uint32(n) + Self.endRead() +} + +func (Self *writeBandwidth) endRead() { + Self.readEnd = time.Now() +} + +func (Self *writeBandwidth) calcBandWidth() { + atomic.StoreUint64(&Self.writeBW, math.Float64bits(float64(Self.bufLength)/Self.duration)) + Self.bufLength = 0 + Self.duration = 0 +} + +func (Self *writeBandwidth) Get() (bw float64) { + // The zero value, 0 for numeric types + bw = math.Float64frombits(atomic.LoadUint64(&Self.writeBW)) + if bw <= 0 { + bw = 0 + } + return +} diff --git a/lib/mux/mux.go b/lib/mux/mux.go index f89bbc4..52bd81c 100644 --- a/lib/mux/mux.go +++ b/lib/mux/mux.go @@ -443,7 +443,7 @@ func (Self *bandwidth) Get() (bw float64) { // The zero value, 0 for numeric types bw = math.Float64frombits(atomic.LoadUint64(&Self.readBandwidth)) if bw <= 0 { - bw = 100 + bw = 0 } //logs.Warn(bw) return From 933809f93930fff3218b3525f1f9ac57644766d1 Mon Sep 17 00:00:00 2001 From: ffdfgdfg Date: Sun, 5 Jan 2020 21:00:31 +0800 Subject: [PATCH 03/13] add work flow --- image/work_flow.svg | 821 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 821 insertions(+) create mode 100644 image/work_flow.svg diff --git a/image/work_flow.svg b/image/work_flow.svg new file mode 100644 index 0000000..5b3794b --- /dev/null +++ b/image/work_flow.svg @@ -0,0 +1,821 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 页-1 + + + + + + + + + + + + + + + + + + + + + + + + 防火墙 + NAT + + 工作表.2 + + + + 工作表.3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NAT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 服务器 + Application2 10.0.0.4:PORT + + 工作表.5 + + + + 工作表.6 + + + + 工作表.7 + + + + + + + + + + Application210.0.0.4:PORT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 服务器.8 + Application1 10.0.0.3:PORT + + 工作表.9 + + + + 工作表.10 + + + + 工作表.11 + + + + + + + + + + Application110.0.0.3:PORT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 服务器.12 + Application3 10.0.0.5:PORT + + 工作表.13 + + + + 工作表.14 + + + + 工作表.15 + + + + + + + + + + Application310.0.0.5:PORT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 主机 + NPC Client 10.0.0.2 Dial To: ->10.0.0.3:PORT ->10.0.0.4:PORT ... + + 工作表.17 + + + + + + 工作表.18 + + + + + + + + 工作表.19 + + + + + + NPCClient10.0.0.2Dial To:->10.0.0.3:PORT->10.0.0.4:PORT->10.0.0.5:PORT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 主机.20 + NPS Server 1.1.1.1 Listen On: 8003->10.0.0.3:PORT 8004->10.0.... + + 工作表.21 + + + + + + 工作表.22 + + + + + + + + 工作表.23 + + + + + + NPSServer1.1.1.1Listen On:8003->10.0.0.3:PORT8004->10.0.0.4:PORT8005->10.0.0.5:PORT + + + + + + + + + + + + + + + + + + 用户 + User1 Wants:APP1 + + 工作表.25 + + + + + + User1Wants:APP1 + + + + + + + + + + + + + + + + + + 用户.26 + User2 Wants:APP2 + + 工作表.27 + + + + + + User2Wants:APP2 + + + + + + + + + + + + + + + + + + 用户.28 + User3 Wants:APP3 + + 工作表.29 + + + + + + User3Wants:APP3 + + + 动态连接线.1003 + ->8003 Multi Conn + + + + + + + + ->8003Multi Conn + + 动态连接线.1004 + ->8004 Multi Conn + + + + + + + + ->8004Multi Conn + + 动态连接线.1005 + ->8005 Multi Conn + + + + + + + + ->8005Multi Conn + + 动态连接线.1006 + NPS & NPC Multiplexing Connection TCP or KCP Only One Conn Pe... + + + + + + + + NPS & NPCMultiplexingConnectionTCP or KCPOnly OneConn PeerNPC + + 动态连接线.1007 + ->PORT Multi Conn + + + + + + + + ->PORTMulti Conn + + 动态连接线.1008 + ->PORT Multi Conn + + + + + + + + ->PORTMulti Conn + + 动态连接线.1009 + ->PORT Multi Conn + + + + + + + + ->PORTMulti Conn + + 动态连接线.1010 + NPS & NPC + + + + + + + + NPS&NPC + + 工作表.1011 + + + + 工作表.1012 + + + + 工作表.1013 + Internet + + + + Internet + + 工作表.1014 + Intranet + + + + Intranet + + From c595db19b919decd77381576daa105fa6173cd06 Mon Sep 17 00:00:00 2001 From: avengexyz <58532751+avengexyz@users.noreply.github.com> Date: Sun, 5 Jan 2020 22:20:55 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=8625.4=E7=89=88?= =?UTF-8?q?=E6=9C=ACwebapi=E5=8F=82=E6=95=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自己测试的25.4版本 webapi 需要的参数 --- docs/webapi.md | 231 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 docs/webapi.md diff --git a/docs/webapi.md b/docs/webapi.md new file mode 100644 index 0000000..539766b --- /dev/null +++ b/docs/webapi.md @@ -0,0 +1,231 @@ +获取客户端列表 + +url='http://你的域名或者网址/client/list/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| search | 搜索 | +| order | 排序asc 正序 desc倒序 | +| offset | 分页(第几页) | +| limit | 条数(分页显示的条数) | + +*** +获取单个客户端 + +url='http://你的域名或者网址/client/getclient/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 客户端id | + +*** +添加客户端 + +url='http://你的域名或者网址/client/add/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| remark | 备注 | +| u | basic权限认证用户名 | +| p | basic权限认证密码 | +| limit | 条数(分页显示的条数) | +| vkey | 客户端验证密钥 | +| config\_conn\_allow | 是否允许客户端以配置文件模式连接 1允许 0不允许 | +| compress | 压缩1允许 0不允许 | +| crypt | 是否加密(1或者0)1允许 0不允许 | +| rate\_limit | 带宽限制 单位KB/S 空则为不限制 | +| flow\_limit | 流量限制 单位M 空则为不限制 | +| max\_conn | 客户端最大连接数量 空则为不限制 | +| max\_tunnel | 客户端最大隧道数量 空则为不限制 | + +*** +修改客户端(25.4版本有问题暂时不能用) + +url='http://你的域名或者网址/client/edit/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| remark | 备注 | +| u | basic权限认证用户名 | +| p | basic权限认证密码 | +| limit | 条数(分页显示的条数) | +| vkey | 客户端验证密钥 | +| config\_conn\_allow | 是否允许客户端以配置文件模式连接 1允许 0不允许 | +| compress | 压缩1允许 0不允许 | +| crypt | 是否加密(1或者0)1允许 0不允许 | +| rate\_limit | 带宽限制 单位KB/S 空则为不限制 | +| flow\_limit | 流量限制 单位M 空则为不限制 | +| max\_conn | 客户端最大连接数量 空则为不限制 | +| max\_tunnel | 客户端最大隧道数量 空则为不限制 | +| id | 要修改的客户端id | + +*** +删除客户端 + +url='http://你的域名或者网址/client/del/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 要删除的客户端id | + +*** +获取域名解析列表 + +url='http://你的域名或者网址/index/hostlist/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| search | 搜索(可以搜域名/备注什么的) | +| offset | 分页(第几页) | +| limit | 条数(分页显示的条数) | + +*** +添加域名解析 + +url='http://你的域名或者网址/index/addhost/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| remark | 备注 | +| host | 域名 | +| scheme | 协议类型(三种 all http https) | +| location | url路由 空则为不限制 | +| client\_id | 客户端id | +| target | 内网目标(ip:端口) | +| header | request header 请求头 | +| hostchange | request host 请求主机 | + +*** +修改域名解析 + +url='http://你的域名或者网址/index/edithost/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| remark | 备注 | +| host | 域名 | +| scheme | 协议类型(三种 all http https) | +| location | url路由 空则为不限制 | +| client\_id | 客户端id | +| target | 内网目标(ip:端口) | +| header | request header 请求头 | +| hostchange | request host 请求主机 | +| id | 需要修改的域名解析id | + +*** +删除域名解析 + +url='http://你的域名或者网址/index/delhost/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 需要删除的域名解析id | + +*** +获取单条隧道信息 + +url='http://你的域名或者网址/index/getonetunnel/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 隧道的id | + +*** +获取隧道列表 + +url='http://你的域名或者网址/index/gettunnel/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| client\_id | 穿透隧道的客户端id | +| type | 类型tcp udp httpProx socks5 secret p2p | +| search | 搜索 | +| offset | 分页(第几页) | +| limit | 条数(分页显示的条数) | + +*** +添加隧道 + +url='http://你的域名或者网址/index/add/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| type | 类型tcp udp httpProx socks5 secret p2p | +| remark | 备注 | +| port | 服务端端口 | +| target | 目标(ip:端口) | +| client\_id | 客户端id | + +*** +修改隧道 + +url='http://你的域名或者网址/index/edit/'; + +*** +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| type | 类型tcp udp httpProx socks5 secret p2p | +| remark | 备注 | +| port | 服务端端口 | +| target | 目标(ip:端口) | +| client\_id | 客户端id | +| id | 隧道id | + +*** +删除隧道 + +url='http://你的域名或者网址/index/del/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 隧道id | + +*** +隧道停止工作 + +url='http://你的域名或者网址/index/stop/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 隧道id | + +*** +隧道开始工作 + +url='http://你的域名或者网址/index/start/'; + +post提交的数据 + +| 参数 | 含义 | +| --- | --- | +| id | 隧道id | \ No newline at end of file From 103268a5dca130df2890c13969aea1d0d70faafe Mon Sep 17 00:00:00 2001 From: avengexyz <58532751+avengexyz@users.noreply.github.com> Date: Mon, 6 Jan 2020 01:11:25 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E9=87=8D=E6=96=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=9A=84wenapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重新修改的wenapi --- docs/webapi.md | 96 ++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/docs/webapi.md b/docs/webapi.md index 539766b..836358b 100644 --- a/docs/webapi.md +++ b/docs/webapi.md @@ -1,8 +1,9 @@ 获取客户端列表 -url='http://你的域名或者网址/client/list/'; +``` +POST /client/list/ +``` -post提交的数据 | 参数 | 含义 | | --- | --- | @@ -14,9 +15,10 @@ post提交的数据 *** 获取单个客户端 -url='http://你的域名或者网址/client/getclient/'; +``` +POST /client/getclient/ +``` -post提交的数据 | 参数 | 含义 | | --- | --- | @@ -25,9 +27,9 @@ post提交的数据 *** 添加客户端 -url='http://你的域名或者网址/client/add/'; - -post提交的数据 +``` +POST /client/add/ +``` | 参数 | 含义 | | --- | --- | @@ -47,9 +49,9 @@ post提交的数据 *** 修改客户端(25.4版本有问题暂时不能用) -url='http://你的域名或者网址/client/edit/'; - -post提交的数据 +``` +POST /client/edit/ +``` | 参数 | 含义 | | --- | --- | @@ -70,9 +72,9 @@ post提交的数据 *** 删除客户端 -url='http://你的域名或者网址/client/del/'; - -post提交的数据 +``` +POST /client/del/ +``` | 参数 | 含义 | | --- | --- | @@ -81,9 +83,9 @@ post提交的数据 *** 获取域名解析列表 -url='http://你的域名或者网址/index/hostlist/'; - -post提交的数据 +``` +POST /index/hostlist/ +``` | 参数 | 含义 | | --- | --- | @@ -94,9 +96,10 @@ post提交的数据 *** 添加域名解析 -url='http://你的域名或者网址/index/addhost/'; +``` +POST /index/addhost/ +``` -post提交的数据 | 参数 | 含义 | | --- | --- | @@ -112,9 +115,9 @@ post提交的数据 *** 修改域名解析 -url='http://你的域名或者网址/index/edithost/'; - -post提交的数据 +``` +POST /index/edithost/ +``` | 参数 | 含义 | | --- | --- | @@ -131,9 +134,9 @@ post提交的数据 *** 删除域名解析 -url='http://你的域名或者网址/index/delhost/'; - -post提交的数据 +``` +POST /index/delhost/ +``` | 参数 | 含义 | | --- | --- | @@ -142,9 +145,9 @@ post提交的数据 *** 获取单条隧道信息 -url='http://你的域名或者网址/index/getonetunnel/'; - -post提交的数据 +``` +POST /index/getonetunnel/ +``` | 参数 | 含义 | | --- | --- | @@ -153,9 +156,9 @@ post提交的数据 *** 获取隧道列表 -url='http://你的域名或者网址/index/gettunnel/'; - -post提交的数据 +``` +POST /index/gettunnel/ +``` | 参数 | 含义 | | --- | --- | @@ -168,9 +171,9 @@ post提交的数据 *** 添加隧道 -url='http://你的域名或者网址/index/add/'; - -post提交的数据 +``` +POST /index/add/ +``` | 参数 | 含义 | | --- | --- | @@ -183,10 +186,9 @@ post提交的数据 *** 修改隧道 -url='http://你的域名或者网址/index/edit/'; - -*** -post提交的数据 +``` +POST /index/edit/ +``` | 参数 | 含义 | | --- | --- | @@ -200,9 +202,9 @@ post提交的数据 *** 删除隧道 -url='http://你的域名或者网址/index/del/'; - -post提交的数据 +``` +POST /index/del/ +``` | 参数 | 含义 | | --- | --- | @@ -211,9 +213,9 @@ post提交的数据 *** 隧道停止工作 -url='http://你的域名或者网址/index/stop/'; - -post提交的数据 +``` +POST /index/stop/ +``` | 参数 | 含义 | | --- | --- | @@ -222,10 +224,10 @@ post提交的数据 *** 隧道开始工作 -url='http://你的域名或者网址/index/start/'; - -post提交的数据 +``` +POST /index/start/ +``` | 参数 | 含义 | | --- | --- | -| id | 隧道id | \ No newline at end of file +| id | 隧道id | From 35311010a60058d1eb0db7389361d990d390bd68 Mon Sep 17 00:00:00 2001 From: cnlh Date: Tue, 7 Jan 2020 10:02:58 +0800 Subject: [PATCH 06/13] fixed #354 --- cmd/npc/npc.go | 2 +- cmd/nps/nps.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/npc/npc.go b/cmd/npc/npc.go index da29a05..ea1a5ec 100644 --- a/cmd/npc/npc.go +++ b/cmd/npc/npc.go @@ -114,7 +114,7 @@ func main() { } err := service.Control(s, os.Args[1]) if err != nil { - logs.Error("Valid actions: %q\n", service.ControlAction, err.Error()) + logs.Error("Valid actions: %q\n%s", service.ControlAction, err.Error()) } return } diff --git a/cmd/nps/nps.go b/cmd/nps/nps.go index 306da88..36141f0 100644 --- a/cmd/nps/nps.go +++ b/cmd/nps/nps.go @@ -94,13 +94,13 @@ func main() { } err = service.Control(s, os.Args[1]) if err != nil { - logs.Error("Valid actions: %q\n", service.ControlAction, err.Error()) + logs.Error("Valid actions: %q\n%s", service.ControlAction, err.Error()) } return case "start", "restart", "stop", "uninstall": err := service.Control(s, os.Args[1]) if err != nil { - logs.Error("Valid actions: %q\n", service.ControlAction, err.Error()) + logs.Error("Valid actions: %q\n%s", service.ControlAction, err.Error()) } return case "update": From 4b02ab8d1fef441e2410a1e232a4085b475722a7 Mon Sep 17 00:00:00 2001 From: he liu Date: Wed, 8 Jan 2020 14:28:42 +0800 Subject: [PATCH 07/13] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dfa9f50..b7d39d9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ nps是一款轻量级、高性能、功能强大的**内网穿透**代理服务 - 域名解析具备自定义header、404页面配置、host修改、站点保护、URL路由、泛解析等功能 - 服务端支持多用户和用户注册功能 -**没找到你想要的功能?不要紧,点击[进入文档](https://cnlh.github.io/nps/)查找吧** +**没找到你想要的功能?不要紧,点击[进入文档](https://ehang-io.github.io/nps)查找吧** ## 快速开始 ### 安装 @@ -65,11 +65,11 @@ nps是一款轻量级、高性能、功能强大的**内网穿透**代理服务 - 点击web管理中客户端前的+号,复制启动命令 - 执行启动命令,linux直接执行即可,windows将./npc换成npc.exe用cmd执行 -如果需要注册到系统服务可查看[注册到系统服务](https://cnlh.github.io/nps/#/use?id=注册到系统服务) +如果需要注册到系统服务可查看[注册到系统服务](https://ehang-io.github.io/nps/#/use?id=注册到系统服务) ### 配置 - 客户端连接后,在web中配置对应穿透服务即可 -- 更多高级用法见[完整文档](https://cnlh.github.io/nps/) +- 更多高级用法见[完整文档](https://ehang-io.github.io/nps) ## 贡献 - 如果遇到bug可以直接提交至dev分支 From 6c7ac5962633a274c0f3e64112b2c68329a40d69 Mon Sep 17 00:00:00 2001 From: ffdfgdfg Date: Wed, 8 Jan 2020 21:57:14 +0800 Subject: [PATCH 08/13] change package path --- Dockerfile.npc | 4 ++-- Dockerfile.nps | 6 +++--- bridge/bridge.go | 16 ++++++++-------- build.android.sh | 8 ++++---- client/client.go | 11 ++++++----- client/control.go | 10 +++++----- client/health.go | 6 +++--- client/local.go | 14 +++++++------- client/register.go | 2 +- cmd/npc/npc.go | 12 ++++++------ cmd/npc/sdk.go | 6 +++--- cmd/nps/nps.go | 20 ++++++++++---------- go.mod | 2 +- gui/npc/npc.go | 8 ++++---- lib/common/util.go | 2 +- lib/config/config.go | 6 +++--- lib/conn/conn.go | 12 ++++++------ lib/daemon/daemon.go | 2 +- lib/daemon/reload.go | 2 +- lib/file/db.go | 6 +++--- lib/file/file.go | 4 ++-- lib/file/obj.go | 2 +- lib/goroutine/pool.go | 4 ++-- lib/install/install.go | 4 ++-- lib/mux/conn.go | 2 +- lib/mux/mux.go | 2 +- lib/mux/mux_test.go | 4 ++-- lib/mux/pmux.go | 2 +- lib/mux/queue.go | 2 +- server/connection/connection.go | 2 +- server/proxy/base.go | 8 ++++---- server/proxy/http.go | 12 ++++++------ server/proxy/https.go | 10 +++++----- server/proxy/p2p.go | 2 +- server/proxy/socks5.go | 6 +++--- server/proxy/tcp.go | 10 +++++----- server/proxy/transport.go | 4 ++-- server/proxy/transport_windows.go | 2 +- server/proxy/udp.go | 8 ++++---- server/server.go | 12 ++++++------ server/test/test.go | 4 ++-- server/tool/utils.go | 2 +- web/controllers/auth.go | 2 +- web/controllers/base.go | 8 ++++---- web/controllers/client.go | 8 ++++---- web/controllers/index.go | 8 ++++---- web/controllers/login.go | 6 +++--- web/routers/router.go | 2 +- web/static/page/error.html | 2 +- web/views/login/index.html | 2 +- web/views/public/layout.html | 4 ++-- 51 files changed, 153 insertions(+), 152 deletions(-) diff --git a/Dockerfile.npc b/Dockerfile.npc index ae6715a..2ef275e 100755 --- a/Dockerfile.npc +++ b/Dockerfile.npc @@ -1,10 +1,10 @@ FROM golang as builder -WORKDIR /go/src/github.com/cnlh/nps +WORKDIR /go/src/ehang.io/nps COPY . . RUN go get -d -v ./... RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/npc/npc.go FROM scratch -COPY --from=builder /go/src/github.com/cnlh/nps/npc / +COPY --from=builder /go/src/ehang.io/nps/npc / VOLUME /conf ENTRYPOINT ["/npc"] diff --git a/Dockerfile.nps b/Dockerfile.nps index 698ced9..faf02ba 100755 --- a/Dockerfile.nps +++ b/Dockerfile.nps @@ -1,11 +1,11 @@ FROM golang as builder -WORKDIR /go/src/github.com/cnlh/nps +WORKDIR /go/src/ehang.io/nps COPY . . RUN go get -d -v ./... RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/nps/nps.go FROM scratch -COPY --from=builder /go/src/github.com/cnlh/nps/nps / -COPY --from=builder /go/src/github.com/cnlh/nps/web /web +COPY --from=builder /go/src/ehang.io/nps/nps / +COPY --from=builder /go/src/ehang.io/nps/web /web VOLUME /conf CMD ["/nps"] diff --git a/bridge/bridge.go b/bridge/bridge.go index 7894b66..0827260 100755 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -11,16 +11,16 @@ import ( "sync" "time" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/mux" + "ehang.io/nps/lib/version" + "ehang.io/nps/server/connection" + "ehang.io/nps/server/tool" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/mux" - "github.com/cnlh/nps/lib/version" - "github.com/cnlh/nps/server/connection" - "github.com/cnlh/nps/server/tool" ) type Client struct { diff --git a/build.android.sh b/build.android.sh index d9f8141..918a66a 100644 --- a/build.android.sh +++ b/build.android.sh @@ -14,16 +14,16 @@ git checkout v1.2.0 go install -v ./cmd/fyne #fyne package -os android fyne.io/fyne/cmd/hello echo "fyne install success" -mkdir -p /go/src/github.com/cnlh/nps -cp -R /app/* /go/src/github.com/cnlh/nps -cd /go/src/github.com/cnlh/nps +mkdir -p /go/src/ehang.io/nps +cp -R /app/* /go/src/ehang.io/nps +cd /go/src/ehang.io/nps #go get -u fyne.io/fyne fyne.io/fyne/cmd/fyne rm cmd/npc/sdk.go #go get -u ./... #go mod tidy #rm -rf /go/src/golang.org/x/mobile echo "tidy success" -cd /go/src/github.com/cnlh/nps +cd /go/src/ehang.io/nps go mod vendor cd vendor cp -R * /go/src diff --git a/client/client.go b/client/client.go index 7a6f1da..98c918d 100755 --- a/client/client.go +++ b/client/client.go @@ -11,11 +11,11 @@ import ( "github.com/astaxie/beego/logs" "github.com/xtaci/kcp-go" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/config" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/mux" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/config" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/mux" ) type TRPClient struct { @@ -44,6 +44,7 @@ func NewRPClient(svraddr string, vKey string, bridgeConnType string, proxyUrl st var NowStatus int var CloseClient bool + //start func (s *TRPClient) Start() { CloseClient = false diff --git a/client/control.go b/client/control.go index d8b98f3..63bf7ea 100644 --- a/client/control.go +++ b/client/control.go @@ -19,12 +19,12 @@ import ( "strings" "time" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/config" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/version" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/config" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/version" "github.com/xtaci/kcp-go" "golang.org/x/net/proxy" ) diff --git a/client/health.go b/client/health.go index e804cf9..2726c5b 100644 --- a/client/health.go +++ b/client/health.go @@ -7,10 +7,10 @@ import ( "strings" "time" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/sheap" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/sheap" "github.com/pkg/errors" ) diff --git a/client/local.go b/client/local.go index 9c903f6..13dfb60 100644 --- a/client/local.go +++ b/client/local.go @@ -8,14 +8,14 @@ import ( "sync" "time" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/config" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/mux" + "ehang.io/nps/server/proxy" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/config" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/mux" - "github.com/cnlh/nps/server/proxy" "github.com/xtaci/kcp-go" ) diff --git a/client/register.go b/client/register.go index c03fb3c..dda4445 100644 --- a/client/register.go +++ b/client/register.go @@ -5,7 +5,7 @@ import ( "log" "os" - "github.com/cnlh/nps/lib/common" + "ehang.io/nps/lib/common" ) func RegisterLocalIp(server string, vKey string, tp string, proxyUrl string, hour int) { diff --git a/cmd/npc/npc.go b/cmd/npc/npc.go index ea1a5ec..cb2efba 100644 --- a/cmd/npc/npc.go +++ b/cmd/npc/npc.go @@ -1,16 +1,16 @@ package main import ( + "ehang.io/nps/client" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/config" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/install" + "ehang.io/nps/lib/version" "flag" "fmt" "github.com/astaxie/beego/logs" "github.com/ccding/go-stun/stun" - "github.com/cnlh/nps/client" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/config" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/install" - "github.com/cnlh/nps/lib/version" "github.com/kardianos/service" "os" "runtime" diff --git a/cmd/npc/sdk.go b/cmd/npc/sdk.go index b8cc38f..5d199a2 100644 --- a/cmd/npc/sdk.go +++ b/cmd/npc/sdk.go @@ -2,10 +2,10 @@ package main import ( "C" + "ehang.io/nps/client" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/version" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/client" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/version" ) var cl *client.TRPClient diff --git a/cmd/nps/nps.go b/cmd/nps/nps.go index 36141f0..18ea025 100644 --- a/cmd/nps/nps.go +++ b/cmd/nps/nps.go @@ -1,26 +1,26 @@ package main import ( + "ehang.io/nps/lib/install" "flag" - "github.com/cnlh/nps/lib/install" "log" "os" "path/filepath" "runtime" "strings" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/daemon" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/version" + "ehang.io/nps/server" + "ehang.io/nps/server/connection" + "ehang.io/nps/server/tool" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/daemon" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/version" - "github.com/cnlh/nps/server" - "github.com/cnlh/nps/server/connection" - "github.com/cnlh/nps/server/tool" - "github.com/cnlh/nps/web/routers" + "ehang.io/nps/web/routers" "github.com/kardianos/service" ) diff --git a/go.mod b/go.mod index 141d73c..cad2acc 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/cnlh/nps +module ehang.io/nps go 1.13 diff --git a/gui/npc/npc.go b/gui/npc/npc.go index 0c55ed4..516a87a 100644 --- a/gui/npc/npc.go +++ b/gui/npc/npc.go @@ -1,16 +1,16 @@ package main import ( + "ehang.io/nps/client" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/daemon" + "ehang.io/nps/lib/version" "fmt" "fyne.io/fyne" "fyne.io/fyne/app" "fyne.io/fyne/layout" "fyne.io/fyne/widget" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/client" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/daemon" - "github.com/cnlh/nps/lib/version" "io/ioutil" "os" "path" diff --git a/lib/common/util.go b/lib/common/util.go index 1db0d27..71e604e 100755 --- a/lib/common/util.go +++ b/lib/common/util.go @@ -16,7 +16,7 @@ import ( "strings" "sync" - "github.com/cnlh/nps/lib/crypt" + "ehang.io/nps/lib/crypt" ) //Get the corresponding IP address through domain name diff --git a/lib/config/config.go b/lib/config/config.go index 96531e2..62e2d2b 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -6,8 +6,8 @@ import ( "regexp" "strings" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" ) type CommonConfig struct { @@ -241,7 +241,7 @@ func dealTunnel(s string) *file.Tunnel { t.StripPre = item[1] case "multi_account": t.MultiAccount = &file.MultiAccount{} - if common.FileExists(item[1]){ + if common.FileExists(item[1]) { if b, err := common.ReadAllFromFile(item[1]); err != nil { panic(err) } else { diff --git a/lib/conn/conn.go b/lib/conn/conn.go index db03c40..c1ca1b1 100755 --- a/lib/conn/conn.go +++ b/lib/conn/conn.go @@ -3,11 +3,11 @@ package conn import ( "bufio" "bytes" + "ehang.io/nps/lib/goroutine" "encoding/binary" "encoding/json" "errors" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/goroutine" "io" "net" "net/http" @@ -16,11 +16,11 @@ import ( "strings" "time" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/mux" - "github.com/cnlh/nps/lib/rate" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/mux" + "ehang.io/nps/lib/rate" "github.com/xtaci/kcp-go" ) diff --git a/lib/daemon/daemon.go b/lib/daemon/daemon.go index 3c41086..521745c 100644 --- a/lib/daemon/daemon.go +++ b/lib/daemon/daemon.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/cnlh/nps/lib/common" + "ehang.io/nps/lib/common" ) func InitDaemon(f string, runPath string, pidPath string) { diff --git a/lib/daemon/reload.go b/lib/daemon/reload.go index 2db00ac..5216eff 100644 --- a/lib/daemon/reload.go +++ b/lib/daemon/reload.go @@ -8,8 +8,8 @@ import ( "path/filepath" "syscall" + "ehang.io/nps/lib/common" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" ) func init() { diff --git a/lib/file/db.go b/lib/file/db.go index c48df2e..50be394 100644 --- a/lib/file/db.go +++ b/lib/file/db.go @@ -9,9 +9,9 @@ import ( "strings" "sync" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/rate" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/rate" ) type DbUtils struct { diff --git a/lib/file/file.go b/lib/file/file.go index 63f3cb7..beab47f 100644 --- a/lib/file/file.go +++ b/lib/file/file.go @@ -9,8 +9,8 @@ import ( "sync" "sync/atomic" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/rate" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/rate" ) func NewJsonDb(runPath string) *JsonDb { diff --git a/lib/file/obj.go b/lib/file/obj.go index 36c783b..31f3e63 100644 --- a/lib/file/obj.go +++ b/lib/file/obj.go @@ -6,7 +6,7 @@ import ( "sync/atomic" "time" - "github.com/cnlh/nps/lib/rate" + "ehang.io/nps/lib/rate" "github.com/pkg/errors" ) diff --git a/lib/goroutine/pool.go b/lib/goroutine/pool.go index 287c711..ca91d6d 100644 --- a/lib/goroutine/pool.go +++ b/lib/goroutine/pool.go @@ -1,8 +1,8 @@ package goroutine import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" "github.com/panjf2000/ants/v2" "io" "net" diff --git a/lib/install/install.go b/lib/install/install.go index 6156e3f..8973d0d 100644 --- a/lib/install/install.go +++ b/lib/install/install.go @@ -1,11 +1,11 @@ package install import ( + "ehang.io/nps/lib/common" "encoding/json" "errors" "fmt" "github.com/c4milo/unpackit" - "github.com/cnlh/nps/lib/common" "io" "io/ioutil" "log" @@ -50,7 +50,7 @@ func downloadLatest(bin string) string { fmt.Println("the latest version is", version) filename := runtime.GOOS + "_" + runtime.GOARCH + "_" + bin + ".tar.gz" // download latest package - downloadUrl := fmt.Sprintf("https://github.com/cnlh/nps/releases/download/%s/%s", version, filename) + downloadUrl := fmt.Sprintf("https://ehang.io/nps/releases/download/%s/%s", version, filename) fmt.Println("download package from ", downloadUrl) resp, err := http.Get(downloadUrl) if err != nil { diff --git a/lib/mux/conn.go b/lib/mux/conn.go index 85ba1ef..c0a5b7a 100644 --- a/lib/mux/conn.go +++ b/lib/mux/conn.go @@ -1,9 +1,9 @@ package mux import ( + "ehang.io/nps/lib/common" "errors" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" "io" "math" "net" diff --git a/lib/mux/mux.go b/lib/mux/mux.go index 52bd81c..5b591ed 100644 --- a/lib/mux/mux.go +++ b/lib/mux/mux.go @@ -9,8 +9,8 @@ import ( "sync/atomic" "time" + "ehang.io/nps/lib/common" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" ) type Mux struct { diff --git a/lib/mux/mux_test.go b/lib/mux/mux_test.go index 0d71ee4..a3ed3fc 100644 --- a/lib/mux/mux_test.go +++ b/lib/mux/mux_test.go @@ -2,9 +2,9 @@ package mux import ( "bufio" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/goroutine" "fmt" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/goroutine" "io" "log" "net" diff --git a/lib/mux/pmux.go b/lib/mux/pmux.go index f4e9d4a..b8de236 100644 --- a/lib/mux/pmux.go +++ b/lib/mux/pmux.go @@ -12,8 +12,8 @@ import ( "strings" "time" + "ehang.io/nps/lib/common" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" "github.com/pkg/errors" ) diff --git a/lib/mux/queue.go b/lib/mux/queue.go index 9a62fa2..cc80407 100644 --- a/lib/mux/queue.go +++ b/lib/mux/queue.go @@ -1,8 +1,8 @@ package mux import ( + "ehang.io/nps/lib/common" "errors" - "github.com/cnlh/nps/lib/common" "io" "math" "runtime" diff --git a/server/connection/connection.go b/server/connection/connection.go index dbd74ca..aac1c34 100644 --- a/server/connection/connection.go +++ b/server/connection/connection.go @@ -5,9 +5,9 @@ import ( "os" "strconv" + "ehang.io/nps/lib/mux" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/mux" ) var pMux *mux.PortMux diff --git a/server/proxy/base.go b/server/proxy/base.go index 93774f3..7df5921 100644 --- a/server/proxy/base.go +++ b/server/proxy/base.go @@ -6,11 +6,11 @@ import ( "net/http" "sync" + "ehang.io/nps/bridge" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" ) type Service interface { diff --git a/server/proxy/http.go b/server/proxy/http.go index 936aae3..1470c3c 100644 --- a/server/proxy/http.go +++ b/server/proxy/http.go @@ -13,13 +13,13 @@ import ( "strings" "sync" + "ehang.io/nps/bridge" + "ehang.io/nps/lib/cache" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" + "ehang.io/nps/server/connection" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/cache" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server/connection" ) type httpServer struct { diff --git a/server/proxy/https.go b/server/proxy/https.go index 303b92d..3f0be1d 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -6,13 +6,13 @@ import ( "net/url" "sync" + "ehang.io/nps/lib/cache" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/file" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/cache" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" "github.com/pkg/errors" ) diff --git a/server/proxy/p2p.go b/server/proxy/p2p.go index b789ced..7c9b70f 100644 --- a/server/proxy/p2p.go +++ b/server/proxy/p2p.go @@ -5,8 +5,8 @@ import ( "strings" "time" + "ehang.io/nps/lib/common" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" ) type P2PServer struct { diff --git a/server/proxy/socks5.go b/server/proxy/socks5.go index dd27dfd..f2ee2d5 100755 --- a/server/proxy/socks5.go +++ b/server/proxy/socks5.go @@ -7,10 +7,10 @@ import ( "net" "strconv" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" ) const ( diff --git a/server/proxy/tcp.go b/server/proxy/tcp.go index 1f593ba..58ce3e0 100755 --- a/server/proxy/tcp.go +++ b/server/proxy/tcp.go @@ -7,13 +7,13 @@ import ( "path/filepath" "strconv" + "ehang.io/nps/bridge" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" + "ehang.io/nps/server/connection" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server/connection" ) type TunnelModeServer struct { diff --git a/server/proxy/transport.go b/server/proxy/transport.go index d622683..e08bfd0 100644 --- a/server/proxy/transport.go +++ b/server/proxy/transport.go @@ -7,8 +7,8 @@ import ( "strconv" "syscall" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" ) func HandleTrans(c *conn.Conn, s *TunnelModeServer) error { diff --git a/server/proxy/transport_windows.go b/server/proxy/transport_windows.go index cf4c22d..def673b 100644 --- a/server/proxy/transport_windows.go +++ b/server/proxy/transport_windows.go @@ -3,7 +3,7 @@ package proxy import ( - "github.com/cnlh/nps/lib/conn" + "ehang.io/nps/lib/conn" ) func HandleTrans(c *conn.Conn, s *TunnelModeServer) error { diff --git a/server/proxy/udp.go b/server/proxy/udp.go index 958e3c2..abe2c7f 100755 --- a/server/proxy/udp.go +++ b/server/proxy/udp.go @@ -4,11 +4,11 @@ import ( "net" "strings" + "ehang.io/nps/bridge" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/conn" + "ehang.io/nps/lib/file" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" ) type UdpModeServer struct { diff --git a/server/server.go b/server/server.go index 868a94d..b1de97e 100644 --- a/server/server.go +++ b/server/server.go @@ -1,21 +1,21 @@ package server import ( + "ehang.io/nps/lib/version" "errors" - "github.com/cnlh/nps/lib/version" "math" "os" "strconv" "strings" "time" + "ehang.io/nps/bridge" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" + "ehang.io/nps/server/proxy" + "ehang.io/nps/server/tool" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server/proxy" - "github.com/cnlh/nps/server/tool" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/mem" diff --git a/server/test/test.go b/server/test/test.go index 0a8fbfd..a30d03d 100644 --- a/server/test/test.go +++ b/server/test/test.go @@ -5,9 +5,9 @@ import ( "path/filepath" "strconv" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" ) func TestServerConfig() { diff --git a/server/tool/utils.go b/server/tool/utils.go index fb8fa55..09dfaf7 100644 --- a/server/tool/utils.go +++ b/server/tool/utils.go @@ -5,8 +5,8 @@ import ( "strconv" "time" + "ehang.io/nps/lib/common" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/mem" diff --git a/web/controllers/auth.go b/web/controllers/auth.go index 3b6b4c5..9eb22ca 100644 --- a/web/controllers/auth.go +++ b/web/controllers/auth.go @@ -4,8 +4,8 @@ import ( "encoding/hex" "time" + "ehang.io/nps/lib/crypt" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/crypt" ) type AuthController struct { diff --git a/web/controllers/base.go b/web/controllers/base.go index 1ba5a07..426692f 100755 --- a/web/controllers/base.go +++ b/web/controllers/base.go @@ -7,11 +7,11 @@ import ( "strings" "time" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/crypt" + "ehang.io/nps/lib/file" + "ehang.io/nps/server" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server" ) type BaseController struct { diff --git a/web/controllers/client.go b/web/controllers/client.go index 8a3ae31..52bcee8 100644 --- a/web/controllers/client.go +++ b/web/controllers/client.go @@ -1,11 +1,11 @@ package controllers import ( + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" + "ehang.io/nps/lib/rate" + "ehang.io/nps/server" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/rate" - "github.com/cnlh/nps/server" ) type ClientController struct { diff --git a/web/controllers/index.go b/web/controllers/index.go index 5b60495..e28e49a 100755 --- a/web/controllers/index.go +++ b/web/controllers/index.go @@ -1,10 +1,10 @@ package controllers import ( - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server" - "github.com/cnlh/nps/server/tool" - + "ehang.io/nps/lib/file" + "ehang.io/nps/server" + "ehang.io/nps/server/tool" + "github.com/astaxie/beego" ) diff --git a/web/controllers/login.go b/web/controllers/login.go index 39c5c55..5414325 100755 --- a/web/controllers/login.go +++ b/web/controllers/login.go @@ -6,10 +6,10 @@ import ( "sync" "time" + "ehang.io/nps/lib/common" + "ehang.io/nps/lib/file" + "ehang.io/nps/server" "github.com/astaxie/beego" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server" ) type LoginController struct { diff --git a/web/routers/router.go b/web/routers/router.go index 31221eb..51ab97d 100755 --- a/web/routers/router.go +++ b/web/routers/router.go @@ -1,8 +1,8 @@ package routers import ( + "ehang.io/nps/web/controllers" "github.com/astaxie/beego" - "github.com/cnlh/nps/web/controllers" ) func Init() { diff --git a/web/static/page/error.html b/web/static/page/error.html index c063fc3..90f4cf4 100644 --- a/web/static/page/error.html +++ b/web/static/page/error.html @@ -5,6 +5,6 @@ nps error -404 not found,power by nps +404 not found,power by nps \ No newline at end of file diff --git a/web/views/login/index.html b/web/views/login/index.html index ffe89d0..fbe6488 100755 --- a/web/views/login/index.html +++ b/web/views/login/index.html @@ -37,7 +37,7 @@

- goto nps + goto nps

diff --git a/web/views/public/layout.html b/web/views/public/layout.html index a19cc62..04534f5 100755 --- a/web/views/public/layout.html +++ b/web/views/public/layout.html @@ -105,7 +105,7 @@