check_inbound_job.go 518 B

12345678910111213141516171819202122232425
  1. package job
  2. import (
  3. "x-ui/logger"
  4. "x-ui/web/service"
  5. )
  6. type CheckInboundJob struct {
  7. xrayService service.XrayService
  8. inboundService service.InboundService
  9. }
  10. func NewCheckInboundJob() *CheckInboundJob {
  11. return new(CheckInboundJob)
  12. }
  13. func (j *CheckInboundJob) Run() {
  14. count, err := j.inboundService.DisableInvalidInbounds()
  15. if err != nil {
  16. logger.Warning("disable invalid inbounds err:", err)
  17. } else if count > 0 {
  18. logger.Debugf("disabled %v inbounds", count)
  19. j.xrayService.SetToNeedRestart()
  20. }
  21. }