Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-12-16 16:26:47 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-12-16 16:26:47 +0300
commitf0f4f082ae0bc8e53b8db8fd547efe79fed1d6d4 (patch)
treeef760c8712fcbc5e711cbaa2a4b636282837ad68
parentb29bd993d4e2f03b7ec6a61761fa7806458365b3 (diff)
improve iplimit
-rw-r--r--web/job/check_client_ip_job.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go
index 08899010..61f8b724 100644
--- a/web/job/check_client_ip_job.go
+++ b/web/job/check_client_ip_job.go
@@ -151,13 +151,13 @@ func (j *CheckClientIpJob) processLogFile() bool {
}
sort.Strings(ips)
- inboundClientIps, err := j.getInboundClientIps(email)
+ clientIpsRecord, err := j.getInboundClientIps(email)
if err != nil {
j.addInboundClientIps(email, ips)
continue
}
- shouldCleanLog = j.updateInboundClientIps(inboundClientIps, email, ips) || shouldCleanLog
+ shouldCleanLog = j.updateInboundClientIps(clientIpsRecord, email, ips) || shouldCleanLog
}
return shouldCleanLog
@@ -309,12 +309,12 @@ func (j *CheckClientIpJob) updateInboundClientIps(inboundClientIps *model.Inboun
func (j *CheckClientIpJob) getInboundByEmail(clientEmail string) (*model.Inbound, error) {
db := database.GetDB()
- var inbounds *model.Inbound
+ inbound := &model.Inbound{}
- err := db.Model(model.Inbound{}).Where("settings LIKE ?", "%"+clientEmail+"%").Find(&inbounds).Error
+ err := db.Model(&model.Inbound{}).Where("settings LIKE ?", "%"+clientEmail+"%").First(inbound).Error
if err != nil {
return nil, err
}
- return inbounds, nil
+ return inbound, nil
}