2018-12-11 08:37:12 +00:00
|
|
|
<div class="row tile">
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-md-12 col-md-auto">
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<h3 class="ibox-title">编辑</h3>
|
|
|
|
<div class="ibox-content">
|
|
|
|
<form class="form-horizontal">
|
2019-01-25 04:10:12 +00:00
|
|
|
<input type="hidden" name="id" value="{{.t.Id}}">
|
2018-12-11 08:37:12 +00:00
|
|
|
<div class="form-group">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-mode">类型 </label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
|
|
|
<select class="form-control" name="type" id="type">
|
|
|
|
<option {{if eq "tcp" .t.Mode}}selected{{end}} value="tcp">tcp</option>
|
|
|
|
<option {{if eq "udp" .t.Mode}}selected{{end}} value="udp">udp</option>
|
|
|
|
<option {{if eq "socks5" .t.Mode}}selected{{end}} value="socks5">socks5
|
|
|
|
</option>
|
2019-03-02 09:43:21 +00:00
|
|
|
<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>
|
2019-03-01 09:23:14 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
2018-12-11 08:37:12 +00:00
|
|
|
</div>
|
2019-03-01 09:23:14 +00:00
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
<div class="form-group">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-remark">备注</label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
|
|
|
<input value="{{.t.Remark}}" class="form-control" type="text" name="remark"
|
|
|
|
placeholder="empty means to be unrestricted">
|
|
|
|
</div>
|
2019-01-25 04:10:12 +00:00
|
|
|
</div>
|
2019-03-26 15:34:55 +00:00
|
|
|
<div class="form-group" id="server_ip">
|
|
|
|
<label class="col-sm-2 control-label" langtag="info-server-ip">服务端ip</label>
|
|
|
|
<div class="col-sm-10">
|
|
|
|
<input class="form-control" type="text" value="{{.t.ServerIp}}" name="server_ip"
|
|
|
|
placeholder="such as 0.0.0.0">
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-11 08:37:12 +00:00
|
|
|
<div class="form-group" id="port">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
2019-03-02 09:43:21 +00:00
|
|
|
<input value="{{.t.Port}}" class="form-control" type="text" name="port"
|
|
|
|
placeholder="such as 8024">
|
2019-03-01 09:23:14 +00:00
|
|
|
</div>
|
2018-12-11 08:37:12 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group" id="target">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
2019-03-07 10:07:53 +00:00
|
|
|
<textarea class="form-control" name="target" rows="4" placeholder="10.1.50.203:22
|
2019-03-29 02:41:57 +00:00
|
|
|
10.1.50.202:22">{{.t.Target.TargetStr}}</textarea>
|
2019-03-07 10:07:53 +00:00
|
|
|
<span class="help-block m-b-none">can only fill in ports if it is local machine proxy, only tcp supports load balancing
|
|
|
|
|
2019-03-23 14:19:59 +00:00
|
|
|
</span></div>
|
2018-12-11 08:37:12 +00:00
|
|
|
</div>
|
2019-03-01 09:23:14 +00:00
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
<div class="form-group" id="client_id">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
2019-03-02 09:43:21 +00:00
|
|
|
<input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text"
|
|
|
|
name="client_id"
|
2019-03-01 09:23:14 +00:00
|
|
|
placeholder="id of client">
|
|
|
|
</div>
|
2019-01-25 04:10:12 +00:00
|
|
|
</div>
|
2019-03-01 09:23:14 +00:00
|
|
|
|
2019-03-02 09:43:21 +00:00
|
|
|
<div class="form-group" id="local_path">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-local-path">本地路径</label>
|
2019-03-02 09:43:21 +00:00
|
|
|
<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">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-strip-pre">访问前缀</label>
|
2019-03-02 09:43:21 +00:00
|
|
|
<div class="col-sm-10">
|
|
|
|
<input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre"
|
|
|
|
placeholder="such as static">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-02-23 15:29:48 +00:00
|
|
|
<div class="form-group" id="password">
|
2019-03-23 14:19:59 +00:00
|
|
|
<label class="col-sm-2 control-label" langtag="info-unique-vkey">唯一验证密钥</label>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="col-sm-10">
|
|
|
|
<input value="{{.t.Password}}" class="form-control" type="text" name="password"
|
|
|
|
placeholder="unique identification key">
|
|
|
|
<span class="help-block m-b-none">when p2p or secret</span>
|
|
|
|
</div>
|
2019-02-23 15:29:48 +00:00
|
|
|
</div>
|
2019-03-01 09:23:14 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-4 col-sm-offset-2">
|
|
|
|
<button class="btn btn-success" href="#" id="add"><i
|
2019-03-29 02:41:57 +00:00
|
|
|
class="fa fa-fw fa-lg fa-eye"></i><span langtag="info-save">保存</span>
|
2019-03-02 09:43:21 +00:00
|
|
|
</button>
|
2019-03-01 09:23:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-12-11 08:37:12 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
var arr = []
|
2019-03-02 09:43:21 +00:00
|
|
|
arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "local_path", "strip_pre"]
|
2019-03-01 09:23:14 +00:00
|
|
|
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"]
|
2019-03-02 09:43:21 +00:00
|
|
|
arr["secret"] = ["type", "target", "compress", "u", "p", "password"]
|
|
|
|
arr["p2p"] = ["type", "password"]
|
|
|
|
arr["file"] = ["type", "port", "local_path", "strip_pre"]
|
2019-01-25 04:10:12 +00:00
|
|
|
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
|
2018-12-11 08:37:12 +00:00
|
|
|
|
|
|
|
function resetForm() {
|
|
|
|
for (var i = 0; i < arr["all"].length; i++) {
|
|
|
|
$("#" + arr["all"][i]).css("display", "none")
|
|
|
|
}
|
|
|
|
o = $("#type option:selected").val()
|
|
|
|
for (var i = 0; i < arr[o].length; i++) {
|
|
|
|
$("#" + arr[o][i]).css("display", "block")
|
|
|
|
}
|
|
|
|
}
|
2019-01-02 17:44:45 +00:00
|
|
|
|
2019-01-25 04:10:12 +00:00
|
|
|
function resetClientCnf() {
|
|
|
|
for (var i = 0; i < arrClientHide.length; i++) {
|
|
|
|
$("#" + arrClientHide[i]).css("display", "block")
|
|
|
|
}
|
|
|
|
op = $("#use_client option:selected").val()
|
|
|
|
if (op == 1) {
|
|
|
|
for (var i = 0; i < arrClientHide.length; i++) {
|
|
|
|
$("#" + arrClientHide[i]).css("display", "none")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-11 08:37:12 +00:00
|
|
|
$(function () {
|
|
|
|
resetForm()
|
2019-01-25 04:10:12 +00:00
|
|
|
resetClientCnf()
|
2018-12-11 08:37:12 +00:00
|
|
|
$("#type").on("change", function () {
|
|
|
|
resetForm()
|
2019-01-25 04:10:12 +00:00
|
|
|
resetClientCnf()
|
|
|
|
})
|
|
|
|
$("#use_client").on("change", function () {
|
|
|
|
resetForm()
|
|
|
|
resetClientCnf()
|
2018-12-11 08:37:12 +00:00
|
|
|
})
|
|
|
|
$("#add").on("click", function () {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "/index/edit",
|
|
|
|
data: $("form").serializeArray(),
|
|
|
|
success: function (res) {
|
|
|
|
alert(res.msg)
|
|
|
|
if (res.status) {
|
|
|
|
history.back(-1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|