diff --git a/core.go b/core.go index d56075db4..44854e2a0 100644 --- a/core.go +++ b/core.go @@ -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 +} diff --git a/proxy/socks/udp.go b/proxy/socks/udp.go index 4c088172e..43a2d2ce2 100644 --- a/proxy/socks/udp.go +++ b/proxy/socks/udp.go @@ -86,7 +86,7 @@ func (server *SocksServer) ListenUDP(port uint16) error { } go server.AcceptPackets(conn) - udpConn = conn + udpConn = conn return nil } diff --git a/release/release.sh b/release/release.sh index c55422756..645993640 100755 --- a/release/release.sh +++ b/release/release.sh @@ -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 diff --git a/release/server/main.go b/release/server/main.go index 1a6961c04..af2e44203 100644 --- a/release/server/main.go +++ b/release/server/main.go @@ -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 }