diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-08-17 14:37:49 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-08-17 14:37:49 +0300 |
| commit | 6b23b416a788aedeacd75e445f8b1a919c2cf5c8 (patch) | |
| tree | 197e6eb293fa83c1bec6ee9acbdfdf7b6a61060c /web/job | |
| parent | 16f53ce4c2c67997e94dd39483487eb64eac5e25 (diff) | |
minor changes
Diffstat (limited to 'web/job')
| -rw-r--r-- | web/job/check_client_ip_job.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go index b95c8ee2..5a30b616 100644 --- a/web/job/check_client_ip_job.go +++ b/web/job/check_client_ip_job.go @@ -11,7 +11,6 @@ import ( "sort" "time" - "slices" "x-ui/database" "x-ui/database/model" "x-ui/logger" @@ -58,21 +57,21 @@ func (j *CheckClientIpJob) Run() { func (j *CheckClientIpJob) clearAccessLog() { logAccessP, err := os.OpenFile(xray.GetAccessPersistentLogPath(), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644) j.checkError(err) + defer logAccessP.Close() accessLogPath, err := xray.GetAccessLogPath() j.checkError(err) file, err := os.Open(accessLogPath) j.checkError(err) + defer file.Close() _, err = io.Copy(logAccessP, file) j.checkError(err) - logAccessP.Close() - file.Close() - err = os.Truncate(accessLogPath, 0) j.checkError(err) + j.lastClear = time.Now().Unix() } @@ -193,10 +192,6 @@ func (j *CheckClientIpJob) checkError(e error) { } } -func (j *CheckClientIpJob) contains(s []string, str string) bool { - return slices.Contains(s, str) -} - func (j *CheckClientIpJob) getInboundClientIps(clientEmail string) (*model.InboundClientIps, error) { db := database.GetDB() InboundClientIps := &model.InboundClientIps{} |
