[feature] using xray API for inbound

Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
MHSanaei
2023-07-18 02:40:22 +03:30
parent 81a057d638
commit 1f78842b70
7 changed files with 386 additions and 60 deletions
+3 -8
View File
@@ -403,25 +403,20 @@ func (s *ServerService) GetLogs(count string, logLevel string) ([]string, error)
}
func (s *ServerService) GetConfigJson() (interface{}, error) {
// Open the file for reading
file, err := os.Open(xray.GetConfigPath())
config, err := s.xrayService.GetXrayConfig()
if err != nil {
return nil, err
}
defer file.Close()
// Read the file contents
fileContents, err := io.ReadAll(file)
contents, err := json.MarshalIndent(config, "", " ")
if err != nil {
return nil, err
}
var jsonData interface{}
err = json.Unmarshal(fileContents, &jsonData)
err = json.Unmarshal(contents, &jsonData)
if err != nil {
return nil, err
}
return jsonData, nil
}