Documentation
¶
Overview ¶
Package job provides background job implementations for the 3x-ui web panel, including traffic monitoring, system checks, and periodic maintenance tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTruthyValues = []string{"true", "1", "yes", "on"}
Functions ¶
This section is empty.
Types ¶
type CheckClientIpJob ¶
type CheckClientIpJob struct {
// contains filtered or unexported fields
}
CheckClientIpJob monitors client IP addresses from access logs and manages IP blocking based on configured limits.
func NewCheckClientIpJob ¶
func NewCheckClientIpJob() *CheckClientIpJob
NewCheckClientIpJob creates a new client IP monitoring job instance.
func (*CheckClientIpJob) Run ¶
func (j *CheckClientIpJob) Run()
type CheckCpuJob ¶
type CheckCpuJob struct {
// contains filtered or unexported fields
}
CheckCpuJob monitors CPU usage and sends Telegram notifications when usage exceeds the configured threshold.
func NewCheckCpuJob ¶
func NewCheckCpuJob() *CheckCpuJob
NewCheckCpuJob creates a new CPU monitoring job instance.
func (*CheckCpuJob) Run ¶
func (j *CheckCpuJob) Run()
Run checks CPU usage over the last minute and sends a Telegram alert if it exceeds the threshold.
type CheckHashStorageJob ¶
type CheckHashStorageJob struct {
// contains filtered or unexported fields
}
CheckHashStorageJob periodically cleans up expired hash entries from the Telegram bot's hash storage.
func NewCheckHashStorageJob ¶
func NewCheckHashStorageJob() *CheckHashStorageJob
NewCheckHashStorageJob creates a new hash storage cleanup job instance.
func (*CheckHashStorageJob) Run ¶
func (j *CheckHashStorageJob) Run()
Run removes expired hash entries from the Telegram bot's hash storage.
type CheckXrayRunningJob ¶
type CheckXrayRunningJob struct {
// contains filtered or unexported fields
}
CheckXrayRunningJob monitors Xray process health and restarts it if it crashes.
func NewCheckXrayRunningJob ¶
func NewCheckXrayRunningJob() *CheckXrayRunningJob
NewCheckXrayRunningJob creates a new Xray health check job instance.
func (*CheckXrayRunningJob) Run ¶
func (j *CheckXrayRunningJob) Run()
Run checks if Xray has crashed and restarts it after confirming it's down for 2 consecutive checks.
type ClearLogsJob ¶
type ClearLogsJob struct{}
ClearLogsJob clears old log files to prevent disk space issues.
func NewClearLogsJob ¶
func NewClearLogsJob() *ClearLogsJob
NewClearLogsJob creates a new log cleanup job instance.
func (*ClearLogsJob) Run ¶
func (j *ClearLogsJob) Run()
Here Run is an interface method of the Job interface
type IPWithTimestamp ¶
IPWithTimestamp tracks an IP address with its last seen timestamp
type LdapSyncJob ¶
type LdapSyncJob struct {
// contains filtered or unexported fields
}
func NewLdapSyncJob ¶
func NewLdapSyncJob() *LdapSyncJob
func (*LdapSyncJob) Run ¶
func (j *LdapSyncJob) Run()
type LoginStatus ¶
type LoginStatus byte
LoginStatus represents the status of a login attempt.
const ( LoginSuccess LoginStatus = 1 // Successful login LoginFail LoginStatus = 0 // Failed login attempt )
type PeriodicTrafficResetJob ¶
type PeriodicTrafficResetJob struct {
// contains filtered or unexported fields
}
PeriodicTrafficResetJob resets traffic statistics for inbounds based on their configured reset period.
func NewPeriodicTrafficResetJob ¶
func NewPeriodicTrafficResetJob(period Period) *PeriodicTrafficResetJob
NewPeriodicTrafficResetJob creates a new periodic traffic reset job for the specified period.
func (*PeriodicTrafficResetJob) Run ¶
func (j *PeriodicTrafficResetJob) Run()
Run resets traffic statistics for all inbounds that match the configured reset period.
type StatsNotifyJob ¶
type StatsNotifyJob struct {
// contains filtered or unexported fields
}
StatsNotifyJob sends periodic statistics reports via Telegram bot.
func NewStatsNotifyJob ¶
func NewStatsNotifyJob() *StatsNotifyJob
NewStatsNotifyJob creates a new statistics notification job instance.
func (*StatsNotifyJob) Run ¶
func (j *StatsNotifyJob) Run()
Run sends a statistics report via Telegram bot if Xray is running.
type XrayTrafficJob ¶
type XrayTrafficJob struct {
// contains filtered or unexported fields
}
XrayTrafficJob collects and processes traffic statistics from Xray, updating the database and optionally informing external APIs.
func NewXrayTrafficJob ¶
func NewXrayTrafficJob() *XrayTrafficJob
NewXrayTrafficJob creates a new traffic collection job instance.
func (*XrayTrafficJob) Run ¶
func (j *XrayTrafficJob) Run()
Run collects traffic statistics from Xray and updates the database, triggering restart if needed.