move paths to xray process

This commit is contained in:
Hamidreza Ghavami 2023-06-27 19:03:59 +04:30
parent ac8b218545
commit 8ef89eaa99
No known key found for this signature in database
GPG key ID: 402C6797325182D9

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() + "/3xui-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
}