浏览代码

Always print version

V2Ray 10 年之前
父节点
当前提交
1675063dc6
共有 2 个文件被更改,包括 13 次插入15 次删除
  1. 11 12
      core.go
  2. 2 3
      release/server/main.go

+ 11 - 12
core.go

@@ -1,20 +1,19 @@
 // Package core provides common definitions and functionalities of V2Ray.
 package core
 
-var (
-	version = "0.8"
-	build   = "Custom"
+import (
+	"fmt"
 )
 
-const (
-	Codename = "Post Apocalypse"
-	Intro    = "A stable and unbreakable connection for everyone."
+var (
+	version  = "0.8"
+	build    = "Custom"
+	codename = "Post Apocalypse"
+	intro    = "A stable and unbreakable connection for everyone."
 )
 
-func Version() string {
-	return version
-}
-
-func Build() string {
-	return build
+func PrintVersion() {
+	fmt.Printf("V2Ray %s (%s) %s", version, codename, build)
+	fmt.Println()
+	fmt.Println(intro)
 }

+ 2 - 3
release/server/main.go

@@ -24,10 +24,9 @@ var (
 func main() {
 	flag.Parse()
 
+	core.PrintVersion()
+
 	if *version {
-		fmt.Printf("V2Ray %s (%s) %s", core.Version(), core.Codename, core.Build())
-		fmt.Println()
-		fmt.Println(core.Intro)
 		return
 	}