1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 14:06:58 -05:00

Print release date in version command

This commit is contained in:
V2Ray 2015-09-29 11:52:34 +02:00
parent 28f87f2fae
commit c097e6a3c6
4 changed files with 29 additions and 5 deletions

14
core.go
View File

@ -1,8 +1,20 @@
// Package core provides common definitions and functionalities of V2Ray.
package core
var (
version = "0.6.2"
build = "Custom"
)
const (
Version = "0.6"
Codename = "Post Apocalypse"
Intro = "A stable and unbreakable connection for everyone."
)
func Version() string {
return version
}
func Build() string {
return build
}

View File

@ -86,7 +86,7 @@ func (server *SocksServer) ListenUDP(port uint16) error {
}
go server.AcceptPackets(conn)
udpConn = conn
udpConn = conn
return nil
}

View File

@ -1,6 +1,17 @@
#!/bin/bash
VERSION=$(sed -n 's/.*Version.*=.*\"\([^"]*\)\".*/\1/p' $GOPATH/src/github.com/v2ray/v2ray-core/core.go)
GIT_REV=$(git rev-parse HEAD)
VERSION=$(git name-rev --tags --name-only $GIT_REV)
LD_FLAGS="-s"
if [ "$VERSION" != "undefined" ]; then
VERSION=${VERSION%^0}
TODAY="$(date -u +%Y%m%d)"
LD_FLAGS="${LD_FLAGS} -X github.com/v2ray/v2ray-core.version=${VERSION} -X github.com/v2ray/v2ray-core.build=${TODAY}"
else
VERSION="custom"
fi
BIN_PATH=$GOPATH/bin
mkdir -p $BIN_PATH
@ -18,7 +29,7 @@ function build {
fi
mkdir -p $REL_PATH/config
cp -R $GOPATH/src/github.com/v2ray/v2ray-core/release/config/* $REL_PATH/config/
GOOS=${GOOS} GOARCH=${GOARCH} go build -o ${TARGET} -compiler gc -ldflags "-s" github.com/v2ray/v2ray-core/release/server
GOOS=${GOOS} GOARCH=${GOARCH} go build -o ${TARGET} -compiler gc -ldflags "${LD_FLAGS}" github.com/v2ray/v2ray-core/release/server
ZIP_FILE=$BIN_PATH/v2ray${SUFFIX}.zip
if [ -f $ZIP_FILE ]; then

View File

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