1
0

add.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <div class="row tile">
  2. <div class="col-md-12 col-md-auto">
  3. <div class="ibox float-e-margins">
  4. <h3 class="ibox-title">add</h3>
  5. <div class="ibox-content">
  6. <form class="form-horizontal">
  7. <div class="form-group">
  8. <label class="col-sm-2 control-label" langtag="info-mode">类型 </label>
  9. <div class="col-sm-10">
  10. <select class="form-control" name="type" id="type">
  11. <option {{if eq "tcp" .type}}selected{{end}} value="tcp">tcp</option>
  12. <option {{if eq "udp" .type}}selected{{end}} value="udp">udp</option>
  13. <option {{if eq "socks5" .type}}selected{{end}} value="socks5">socks5
  14. </option>
  15. <option {{if eq "httpProxy" .type}}selected{{end}} value="httpProxy">http</option>
  16. <option {{if eq "secret" .type}}selected{{end}} value="secret">secret</option>
  17. <option {{if eq "p2p" .type}}selected{{end}} value="p2p">p2p</option>
  18. {{/*<option {{if eq "file" .type}}selected{{end}} value="file">file*/}}
  19. </select>
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="col-sm-2 control-label" langtag="info-remark">备注</label>
  24. <div class="col-sm-10">
  25. <input class="form-control" type="text" name="remark"
  26. placeholder="empty means to be unrestricted">
  27. </div>
  28. </div>
  29. <div class="form-group" id="server_ip">
  30. <label class="col-sm-2 control-label" langtag="info-server-ip">服务端ip</label>
  31. <div class="col-sm-10">
  32. <input class="form-control" type="text" value="0.0.0.0" name="server_ip"
  33. placeholder="such as 0.0.0.0">
  34. </div>
  35. </div>
  36. <div class="form-group" id="port">
  37. <label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
  38. <div class="col-sm-10">
  39. <input class="form-control" type="text" name="port" placeholder="such as 8024">
  40. </div>
  41. </div>
  42. <div class="form-group" id="target">
  43. <label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
  44. <div class="col-sm-10">
  45. <textarea class="form-control" name="target" rows="4" placeholder="10.1.50.203:22
  46. 10.1.50.202:22"></textarea>
  47. <span class="help-block m-b-none">can only fill in ports if it is local machine proxy, only tcp supports load balancing
  48. </span>
  49. </div>
  50. </div>
  51. <div class="form-group" id="client_id">
  52. <label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
  53. <div class="col-sm-10">
  54. <input value="{{.client_id}}" class="form-control" type="text" name="client_id"
  55. placeholder="id of client">
  56. </div>
  57. </div>
  58. <div class="form-group" id="local_path">
  59. <label class="col-sm-2 control-label" langtag="info-local-path">本地路径</label>
  60. <div class="col-sm-10">
  61. <input class="form-control" type="text" name="local_path"
  62. placeholder="such as /tmp">
  63. </div>
  64. </div>
  65. <div class="form-group" id="strip_pre">
  66. <label class="col-sm-2 control-label" langtag="info-strip-pre">访问前缀</label>
  67. <div class="col-sm-10">
  68. <input class="form-control" type="text" name="strip_pre"
  69. placeholder="such as static">
  70. </div>
  71. </div>
  72. <div class="form-group" id="password">
  73. <label class="col-sm-2 control-label" langtag="info-unique-vkey">唯一验证密钥</label>
  74. <div class="col-sm-10">
  75. <input class="form-control" type="text" name="password"
  76. placeholder="unique identification key">
  77. <span class="help-block m-b-none">when p2p or secret</span>
  78. </div>
  79. </div>
  80. <div class="hr-line-dashed"></div>
  81. <div class="form-group">
  82. <div class="col-sm-4 col-sm-offset-2">
  83. &nbsp;<button class="btn btn-success" href="#" id="add"><i
  84. class="fa fa-fw fa-lg fa-eye"></i>新增
  85. </button>
  86. </div>
  87. </div>
  88. </form>
  89. </div>
  90. &nbsp;
  91. </div>
  92. </div>
  93. </div>
  94. <script>
  95. var arr = []
  96. arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "strip_pre", "local_path"]
  97. arr["tcp"] = ["type", "port", "target", "compress", "u", "p", "tcp隧道模式,提供一条tcp隧道,适用于ssh、远程桌面等,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的目标端口"]
  98. arr["udp"] = ["type", "port", "target", "compress", "udp隧道模式,提供一条udp隧道,适用于dns、内网dns访问等,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的udp目标端口"]
  99. 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代理,即访问内网设备或者资源 "]
  100. arr["httpProxy"] = ["type", "port", "compress", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
  101. arr["secret"] = ["type", "target", "compress", "password", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
  102. arr["p2p"] = ["type", "compress", "password", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
  103. arr["file"] = ["type", "strip_pre", "local_path", "port", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
  104. arrClientHide = ["compress", "u", "p", "crypt", "mux"]
  105. function resetForm() {
  106. for (var i = 0; i < arr["all"].length; i++) {
  107. $("#" + arr["all"][i]).css("display", "none")
  108. }
  109. o = $("#type option:selected").val()
  110. for (var i = 0; i < arr[o].length - 1; i++) {
  111. $("#" + arr[o][i]).css("display", "block")
  112. }
  113. $("#info").html(arr[o][arr[o].length - 1])
  114. }
  115. function resetClientCnf() {
  116. for (var i = 0; i < arrClientHide.length; i++) {
  117. $("#" + arrClientHide[i]).css("display", "block")
  118. }
  119. op = $("#use_client option:selected").val()
  120. if (op == 1) {
  121. for (var i = 0; i < arrClientHide.length; i++) {
  122. $("#" + arrClientHide[i]).css("display", "none")
  123. }
  124. }
  125. }
  126. $(function () {
  127. resetForm()
  128. resetClientCnf()
  129. $("#type").on("change", function () {
  130. resetForm()
  131. resetClientCnf()
  132. })
  133. $("#use_client").on("change", function () {
  134. resetForm()
  135. resetClientCnf()
  136. })
  137. $("#add").on("click", function () {
  138. $.ajax({
  139. type: "POST",
  140. url: "/index/add",
  141. data: $("form").serializeArray(),
  142. success: function (res) {
  143. alert(res.msg)
  144. if (res.status) {
  145. history.back(-1)
  146. }
  147. }
  148. })
  149. })
  150. })
  151. </script>