mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
Port mux| https|tls crypt
This commit is contained in:
@@ -15,11 +15,11 @@ func (s *AuthController) GetAuthKey() {
|
||||
s.Data["json"] = m
|
||||
s.ServeJSON()
|
||||
}()
|
||||
if cryptKey := beego.AppConfig.String("cryptKey"); len(cryptKey) != 16 {
|
||||
if cryptKey := beego.AppConfig.String("auth_crypt_key"); len(cryptKey) != 16 {
|
||||
m["status"] = 0
|
||||
return
|
||||
} else {
|
||||
b, err := crypt.AesEncrypt([]byte(beego.AppConfig.String("authKey")), []byte(cryptKey))
|
||||
b, err := crypt.AesEncrypt([]byte(beego.AppConfig.String("auth_key")), []byte(cryptKey))
|
||||
if err != nil {
|
||||
m["status"] = 0
|
||||
return
|
||||
|
@@ -50,6 +50,10 @@ func (s *BaseController) display(tpl ...string) {
|
||||
arr := strings.Split(common.GetHostByName(ip), ":")
|
||||
s.Data["ip"] = arr[0]
|
||||
}
|
||||
s.Data["bridgeType"] = beego.AppConfig.String("bridge_type")
|
||||
if common.IsWindows() {
|
||||
s.Data["win"] = ".exe"
|
||||
}
|
||||
s.Data["p"] = server.Bridge.TunnelPort
|
||||
s.Data["proxyPort"] = beego.AppConfig.String("hostPort")
|
||||
s.Layout = "public/layout.html"
|
||||
|
@@ -239,6 +239,7 @@ func (s *IndexController) AddHost() {
|
||||
Remark: s.GetString("remark"),
|
||||
Location: s.GetString("location"),
|
||||
Flow: &file.Flow{},
|
||||
Scheme: s.GetString("scheme"),
|
||||
}
|
||||
var err error
|
||||
if h.Client, err = file.GetCsvDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
|
||||
@@ -273,6 +274,7 @@ func (s *IndexController) EditHost() {
|
||||
h.Remark = s.GetString("remark")
|
||||
h.TargetArr = nil
|
||||
h.Location = s.GetString("location")
|
||||
h.Scheme = s.GetString("scheme")
|
||||
file.GetCsvDb().UpdateHost(h)
|
||||
var err error
|
||||
if h.Client, err = file.GetCsvDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
|
||||
|
@@ -12,7 +12,7 @@ func (self *LoginController) Index() {
|
||||
self.TplName = "login/index.html"
|
||||
}
|
||||
func (self *LoginController) Verify() {
|
||||
if self.GetString("password") == beego.AppConfig.String("password") && self.GetString("username") == beego.AppConfig.String("username") {
|
||||
if self.GetString("password") == beego.AppConfig.String("web_password") && self.GetString("username") == beego.AppConfig.String("web_username") {
|
||||
self.SetSession("auth", true)
|
||||
self.Data["json"] = map[string]interface{}{"status": 1, "msg": "login success"}
|
||||
self.ServeJSON()
|
||||
|
@@ -129,7 +129,7 @@
|
||||
+ '<b>compress: </b>' + row.Cnf.Compress + `       `
|
||||
+ '<b>username: </b>' + row.Cnf.U + `       `
|
||||
+ '<b>password: </b>' + row.Cnf.P + `       ` + "<br/><br>"
|
||||
+ '<b>commond: </b>' + "<code>./npc -server={{.ip}}:{{.p}} -vkey=" + row.VerifyKey + "</code>"
|
||||
+ '<b>commond: </b>' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.VerifyKey + " -type=" +{{.bridgeType}} +"</code>"
|
||||
},
|
||||
//表格的列
|
||||
columns: [
|
||||
|
@@ -16,6 +16,16 @@
|
||||
<input class="form-control" type="text" name="host" placeholder="such as a.proxy.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="scheme">
|
||||
<label class="control-label col-sm-2">scheme</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="scheme">
|
||||
<option value="all">all</option>
|
||||
<option value="http">http</option>
|
||||
<option value="https">https</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">url router</label>
|
||||
<div class="col-sm-10">
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
<div class="row tile">
|
||||
<div class="col-md-12 col-md-auto">
|
||||
<div class="ibox float-e-margins">
|
||||
@@ -9,13 +8,25 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">remark</label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Remark}}" class="form-control" type="text" name="remark" placeholder="remark">
|
||||
<input value="{{.h.Remark}}" class="form-control" type="text" name="remark"
|
||||
placeholder="remark">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">host</label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Host}}" class="form-control" type="text" name="host" placeholder="such as a.proxy.com">
|
||||
<input value="{{.h.Host}}" class="form-control" type="text" name="host"
|
||||
placeholder="such as a.proxy.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="scheme">
|
||||
<label class="control-label col-sm-2">scheme</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="scheme">
|
||||
<option {{if eq "all" .h.Scheme}}selected{{end}} value="all">all</option>
|
||||
<option {{if eq "http" .h.Scheme}}selected{{end}} value="http">http</option>
|
||||
<option {{if eq "https" .h.Scheme}}selected{{end}} value="https">https</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@@ -97,6 +97,12 @@
|
||||
visible: true,//false表示不显示
|
||||
sortable: true,//启用排序
|
||||
},
|
||||
{
|
||||
field: 'Scheme',//域值
|
||||
title: 'scheme',//标题
|
||||
visible: true,//false表示不显示
|
||||
sortable: true,//启用排序
|
||||
},
|
||||
{
|
||||
field: 'Target',//域值
|
||||
title: 'target',//标题
|
||||
|
Reference in New Issue
Block a user