File mode|pubVkey optimization

This commit is contained in:
刘河
2019-03-02 17:43:21 +08:00
parent f526c56784
commit 1c1aa5ec5b
29 changed files with 477 additions and 195 deletions

View File

@@ -43,6 +43,11 @@ func (s *IndexController) Http() {
s.SetType("httpProxy")
s.display("index/list")
}
func (s *IndexController) File() {
s.SetInfo("file server")
s.SetType("file")
s.display("index/list")
}
func (s *IndexController) Secret() {
s.SetInfo("secret")
@@ -85,14 +90,16 @@ 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"),
Password: s.GetString("password"),
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"),
LocalPath: s.GetString("local_path"),
StripPre: s.GetString("strip_pre"),
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.")
@@ -101,7 +108,9 @@ func (s *IndexController) Add() {
if t.Client, err = file.GetCsvDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
s.AjaxErr(err.Error())
}
file.GetCsvDb().NewTask(t)
if err := file.GetCsvDb().NewTask(t); err != nil {
s.AjaxErr(err.Error())
}
if err := server.AddTask(t); err != nil {
s.AjaxErr(err.Error())
} else {
@@ -140,11 +149,15 @@ func (s *IndexController) Edit() {
t.Target = s.GetString("target")
t.Password = s.GetString("password")
t.Id = id
t.LocalPath = s.GetString("local_path")
t.StripPre = s.GetString("strip_pre")
t.Remark = s.GetString("remark")
if t.Client, err = file.GetCsvDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
s.AjaxErr("modified error")
}
file.GetCsvDb().UpdateTask(t)
server.StopServer(t.Id)
server.StartTask(t.Id)
}
s.AjaxOk("modified success")
}

View File

@@ -150,6 +150,13 @@
title: 'key',//标题
visible: true,//false表示不显示
sortable: true,//启用排序
formatter: function (value, row, index) {
if (!row.NoStore) {
return value
} else {
return "public vkey"
}
}
},
{
field: 'Addr',//域值

View File

@@ -12,9 +12,10 @@
<option {{if eq "udp" .type}}selected{{end}} value="udp">udp</option>
<option {{if eq "socks5" .type}}selected{{end}} value="socks5">socks5
</option>
<option {{if eq "httpProxy" .type}}selected{{end}} value="httpProxy">http
<option {{if eq "secret" .type}}selected{{end}} value="secret">secret
<option {{if eq "p2p" .type}}selected{{end}} value="p2p">p2p
<option {{if eq "httpProxy" .type}}selected{{end}} value="httpProxy">http</option>
<option {{if eq "secret" .type}}selected{{end}} value="secret">secret</option>
<option {{if eq "p2p" .type}}selected{{end}} value="p2p">p2p</option>
{{/*<option {{if eq "file" .type}}selected{{end}} value="file">file*/}}
</select>
</div>
</div>
@@ -33,6 +34,7 @@
<input class="form-control" type="text" name="port" placeholder="such as 8024">
</div>
</div>
<div class="form-group" id="target">
<label class="col-sm-2 control-label">target of Intranet(ip:port)</label>
<div class="col-sm-10">
@@ -50,6 +52,22 @@
</div>
</div>
<div class="form-group" id="local_path">
<label class="col-sm-2 control-label">local path</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="local_path"
placeholder="such as /tmp">
</div>
</div>
<div class="form-group" id="strip_pre">
<label class="col-sm-2 control-label">strip pre</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="strip_pre"
placeholder="such as static">
</div>
</div>
<div class="form-group" id="password">
<label class="col-sm-2 control-label">unique identification key</label>
<div class="col-sm-10">
@@ -75,13 +93,14 @@
</div>
<script>
var arr = []
arr["all"] = ["type", "port", "compress", "u", "p", "target", "password"]
arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "strip_pre", "local_path"]
arr["tcp"] = ["type", "port", "target", "compress", "u", "p", "tcp隧道模式提供一条tcp隧道适用于ssh、远程桌面等添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的目标端口"]
arr["udp"] = ["type", "port", "target", "compress", "udp隧道模式提供一条udp隧道适用于dns、内网dns访问等添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后访问公网服务器的设定端口则相当于访问内网目标地址的udp目标端口"]
arr["socks5"] = ["type", "port", "compress", "u", "p", "socks5代理模式内网socks5代理配合proxifer可如同使用vpn一样访问内网设备或资源添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后在外网环境下本机配置socks5代理即访问内网设备或者资源 "]
arr["httpProxy"] = ["type", "port", "compress", "u", "p", " http代理模式内网http代理可访问内网网站添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后在外网环境下本机配置http代理即访问内网站点"]
arr["secret"] = ["type", "target", "compress", "password", "u", "p", " http代理模式内网http代理可访问内网网站添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后在外网环境下本机配置http代理即访问内网站点"]
arr["p2p"] = ["type", "compress", "password", "u", "p", " http代理模式内网http代理可访问内网网站添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后在外网环境下本机配置http代理即访问内网站点"]
arr["file"] = ["type", "strip_pre", "local_path", "port", " http代理模式内网http代理可访问内网网站添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后在外网环境下本机配置http代理即访问内网站点"]
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
function resetForm() {

View File

@@ -13,9 +13,10 @@
<option {{if eq "udp" .t.Mode}}selected{{end}} value="udp">udp</option>
<option {{if eq "socks5" .t.Mode}}selected{{end}} value="socks5">socks5
</option>
<option {{if eq "httpProxy" .t.Mode}}selected{{end}} value="httpProxy">http
<option {{if eq "secret" .t.Mode}}selected{{end}} value="secret">secret
<option {{if eq "p2p" .t.Mode}}selected{{end}} value="p2p">p2p
<option {{if eq "httpProxy" .t.Mode}}selected{{end}} value="httpProxy">http</option>
<option {{if eq "secret" .t.Mode}}selected{{end}} value="secret">secret</option>
<option {{if eq "p2p" .t.Mode}}selected{{end}} value="p2p">p2p</option>
<option {{if eq "file" .t.Mode}}selected{{end}} value="file">file</option>
</select>
</div>
</div>
@@ -31,7 +32,8 @@
<div class="form-group" id="port">
<label class="col-sm-2 control-label">port of server</label>
<div class="col-sm-10">
<input value="{{.t.Port}}" class="form-control" type="text" name="port" placeholder="such as 8024">
<input value="{{.t.Port}}" class="form-control" type="text" name="port"
placeholder="such as 8024">
</div>
</div>
<div class="form-group" id="target">
@@ -46,11 +48,28 @@
<div class="form-group" id="client_id">
<label class="col-sm-2 control-label">id of client</label>
<div class="col-sm-10">
<input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text" name="client_id"
<input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text"
name="client_id"
placeholder="id of client">
</div>
</div>
<div class="form-group" id="local_path">
<label class="col-sm-2 control-label">local path</label>
<div class="col-sm-10">
<input value="{{.t.LocalPath}}" class="form-control" type="text" name="local_path"
placeholder="such as /tmp">
</div>
</div>
<div class="form-group" id="strip_pre">
<label class="col-sm-2 control-label">strip pre</label>
<div class="col-sm-10">
<input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre"
placeholder="such as static">
</div>
</div>
<div class="form-group" id="password">
<label class="col-sm-2 control-label">unique identification key</label>
<div class="col-sm-10">
@@ -63,8 +82,8 @@
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-success" href="#" id="add"><i
class="fa fa-fw fa-lg fa-eye"></i>save
</button>
class="fa fa-fw fa-lg fa-eye"></i>save
</button>
</div>
</div>
@@ -73,17 +92,16 @@
</div>
</div>
</div>
</main>
<script>
var arr = []
arr["all"] = ["type", "port", "compress", "u", "p", "target","password"]
arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "local_path", "strip_pre"]
arr["tcp"] = ["type", "port", "target", "u", "p", "compress"]
arr["udp"] = ["type", "port", "target", "compress"]
arr["socks5"] = ["type", "port", "compress", "u", "p"]
arr["httpProxy"] = ["type", "port", "compress", "u", "p"]
arr["secret"] = ["type", "target", "compress", "u", "p","password"]
arr["p2p"] = ["type", "compress", "u", "p","password"]
arr["secret"] = ["type", "target", "compress", "u", "p", "password"]
arr["p2p"] = ["type", "password"]
arr["file"] = ["type", "port", "local_path", "strip_pre"]
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
function resetForm() {

View File

@@ -1,78 +1,22 @@
{{/*<div class="row">*/}}
{{/*<div class="col-md-3">*/}}
{{/*<div class="widget-small warning coloured-icon"><i class="icon fa fa-html5 fa-3x"></i>*/}}
{{/*<div class="info">*/}}
{{/*<h4>客户端连接端口</h4>*/}}
{{/*<p><b>{{.p}}</b></p>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*<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>当前TCP连接总数</h4>*/}}
{{/*<p><b>{{.data.tcpCount}}</b></p>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*<div class="col-md-3">*/}}
{{/*<div class="widget-small primary coloured-icon"><i class="icon fa fa-users fa-3x"></i>*/}}
{{/*<div class="info">*/}}
{{/*<h4>总客户端数</h4>*/}}
{{/*<p><b>{{.data.clientCount}}</b></p>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*<div class="col-md-3">*/}}
{{/*<div class="widget-small info coloured-icon"><i class="icon fa fa-user-secret fa-3x"></i>*/}}
{{/*<div class="info">*/}}
{{/*<h4>在线客户端数</h4>*/}}
{{/*<p><b>{{.data.clientOnlineCount}}</b></p>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*<div class="row">*/}}
{{/*<div class="col-md-6">*/}}
{{/*<div class="tile">*/}}
{{/*<h3 class="tile-title">流量</h3>*/}}
{{/*<div id="flow" style="width: 600px;height:400px;"></div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*<div class="col-md-6">*/}}
{{/*<div class="tile">*/}}
{{/*<h3 class="tile-title">代理类型</h3>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
{{/*</div>*/}}
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-lg-3">
<div class="ibox float-e-margins">
<div class="ibox-title">
{{/*<span class="label label-success pull-right">月</span>*/}}
<h5>client connection port</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins">{{.p}}</h1>
{{/*<div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div>*/}}
{{/*<small>总收入</small>*/}}
</div>
</div>
</div>
<div class="col-lg-3">
<div class="ibox float-e-margins">
<div class="ibox-title">
{{/*<span class="label label-info pull-right">季</span>*/}}
<h5>number of clients</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins">{{.data.clientCount}}</h1>
{{/*<div class="stat-percent font-bold text-info">20% <i class="fa fa-level-up"></i></div>*/}}
{{/*<small>新订单</small>*/}}
</div>
</div>
</div>
@@ -92,13 +36,10 @@
<div class="col-lg-3">
<div class="ibox float-e-margins">
<div class="ibox-title">
{{/*<span class="label label-danger pull-right">低值</span>*/}}
<h5>number of tcp connections</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins">{{.data.tcpCount}}</h1>
{{/*<div class="stat-percent font-bold text-danger">38% <i class="fa fa-level-down"></i></div>*/}}
{{/*<small>第一个月</small>*/}}
</div>
</div>
</div>

View File

@@ -73,6 +73,9 @@
<li class="{{if eq "p2p" .menu}}active{{end}}">
<a href="/index/p2p"><i class="fa fa-dashcube"></i> <span class="nav-label">p2p</span></a>
</li>
<li class="{{if eq "file" .menu}}active{{end}}">
<a href="/index/file"><i class="fa fa-laptop"></i> <span class="nav-label">file</span></a>
</li>
</ul>
</div>