Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xray
diff options
context:
space:
mode:
authorHamidreza <70919649+hamid-gh98@users.noreply.github.com>2023-07-01 15:26:43 +0300
committerGitHub <noreply@github.com>2023-07-01 15:26:43 +0300
commit10283193862e7bd36b20e6b2c41411d251961c27 (patch)
tree892d133611c08e01db4b372645d8bcf579635739 /xray
parentf726474a5db3fa68eeb78729a58629382f6d2699 (diff)
🚀 Some improvements for x-ui.sh and ip job (#665)
Diffstat (limited to 'xray')
-rw-r--r--xray/process.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/xray/process.go b/xray/process.go
index 42b2ee5c..0882c716 100644
--- a/xray/process.go
+++ b/xray/process.go
@@ -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
}