diff --git a/app/app.go b/app/app.go index c2906db..894658d 100644 --- a/app/app.go +++ b/app/app.go @@ -1,6 +1,8 @@ package app import ( + "log" + "github.com/net-byte/vtun/common" "github.com/net-byte/vtun/common/cipher" "github.com/net-byte/vtun/common/config" @@ -18,20 +20,8 @@ import ( "github.com/net-byte/vtun/transport/protocol/ws" "github.com/net-byte/vtun/transport/tun" "github.com/net-byte/water" - "log" ) -var _banner = ` -_ -__ __ | |_ _ _ _ _ -\ V / | _| | || | | ' \ - \_/ \__| \_,_| |_||_| - -A simple VPN written in Go. -%s -` -var _srcUrl = "https://github.com/net-byte/vtun" - // App vtun app struct type App struct { Config *config.Config @@ -48,8 +38,6 @@ func NewApp(config *config.Config) *App { // InitConfig initializes the config func (app *App) InitConfig() { - log.Printf(_banner, _srcUrl) - log.Printf("vtun version %s", app.Version) if !app.Config.ServerMode { app.Config.LocalGateway = netutil.DiscoverGateway(true) app.Config.LocalGatewayv6 = netutil.DiscoverGateway(false) diff --git a/common/version.go b/common/version.go index d6c5f28..d20527a 100644 --- a/common/version.go +++ b/common/version.go @@ -3,15 +3,31 @@ package common import "log" var ( - Version = "v1.7.1" - GitHash = "nil" - BuildTime = "nil" - GoVersion = "nil" + Version = "v1.7.2" + GitHash = "" + BuildTime = "" + GoVersion = "" + Banner = ` +_ +__ __ | |_ _ _ _ _ +\ V / | _| | || | | ' \ + \_/ \__| \_,_| |_||_| + +A simple VPN written in Go. +https://github.com/net-byte/vtun +` ) func DisplayVersionInfo() { - log.Printf("vtun version -> %s", Version) - log.Printf("git hash -> %s", GitHash) - log.Printf("build time -> %s", BuildTime) - log.Printf("go version -> %s", GoVersion) + log.Println(Banner) + log.Printf("version -> %s", Version) + if GitHash != "" { + log.Printf("git hash -> %s", GitHash) + } + if BuildTime != "" { + log.Printf("build time -> %s", BuildTime) + } + if GoVersion != "" { + log.Printf("go version -> %s", GoVersion) + } }