From 761c3f373994e5b651f2600132e5432c0a05ff6c Mon Sep 17 00:00:00 2001 From: dnomd343 Date: Fri, 9 Sep 2022 13:47:39 +0800 Subject: [PATCH] feat: show xproxy version --- cmd/xproxy.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/xproxy.go b/cmd/xproxy.go index 7b6b736..c02e8f6 100644 --- a/cmd/xproxy.go +++ b/cmd/xproxy.go @@ -6,6 +6,7 @@ import ( "XProxy/cmd/custom" "XProxy/cmd/process" "flag" + "fmt" log "github.com/sirupsen/logrus" "io" "os" @@ -48,9 +49,14 @@ func xproxyInit() { if os.Getenv("CONFIG") != "" { xproxyConfig = os.Getenv("CONFIG") } + isVersion := flag.Bool("version", false, "Show version") isDebug := flag.Bool("debug", os.Getenv("DEBUG") == "true", "Enable debug mode") configName := flag.String("config", xproxyConfig, "Config file name") flag.Parse() + if *isVersion { + fmt.Printf("XProxy version %s (%s)\n", version, goVersion) // show version info and exit + os.Exit(0) + } exposeDir = "/xproxy" // default folder if os.Getenv("EXPOSE_DIR") != "" {