完成xray启动

This commit is contained in:
sprov
2021-05-27 23:04:39 +08:00
parent 56ed8f355c
commit 3cd25ce5ea
42 changed files with 3627 additions and 229 deletions

View File

@@ -1,6 +1,9 @@
package config
import "fmt"
import (
"fmt"
"os"
)
type LogLevel string
@@ -11,10 +14,6 @@ const (
Error LogLevel = "error"
)
func init() {
}
func GetVersion() string {
return "0.0.1"
}
@@ -23,34 +22,21 @@ func GetName() string {
return "x-ui"
}
func GetListen() string {
return ":27827"
}
func GetCertFile() string {
return ""
}
func GetKeyFile() string {
return ""
}
func GetLogLevel() LogLevel {
return Debug
if IsDebug() {
return Debug
}
logLevel := os.Getenv("XUI_LOG_LEVEL")
if logLevel == "" {
return Info
}
return LogLevel(logLevel)
}
func IsDebug() bool {
return true
}
func GetSecret() []byte {
return []byte("")
return os.Getenv("XUI_DEBUG") == "true"
}
func GetDBPath() string {
return fmt.Sprintf("/etc/%s/%s.db", GetName(), GetName())
}
func GetBasePath() string {
return "/"
}