version.go 505 B

123456789101112131415161718192021222324252627
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/xtls/xray-core/core"
  5. "github.com/xtls/xray-core/main/commands/base"
  6. )
  7. var cmdVersion = &base.Command{
  8. UsageLine: "{{.Exec}} version",
  9. Short: "Show current version of Xray",
  10. Long: `Version prints the build information for Xray executables.
  11. `,
  12. Run: executeVersion,
  13. }
  14. func executeVersion(cmd *base.Command, args []string) {
  15. printVersion()
  16. }
  17. func printVersion() {
  18. version := core.VersionStatement()
  19. for _, s := range version {
  20. fmt.Println(s)
  21. }
  22. }