minor changes

This commit is contained in:
MHSanaei 2024-02-18 01:06:40 +03:30
parent 57029b1a40
commit 2b4d6160c4
3 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,6 @@ package random
import ( import (
"math/rand" "math/rand"
"time"
) )
var numSeq [10]rune var numSeq [10]rune
@ -13,8 +12,6 @@ var numUpperSeq [36]rune
var allSeq [62]rune var allSeq [62]rune
func init() { func init() {
rand.Seed(time.Now().UnixNano())
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
numSeq[i] = rune('0' + i) numSeq[i] = rune('0' + i)
} }
@ -41,3 +38,7 @@ func Seq(n int) string {
} }
return string(runes) return string(runes)
} }
func Num(n int) int {
return rand.Intn(n)
}

View file

@ -118,7 +118,7 @@ func (j *CheckClientIpJob) checkFail2BanInstalled() {
err := exec.Command(cmd, args...).Run() err := exec.Command(cmd, args...).Run()
if err != nil { if err != nil {
logger.Error("fail2ban is not installed. IP limiting may not work properly.") logger.Warning("fail2ban is not installed. IP limiting may not work properly.")
} }
} }
@ -126,12 +126,12 @@ func (j *CheckClientIpJob) processLogFile() {
accessLogPath := xray.GetAccessLogPath() accessLogPath := xray.GetAccessLogPath()
if accessLogPath == "none" { if accessLogPath == "none" {
logger.Error("Access log is set to 'none' check your Xray Configs") logger.Warning("Access log is set to 'none' check your Xray Configs")
return return
} }
if accessLogPath == "" { if accessLogPath == "" {
logger.Error("Access log doesn't exist in your Xray Configs") logger.Warning("Access log doesn't exist in your Xray Configs")
return return
} }

View file

@ -10,7 +10,6 @@ import (
) )
type OutboundService struct { type OutboundService struct {
xrayApi xray.XrayAPI
} }
func (s *OutboundService) AddTraffic(traffics []*xray.Traffic, clientTraffics []*xray.ClientTraffic) (error, bool) { func (s *OutboundService) AddTraffic(traffics []*xray.Traffic, clientTraffics []*xray.ClientTraffic) (error, bool) {