diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-09-09 10:52:29 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-09-09 10:57:30 +0300 |
| commit | 2e1461e6dc58df591e4372cdfafb6012701d1954 (patch) | |
| tree | f4f5f965c0150e465eff29b08eeb18643dad592b /web | |
| parent | 272457740fbc73424a54510f85d772f7c95fd0ea (diff) | |
remove warning for access log
because you can't see the iplimit when there is no path for access log :D
Diffstat (limited to 'web')
| -rw-r--r-- | web/job/check_client_ip_job.go | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go index 0b567d9b..64feeeb4 100644 --- a/web/job/check_client_ip_job.go +++ b/web/job/check_client_ip_job.go @@ -37,7 +37,7 @@ func (j *CheckClientIpJob) Run() { shouldClearAccessLog := false f2bInstalled := j.checkFail2BanInstalled() - isAccessLogAvailable := j.checkAccessLogAvailable(f2bInstalled) + isAccessLogAvailable := j.checkAccessLogAvailable() if j.hasLimitIp() { if f2bInstalled && isAccessLogAvailable { @@ -49,7 +49,7 @@ func (j *CheckClientIpJob) Run() { } } - if shouldClearAccessLog || isAccessLogAvailable && time.Now().Unix()-j.lastClear > 3600 { + if shouldClearAccessLog || (isAccessLogAvailable && time.Now().Unix()-j.lastClear > 3600) { j.clearAccessLog() } } @@ -174,27 +174,18 @@ func (j *CheckClientIpJob) checkFail2BanInstalled() bool { return err == nil } -func (j *CheckClientIpJob) checkAccessLogAvailable(handleWarning bool) bool { +func (j *CheckClientIpJob) checkAccessLogAvailable() bool { isAvailable := true - warningMsg := "" accessLogPath, err := xray.GetAccessLogPath() if err != nil { return false } - // access log is not available if it is set to 'none' or an empty string switch accessLogPath { - case "none": - warningMsg = "Access log is set to 'none', check your Xray Configs" - isAvailable = false - case "": - warningMsg = "Access log doesn't exist in your Xray Configs" + case "none", "": isAvailable = false } - if handleWarning && warningMsg != "" { - logger.Warning(warningMsg) - } return isAvailable } |
