forked from yisier/nps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
***新增***:新增全局黑名单IP,用于防止被肉鸡扫描端口或被恶意攻击。 ***新增***:新增客户端上次在线时间。
- Loading branch information
Showing
17 changed files
with
224 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package controllers | ||
|
||
import ( | ||
"ehang.io/nps/lib/file" | ||
"strings" | ||
) | ||
|
||
type GlobalController struct { | ||
BaseController | ||
} | ||
|
||
func (s *GlobalController) Index() { | ||
//if s.Ctx.Request.Method == "GET" { | ||
// | ||
// return | ||
//} | ||
s.Data["menu"] = "global" | ||
s.SetInfo("global") | ||
s.display("global/index") | ||
|
||
global := file.GetDb().GetGlobal() | ||
if global == nil { | ||
return | ||
} | ||
s.Data["globalBlackIpList"] = strings.Join(global.BlackIpList, "\r\n") | ||
} | ||
|
||
//添加全局黑名单IP | ||
func (s *GlobalController) Save() { | ||
//global, err := file.GetDb().GetGlobal() | ||
//if err != nil { | ||
// return | ||
//} | ||
if s.Ctx.Request.Method == "GET" { | ||
s.Data["menu"] = "global" | ||
s.SetInfo("save global") | ||
s.display() | ||
} else { | ||
|
||
t := &file.Glob{BlackIpList: RemoveRepeatedElement(strings.Split(s.getEscapeString("globalBlackIpList"), "\r\n"))} | ||
|
||
if err := file.GetDb().SaveGlobal(t); err != nil { | ||
s.AjaxErr(err.Error()) | ||
} | ||
s.AjaxOk("save success") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div class="wrapper wrapper-content"> | ||
<!--全局参数--> | ||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<div class="ibox float-e-margins"> | ||
<div class="ibox-title"> | ||
<h5 langtag="word-globalparam"></h5> | ||
</div> | ||
<div class="ibox-content"> | ||
|
||
<form class="form-horizontal"> | ||
<div class="form-group" id="black_ip_list"> | ||
<label class="control-label font-bold" langtag="word-globalblackiplist"></label> | ||
<div class="col-sm-4"> | ||
<textarea class="form-control" rows="10" type="text" name="globalBlackIpList" placeholder="" | ||
langtag="info-suchasblackiplist">{{.globalBlackIpList}}</textarea> | ||
<span class="help-block m-b-none" langtag="info-descblackiplist"></span> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-sm-4 col-sm-offset-2"> | ||
<button class="btn btn-success" type="button" | ||
onclick="submitform('global', '{{.web_base_url}}/global/save', $('form').serializeArray())"> | ||
<i class="fa fa-fw fa-lg fa-check-circle"></i> <span langtag="word-save"></span> | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
<script> | ||
window.addEventListener('resize', () => { | ||
for (var key in charts) { | ||
charts[key].resize(); | ||
} | ||
}); | ||
</script> |
Oops, something went wrong.