🚀 Some improvements for x-ui.sh and ip job (#665)

This commit is contained in:
Hamidreza
2023-07-01 15:56:43 +03:30
committed by GitHub
parent f726474a5d
commit 1028319386
17 changed files with 428 additions and 294 deletions

View File

@@ -14,6 +14,7 @@ import (
"sync"
"syscall"
"x-ui/config"
"x-ui/logger"
"x-ui/util/common"
"github.com/Workiva/go-datastructures/queue"
@@ -47,10 +48,47 @@ func GetBlockedIPsPath() string {
return config.GetBinFolderPath() + "/BlockedIps"
}
func GetIPLimitLogPath() string {
return config.GetLogFolder() + "/3xipl.log"
}
func GetIPLimitBannedLogPath() string {
return config.GetLogFolder() + "/3xipl-banned.log"
}
func GetAccessPersistentLogPath() string {
return config.GetLogFolder() + "/3xipl-access-persistent.log"
}
func GetAccessLogPath() string {
config, err := os.ReadFile(GetConfigPath())
if err != nil {
logger.Warningf("Something went wrong: %s", err)
}
jsonConfig := map[string]interface{}{}
err = json.Unmarshal([]byte(config), &jsonConfig)
if err != nil {
logger.Warningf("Something went wrong: %s", err)
}
if jsonConfig["log"] != nil {
jsonLog := jsonConfig["log"].(map[string]interface{})
if jsonLog["access"] != nil {
accessLogPath := jsonLog["access"].(string)
return accessLogPath
}
}
return ""
}
func stopProcess(p *Process) {
p.Stop()
}
type Process struct {
*process
}