update version info

This commit is contained in:
Alex Tsai 2023-08-27 23:28:47 +08:00
parent 2deea0fcce
commit ef151d35f4
2 changed files with 26 additions and 22 deletions

View File

@ -1,6 +1,8 @@
package app package app
import ( import (
"log"
"github.com/net-byte/vtun/common" "github.com/net-byte/vtun/common"
"github.com/net-byte/vtun/common/cipher" "github.com/net-byte/vtun/common/cipher"
"github.com/net-byte/vtun/common/config" "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/protocol/ws"
"github.com/net-byte/vtun/transport/tun" "github.com/net-byte/vtun/transport/tun"
"github.com/net-byte/water" "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 // App vtun app struct
type App struct { type App struct {
Config *config.Config Config *config.Config
@ -48,8 +38,6 @@ func NewApp(config *config.Config) *App {
// InitConfig initializes the config // InitConfig initializes the config
func (app *App) InitConfig() { func (app *App) InitConfig() {
log.Printf(_banner, _srcUrl)
log.Printf("vtun version %s", app.Version)
if !app.Config.ServerMode { if !app.Config.ServerMode {
app.Config.LocalGateway = netutil.DiscoverGateway(true) app.Config.LocalGateway = netutil.DiscoverGateway(true)
app.Config.LocalGatewayv6 = netutil.DiscoverGateway(false) app.Config.LocalGatewayv6 = netutil.DiscoverGateway(false)

View File

@ -3,15 +3,31 @@ package common
import "log" import "log"
var ( var (
Version = "v1.7.1" Version = "v1.7.2"
GitHash = "nil" GitHash = ""
BuildTime = "nil" BuildTime = ""
GoVersion = "nil" GoVersion = ""
Banner = `
_
__ __ | |_ _ _ _ _
\ V / | _| | || | | ' \
\_/ \__| \_,_| |_||_|
A simple VPN written in Go.
https://github.com/net-byte/vtun
`
) )
func DisplayVersionInfo() { func DisplayVersionInfo() {
log.Printf("vtun version -> %s", Version) log.Println(Banner)
log.Printf("git hash -> %s", GitHash) log.Printf("version -> %s", Version)
log.Printf("build time -> %s", BuildTime) if GitHash != "" {
log.Printf("go version -> %s", GoVersion) log.Printf("git hash -> %s", GitHash)
}
if BuildTime != "" {
log.Printf("build time -> %s", BuildTime)
}
if GoVersion != "" {
log.Printf("go version -> %s", GoVersion)
}
} }