iplimit - ipv6 support

This commit is contained in:
mhsanaei 2024-09-05 13:59:30 +02:00
parent 5c390341fb
commit 2001d96148

View file

@ -122,13 +122,13 @@ func (j *CheckClientIpJob) processLogFile() bool {
for scanner.Scan() {
line := scanner.Text()
ipRegx, _ := regexp.Compile(`(\d+\.\d+\.\d+\.\d+).* accepted`)
ipRegx, _ := regexp.Compile(`from \[?([0-9a-fA-F:.]+)\]?:\d+ accepted`)
emailRegx, _ := regexp.Compile(`email:.+`)
matches := ipRegx.FindStringSubmatch(line)
if len(matches) > 1 {
ip := matches[1]
if ip == "127.0.0.1" {
if ip == "127.0.0.1" || ip == "::1" {
continue
}