CI / go-test (push) Canceled after 0s
CI / postgres-durable-first (push) Canceled after 0s
CI / codegen (push) Canceled after 0s
CI / govulncheck (push) Canceled after 0s
CI / race (push) Canceled after 0s
CI / fuzz-smoke (push) Canceled after 0s
CI / golangci (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CodeQL Advanced / Analyze (go) (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
Docs CI / build (push) Canceled after 0s
Docs Deploy (GitHub Pages) / build (push) Canceled after 0s
Release 3X-UI / build (386) (push) Canceled after 0s
Release 3X-UI / build (amd64) (push) Canceled after 0s
Release 3X-UI / build (arm64) (push) Canceled after 0s
Release 3X-UI / build (armv5) (push) Canceled after 0s
Release 3X-UI / build (armv6) (push) Canceled after 0s
Release 3X-UI / build (armv7) (push) Canceled after 0s
Release 3X-UI / build (s390x) (push) Canceled after 0s
Release 3X-UI / Build for Windows (amd64) (push) Canceled after 0s
Deploy Smoke Tests / noninteractive-install (ubuntu-24.04-arm) (push) Canceled after 0s
Deploy Smoke Tests / noninteractive-install (ubuntu-latest) (push) Canceled after 0s
Deploy Smoke Tests / release-tag-install (ubuntu-24.04-arm) (push) Canceled after 0s
Deploy Smoke Tests / release-tag-install (ubuntu-latest) (push) Canceled after 0s
Docs Deploy (GitHub Pages) / deploy (push) Canceled after 0s
Release 3X-UI / Publish rolling dev release (push) Canceled after 0s
34 lines
824 B
Go
34 lines
824 B
Go
package job
|
|
|
|
import (
|
|
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
|
"github.com/mhsanaei/3x-ui/v3/internal/web/service/tgbot"
|
|
)
|
|
|
|
// LoginStatus represents the status of a login attempt.
|
|
type LoginStatus byte
|
|
|
|
const (
|
|
LoginSuccess LoginStatus = 1 // Successful login
|
|
LoginFail LoginStatus = 0 // Failed login attempt
|
|
)
|
|
|
|
// StatsNotifyJob sends periodic statistics reports via Telegram bot.
|
|
type StatsNotifyJob struct {
|
|
xrayService service.XrayService
|
|
tgbotService tgbot.Tgbot
|
|
}
|
|
|
|
// NewStatsNotifyJob creates a new statistics notification job instance.
|
|
func NewStatsNotifyJob() *StatsNotifyJob {
|
|
return new(StatsNotifyJob)
|
|
}
|
|
|
|
// Run sends a statistics report via Telegram bot if Xray is running.
|
|
func (j *StatsNotifyJob) Run() {
|
|
if !j.xrayService.IsXrayRunning() {
|
|
return
|
|
}
|
|
j.tgbotService.SendReport()
|
|
}
|