update version output

This commit is contained in:
Jason
2019-08-14 22:52:58 +08:00
parent f04d90177c
commit 9202b8f53b
3 changed files with 10 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import (
"net"
"os"
"os/signal"
"runtime"
"strings"
"syscall"
"time"
@@ -80,12 +81,18 @@ func init() {
args.UdpTimeout = flag.Duration("udpTimeout", 30*time.Second, "UDP session timeout")
}
func showVersion() {
version := strings.Split(C.Version, "-")
fmt.Printf("Go-tun2socks %s (%s)\n", version[0], version[1])
fmt.Printf("%s/%s, %s, %s\n", runtime.GOOS, runtime.GOARCH, runtime.Version(), version[2])
}
func main() {
// Parse args
flag.Parse()
if *args.Version {
fmt.Println("Go-tun2socks", C.Version, C.BuildTime)
showVersion()
os.Exit(0)
}