xjasonlyu
3 years ago
6 changed files with 34 additions and 36 deletions
@ -1,10 +0,0 @@ |
|||||
package constant |
|
||||
|
|
||||
const ( |
|
||||
Name = "tun2socks" |
|
||||
) |
|
||||
|
|
||||
var ( |
|
||||
Version string |
|
||||
GitCommit string |
|
||||
) |
|
@ -1,22 +0,0 @@ |
|||||
package engine |
|
||||
|
|
||||
import ( |
|
||||
"fmt" |
|
||||
"runtime" |
|
||||
"strings" |
|
||||
|
|
||||
V "github.com/xjasonlyu/tun2socks/v2/constant" |
|
||||
) |
|
||||
|
|
||||
func showVersion() { |
|
||||
fmt.Print(versionString()) |
|
||||
fmt.Print(releaseString()) |
|
||||
} |
|
||||
|
|
||||
func versionString() string { |
|
||||
return fmt.Sprintf("%s-%s\n", V.Name, strings.TrimPrefix(V.Version, "v")) |
|
||||
} |
|
||||
|
|
||||
func releaseString() string { |
|
||||
return fmt.Sprintf("%s/%s, %s, %s\n", runtime.GOOS, runtime.GOARCH, runtime.Version(), V.GitCommit) |
|
||||
} |
|
@ -0,0 +1,27 @@ |
|||||
|
package version |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"runtime" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
const Name = "tun2socks" |
||||
|
|
||||
|
var ( |
||||
|
// Version can be set at link time by executing
|
||||
|
// the command: `git describe --abbrev=0 --tags HEAD`
|
||||
|
Version string |
||||
|
|
||||
|
// GitCommit can be set at link time by executing
|
||||
|
// the command: `git rev-parse --short HEAD`
|
||||
|
GitCommit string |
||||
|
) |
||||
|
|
||||
|
func String() string { |
||||
|
return fmt.Sprintf("%s-%s", Name, strings.TrimPrefix(Version, "v")) |
||||
|
} |
||||
|
|
||||
|
func BuildString() string { |
||||
|
return fmt.Sprintf("%s/%s, %s, %s", runtime.GOOS, runtime.GOARCH, runtime.Version(), GitCommit) |
||||
|
} |
Loading…
Reference in new issue