Skip to content

Commit

Permalink
Merge pull request #478 from ehang-io/dev, close #475, close #461
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ffdfgdfg authored Mar 25, 2020
2 parents f22914c + 1b3dc6d commit c9b7553
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 50 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bash/sh
export VERSION=0.26.5
export VERSION=0.26.6
export GOPROXY=direct

sudo apt-get update
Expand Down
1 change: 0 additions & 1 deletion cmd/npc/npc.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ func run() {
commonConfig.Client = new(file.Client)
commonConfig.Client.Cnf = new(file.Config)
go client.StartLocalServer(localServer, commonConfig)
return
}
env := common.GetEnvMap()
if *serverAddr == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nps/nps.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ type nps struct {

func (p *nps) Start(s service.Service) error {
_, _ = s.Status()
_ = p.run()
go p.run()
return nil
}
func (p *nps) Stop(s service.Service) error {
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](logo.svg)

# NPS <small>0.26.5</small>
# NPS <small>0.26.6</small>

> 一款轻量级、高性能、功能强大的内网穿透代理服务器
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module ehang.io/nps
go 1.13

require (
ehang.io/nps-mux v0.0.0-20200310052025-e00374a8cdb6
ehang.io/nps-mux v0.0.0-20200319121657-f4af26331c9f
fyne.io/fyne v1.2.3
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/astaxie/beego v1.12.0
Expand All @@ -21,7 +21,9 @@ require (
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
github.com/shirou/gopsutil v2.19.11+incompatible
github.com/xtaci/kcp-go v5.4.20+incompatible
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6 // indirect
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d // indirect
)

replace github.com/astaxie/beego => github.com/exfly/beego v1.12.0-export-init
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ehang.io/nps-mux v0.0.0-20200310052025-e00374a8cdb6 h1:kba4642Cj4R9wXrRfxjhP1nSHaA8FwfFQfhA1jX5Spw=
ehang.io/nps-mux v0.0.0-20200310052025-e00374a8cdb6/go.mod h1:hTpHjFEac582vs7OjOaN8R2o3EOPOs2qeBeqTvIQAgs=
ehang.io/nps-mux v0.0.0-20200319121657-f4af26331c9f h1:uAc/HZ939kibvYzVCPc1kp24PEjxxJy/N4Gs3Ybpm1Q=
ehang.io/nps-mux v0.0.0-20200319121657-f4af26331c9f/go.mod h1:hTpHjFEac582vs7OjOaN8R2o3EOPOs2qeBeqTvIQAgs=
fyne.io/fyne v1.2.3 h1:5xwtSBNjxxmg+GF/lYvvf4xPzyjgWQoJVrzb+bt5gaA=
fyne.io/fyne v1.2.3/go.mod h1:JhDdBrPP/Kdr1H5ZT3HW8E/6zlz+GkOldWqSirGBDnY=
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
Expand Down Expand Up @@ -120,6 +120,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6 h1:TjszyFsQsyZNHwdVdZ5m7bjmreu0znc2kRYsEml9/Ww=
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 h1:idBdZTd9UioThJp8KpM/rTSinK/ChZFBE43/WtIy8zg=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
Expand All @@ -139,6 +141,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d h1:62ap6LNOjDU6uGmKXHJbSfciMoV+FeI1sRXx/pLDL44=
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
2 changes: 1 addition & 1 deletion gui/npc/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nps.client"
android:versionCode="1"
android:versionName="0.26.5">
android:versionName="0.26.6">

<application android:label="Npc" android:debuggable="true">
<activity android:name="org.golang.app.GoNativeActivity"
Expand Down
2 changes: 1 addition & 1 deletion lib/version/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package version

const VERSION = "0.26.5"
const VERSION = "0.26.6"

// Compulsory minimum version, Minimum downward compatibility to this version
func GetVersion() string {
Expand Down
4 changes: 0 additions & 4 deletions web/controllers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ func (s *ClientController) Add() {
FlowLimit: int64(s.GetIntNoErr("flow_limit")),
},
}
if t.RateLimit > 0 {
t.Rate = rate.NewRate(int64(t.RateLimit * 1024))
t.Rate.Start()
}
if err := file.GetDb().NewClient(t); err != nil {
s.AjaxErr(err.Error())
}
Expand Down
83 changes: 46 additions & 37 deletions web/views/index/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3 class="ibox-title" langtag="page-add"></h3>
<div class="form-group">
<label class="control-label font-bold" langtag="word-scheme"></label>
<div class="col-sm-10">
<span class="help-block m-b-none font-bold" langtag="word-usecase"></span>:
<span class="help-block m-b-none font-bold" langtag="word-usecase"></span>:
<span id="usecase">
<span id="casetcp" langtag="info-casetcp"></span>
<span id="caseudp" langtag="info-caseudp"></span>
Expand All @@ -24,86 +24,95 @@ <h3 class="ibox-title" langtag="page-add"></h3>
<option value="socks5" langtag="scheme-socks5"></option>
<option value="secret" langtag="scheme-secret"></option>
<option value="p2p" langtag="scheme-p2p"></option>
{{/*<option value="file" langtag="scheme-file"></option>*/}}
{{/*<option value="file" langtag="scheme-file"></option>*/}}
</select>
</div>
</div>

<div class="form-group" id="client_id">
<label class="control-label font-bold" langtag="word-clientid"></label>
<div class="col-sm-10">
<input value="{{.client_id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
<input value="{{.client_id}}" class="form-control" type="text" name="client_id"
placeholder="" langtag="word-clientid">
</div>
</div>

<div class="form-group">
<label class="control-label font-bold" langtag="word-remark"></label>
<div class="col-sm-10">
<input class="form-control" type="text" name="remark" placeholder="" langtag="info-unrestricted">
<input class="form-control" type="text" name="remark" placeholder=""
langtag="info-unrestricted">
</div>
</div>
{{if eq true .allow_multi_ip}}
<div class="form-group" id="server_ip">
<label class="control-label font-bold" langtag="word-serverip"></label>
<div class="col-sm-10">
<input class="form-control" type="text" value="0.0.0.0" name="server_ip" placeholder="" langtag="info-suchasip">
{{if eq true .allow_multi_ip}}
<div class="form-group" id="server_ip">
<label class="control-label font-bold" langtag="word-serverip"></label>
<div class="col-sm-10">
<input class="form-control" type="text" value="0.0.0.0" name="server_ip" placeholder=""
langtag="info-suchasip">
</div>
</div>
</div>
{{end}}
{{end}}
<div class="form-group" id="port">
<label class="control-label font-bold" langtag="word-serverport"></label>
<div class="col-sm-10">
<input class="form-control" type="text" name="port" placeholder="" langtag="info-suchasport">
<input class="form-control" type="text" name="port" placeholder=""
langtag="info-suchasport">
</div>
</div>

{{if eq true .allow_local_proxy}}
<div class="form-group" id="local_proxy">
<label class="control-label font-bold" langtag="word-proxytolocal"></label>
<div class="col-sm-10">
<select class="form-control" name="local_proxy">
<option value="0" langtag="word-no"></option>
<option value="1" langtag="word-yes"></option>
</select>
{{if eq true .allow_local_proxy}}
<div class="form-group" id="local_proxy">
<label class="control-label font-bold" langtag="word-proxytolocal"></label>
<div class="col-sm-10">
<select class="form-control" name="local_proxy">
<option value="0" langtag="word-no"></option>
<option value="1" langtag="word-yes"></option>
</select>
</div>
</div>
</div>
{{end}}
{{end}}

<div class="form-group" id="target">
<label class="control-label font-bold" langtag="word-target"></label>
<div class="col-sm-10">
<textarea class="form-control" name="target" rows="4" placeholder="" langtag="info-suchasiplist"></textarea>
<textarea class="form-control" name="target" rows="4" placeholder=""
langtag="info-suchasiplist"></textarea>
<span class="help-block m-b-none" langtag="info-targettunnel"></span>
</div>
</div>

<div class="form-group" id="local_path">
<label class="control-label font-bold" langtag="word-localpath"></label>
<div class="col-sm-10">
<input class="form-control" type="text" name="local_path" placeholder="" langtag="info-suchaslocalpath">
<input class="form-control" type="text" name="local_path" placeholder=""
langtag="info-suchaslocalpath">
</div>
</div>

<div class="form-group" id="strip_pre">
<label class="control-label font-bold" langtag="word-stripprefix"></label>
<div class="col-sm-10">
<input class="form-control" type="text" name="strip_pre" placeholder="" langtag="info-suchasstripprefix">
<input class="form-control" type="text" name="strip_pre" placeholder=""
langtag="info-suchasstripprefix">
</div>
</div>

<div class="form-group" id="password">
<label class="control-label font-bold" langtag="word-identificationkey"></label>
<div class="col-sm-10">
<input class="form-control" type="text" name="password" placeholder="" langtag="word-identificationkey">
<input class="form-control" type="text" name="password" placeholder=""
langtag="word-identificationkey">
<span class="help-block m-b-none" langtag="info-identificationkey"></span>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-success" type="button" onclick="submitform('add', '{{.web_base_url}}/index/add', $('form').serializeArray())">
<button class="btn btn-success" type="button"
onclick="submitform('add', '{{.web_base_url}}/index/add', $('form').serializeArray())">
<i class="fa fa-fw fa-lg fa-check-circle"></i> <span langtag="word-add"></span>
</button>
</button>
</div>
</div>

Expand All @@ -114,20 +123,20 @@ <h3 class="ibox-title" langtag="page-add"></h3>
</div>
<script>
var arr = []
arr["all"] = ["port", "target", "password", "local_path", "strip_pre", "local_proxy"]
arr["tcp"] = ["port", "target", "local_proxy"]
arr["udp"] = ["port", "target", "local_proxy"]
arr["socks5"] = ["port"]
arr["httpProxy"] = ["port"]
arr["secret"] = ["target", "password"]
arr["p2p"] = ["target", "password"]
arr["file"] = ["port", "local_path", "strip_pre"]
arr["all"] = ["port", "target", "password", "local_path", "strip_pre", "local_proxy", "client_id", "server_ip"]
arr["tcp"] = ["port", "target", "local_proxy", "client_id", "server_ip"]
arr["udp"] = ["port", "target", "local_proxy", "client_id", "server_ip"]
arr["socks5"] = ["port", "client_id", "server_ip"]
arr["httpProxy"] = ["port", "client_id", "server_ip"]
arr["secret"] = ["target", "password", "client_id", "server_ip"]
arr["p2p"] = ["target", "password", "client_id", "server_ip"]
arr["file"] = ["port", "local_path", "strip_pre", "client_id", "server_ip"]

function resetForm() {
$(".form-group[id]").css("display", "none");
$("#usecase span").css("display", "none");
o = $("#type").val();
$('#case'+ o).css("display", "inline")
$('#case' + o).css("display", "inline")
for (var i = 0; i < arr[o].length; i++) {
$("#" + arr[o][i]).css("display", "block")
}
Expand Down

0 comments on commit c9b7553

Please sign in to comment.