add web log

This commit is contained in:
YouROK
2021-04-27 10:52:32 +03:00
parent 5f4b702a1a
commit df1d2e4d2f
4 changed files with 97 additions and 16 deletions

View File

@@ -41,7 +41,7 @@ func Blocker() gin.HandlerFunc {
minifyIP(&ip)
if whiteIpList.NumRanges() > 0 {
if _, ok := whiteIpList.Lookup(ip); !ok {
log.TLogln("Block ip, not in white list", ip.String())
log.WebLogln("Block ip, not in white list", ip.String())
c.String(http.StatusTeapot, "Banned")
c.Abort()
return
@@ -49,7 +49,7 @@ func Blocker() gin.HandlerFunc {
}
if blackIpList.NumRanges() > 0 {
if r, ok := blackIpList.Lookup(ip); ok {
log.TLogln("Block ip, in black list:", ip.String(), "in range", r.Description, ":", r.First, "-", r.Last)
log.WebLogln("Block ip, in black list:", ip.String(), "in range", r.Description, ":", r.First, "-", r.Last)
c.String(http.StatusTeapot, "Banned")
c.Abort()
return