mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
add functions
This commit is contained in:
@@ -42,6 +42,7 @@ func (s *ClientController) Add() {
|
||||
Crypt: s.GetBoolNoErr("crypt"),
|
||||
},
|
||||
RateLimit: s.GetIntNoErr("rate_limit"),
|
||||
MaxConn: s.GetIntNoErr("max_conn"),
|
||||
Flow: &file.Flow{
|
||||
ExportFlow: 0,
|
||||
InletFlow: 0,
|
||||
@@ -94,6 +95,7 @@ func (s *ClientController) Edit() {
|
||||
c.Cnf.Crypt = s.GetBoolNoErr("crypt")
|
||||
c.Flow.FlowLimit = int64(s.GetIntNoErr("flow_limit"))
|
||||
c.RateLimit = s.GetIntNoErr("rate_limit")
|
||||
c.MaxConn = s.GetIntNoErr("max_conn")
|
||||
if c.Rate != nil {
|
||||
c.Rate.Stop()
|
||||
}
|
||||
|
@@ -44,6 +44,12 @@ func (s *IndexController) Http() {
|
||||
s.display("index/list")
|
||||
}
|
||||
|
||||
func (s *IndexController) Secret() {
|
||||
s.SetInfo("私密代理管理")
|
||||
s.SetType("secretServer")
|
||||
s.display("index/list")
|
||||
}
|
||||
|
||||
func (s *IndexController) Host() {
|
||||
s.SetInfo("host模式管理")
|
||||
s.SetType("hostServer")
|
||||
@@ -74,13 +80,14 @@ func (s *IndexController) Add() {
|
||||
s.display()
|
||||
} else {
|
||||
t := &file.Tunnel{
|
||||
Port: s.GetIntNoErr("port"),
|
||||
Mode: s.GetString("type"),
|
||||
Target: s.GetString("target"),
|
||||
Id: file.GetCsvDb().GetTaskId(),
|
||||
Status: true,
|
||||
Remark: s.GetString("remark"),
|
||||
Flow: &file.Flow{},
|
||||
Port: s.GetIntNoErr("port"),
|
||||
Mode: s.GetString("type"),
|
||||
Target: s.GetString("target"),
|
||||
Id: file.GetCsvDb().GetTaskId(),
|
||||
Status: true,
|
||||
Remark: s.GetString("remark"),
|
||||
Password: s.GetString("password"),
|
||||
Flow: &file.Flow{},
|
||||
}
|
||||
if !tool.TestServerPort(t.Port, t.Mode) {
|
||||
s.AjaxErr("The port cannot be opened because it may has been occupied or is no longer allowed.")
|
||||
@@ -126,6 +133,7 @@ func (s *IndexController) Edit() {
|
||||
t.Port = s.GetIntNoErr("port")
|
||||
t.Mode = s.GetString("type")
|
||||
t.Target = s.GetString("target")
|
||||
t.Password = s.GetString("password")
|
||||
t.Id = id
|
||||
t.Remark = s.GetString("remark")
|
||||
if t.Client, err = file.GetCsvDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
|
||||
|
@@ -16,6 +16,10 @@
|
||||
<label class="control-label">速度限制(单位:KB,为空不限制)</label>
|
||||
<input class="form-control" type="text" name="rate_limit" placeholder="为空不限制">
|
||||
</div>
|
||||
<div class="form-group" id="max_conn">
|
||||
<label class="control-label">最大客户端连接数</label>
|
||||
<input class="form-control" type="text" name="max_conn" placeholder="为空不限制">
|
||||
</div>
|
||||
<div class="form-group" id="u">
|
||||
<label class="control-label">验证用户名(仅socks5,web穿透支持)</label>
|
||||
<input class="form-control" type="text" name="u" placeholder="不填则无需验证">
|
||||
|
@@ -19,6 +19,11 @@
|
||||
<input class="form-control" value="{{.c.RateLimit}}" type="text" name="rate_limit"
|
||||
placeholder="为空不限制">
|
||||
</div>
|
||||
<div class="form-group" id="max_conn">
|
||||
<label class="control-label">最大客户端连接数</label>
|
||||
<input class="form-control" value="{{.c.MaxConn}}" type="text" name="max_conn"
|
||||
placeholder="为空不限制">
|
||||
</div>
|
||||
<div class="form-group" id="u">
|
||||
<label class="control-label">验证用户名(仅socks5,web穿透支持)</label>
|
||||
<input class="form-control" value="{{.c.Cnf.U}}" type="text" name="u"
|
||||
|
@@ -11,6 +11,7 @@
|
||||
<option {{if eq "udpServer" .type}}selected{{end}} value="udpServer">udp隧道</option>
|
||||
<option {{if eq "socks5Server" .type}}selected{{end}} value="socks5Server">socks5代理</option>
|
||||
<option {{if eq "httpProxyServer" .type}}selected{{end}} value="httpProxyServer">http代理
|
||||
<option {{if eq "secretServer" .type}}selected{{end}} value="secretServer">私密代理
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -30,6 +31,11 @@
|
||||
<input value="{{.client_id}}" class="form-control" type="text" name="client_id"
|
||||
placeholder="客户端id">
|
||||
</div>
|
||||
<div class="form-group" id="password">
|
||||
<label class="control-label">私密模式唯一密钥</label>
|
||||
<input class="form-control" type="text" name="password"
|
||||
placeholder="私密模式唯一密钥">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tile-footer">
|
||||
@@ -48,6 +54,7 @@
|
||||
arr["udpServer"] = ["type", "port", "target", "compress", "udp隧道模式,提供一条udp隧道,适用于dns、内网dns访问等,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的udp目标端口"]
|
||||
arr["socks5Server"] = ["type", "port", "compress", "u", "p", "socks5代理模式,内网socks5代理,配合proxifer,可如同使用vpn一样访问内网设备或资源,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置socks5代理,即访问内网设备或者资源 "]
|
||||
arr["httpProxyServer"] = ["type", "port", "compress", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
arr["secretServer"] = ["type", "target", "compress", "password", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
|
||||
|
||||
function resetForm() {
|
||||
|
@@ -13,6 +13,7 @@
|
||||
<option {{if eq "socks5Server" .t.Mode}}selected{{end}} value="socks5Server">socks5代理
|
||||
</option>
|
||||
<option {{if eq "httpProxyServer" .t.Mode}}selected{{end}} value="httpProxyServer">http代理
|
||||
<option {{if eq "secretServer" .t.Mode}}selected{{end}} value="secretServer">私密代理
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -34,6 +35,11 @@
|
||||
<input class="form-control" value="{{.t.Client.Id}}" type="text" name="client_id"
|
||||
placeholder="客户端id">
|
||||
</div>
|
||||
<div class="form-group" id="password">
|
||||
<label class="control-label">私密模式唯一密钥</label>
|
||||
<input class="form-control" value="{{.t.Password}}" type="text" name="password"
|
||||
placeholder="私密模式唯一密钥">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tile-footer">
|
||||
@@ -52,6 +58,7 @@
|
||||
arr["udpServer"] = ["type", "port", "target", "compress"]
|
||||
arr["socks5Server"] = ["type", "port", "compress", "u", "p"]
|
||||
arr["httpProxyServer"] = ["type", "port", "compress", "u", "p"]
|
||||
arr["secretServer"] = ["type", "target", "compress", "u", "p","password"]
|
||||
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
|
||||
|
||||
function resetForm() {
|
||||
|
@@ -10,8 +10,8 @@
|
||||
<div class="col-md-3">
|
||||
<div class="widget-small danger coloured-icon"><i class="icon fa fa-home fa-3x"></i>
|
||||
<div class="info">
|
||||
<h4>域名解析数</h4>
|
||||
<p><b>{{.data.hostCount}}</b></p>
|
||||
<h4>当前TCP连接总数</h4>
|
||||
<p><b>{{.data.tcpCount}}</b></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -51,9 +51,11 @@
|
||||
<li><a class="app-menu__item {{if eq "udp" .menu}}active{{end}}" href="/index/udp"><i
|
||||
class="app-menu__icon fa fa-laptop"></i><span class="app-menu__label">udp隧道管理</span></a></li>
|
||||
<li><a class="app-menu__item {{if eq "socks5" .menu}}active{{end}}" href="/index/socks5"><i
|
||||
class="app-menu__icon fa fa-lightbulb-o"></i><span class="app-menu__label">socks5代理</span></a></li>
|
||||
class="app-menu__icon fa fa-lightbulb-o"></i><span class="app-menu__label">socks5代理管理</span></a></li>
|
||||
<li><a class="app-menu__item {{if eq "http" .menu}}active{{end}}" href="/index/http"><i
|
||||
class="app-menu__icon fa fa-magic"></i><span class="app-menu__label">http代理</span></a></li>
|
||||
class="app-menu__icon fa fa-magic"></i><span class="app-menu__label">http代理管理</span></a></li>
|
||||
<li><a class="app-menu__item {{if eq "secret" .menu}}active{{end}}" href="/index/secret"><i
|
||||
class="app-menu__icon fa fa-dashcube"></i><span class="app-menu__label">私密代理管理</span></a></li>
|
||||
<li><a class="app-menu__item {{if eq "help" .menu}}active{{end}}" href="/index/help"><i
|
||||
class="app-menu__icon fa fa-question-circle"></i><span class="app-menu__label">使用说明</span></a></li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user