mirror of https://github.com/v2ray/v2ray-core
Print release date in version command
parent
28f87f2fae
commit
c097e6a3c6
14
core.go
14
core.go
|
@ -1,8 +1,20 @@
|
||||||
// Package core provides common definitions and functionalities of V2Ray.
|
// Package core provides common definitions and functionalities of V2Ray.
|
||||||
package core
|
package core
|
||||||
|
|
||||||
|
var (
|
||||||
|
version = "0.6.2"
|
||||||
|
build = "Custom"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "0.6"
|
|
||||||
Codename = "Post Apocalypse"
|
Codename = "Post Apocalypse"
|
||||||
Intro = "A stable and unbreakable connection for everyone."
|
Intro = "A stable and unbreakable connection for everyone."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Version() string {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
func Build() string {
|
||||||
|
return build
|
||||||
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (server *SocksServer) ListenUDP(port uint16) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
go server.AcceptPackets(conn)
|
go server.AcceptPackets(conn)
|
||||||
udpConn = conn
|
udpConn = conn
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
#!/bin/bash
|
#!/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
|
BIN_PATH=$GOPATH/bin
|
||||||
mkdir -p $BIN_PATH
|
mkdir -p $BIN_PATH
|
||||||
|
@ -18,7 +29,7 @@ function build {
|
||||||
fi
|
fi
|
||||||
mkdir -p $REL_PATH/config
|
mkdir -p $REL_PATH/config
|
||||||
cp -R $GOPATH/src/github.com/v2ray/v2ray-core/release/config/* $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
|
ZIP_FILE=$BIN_PATH/v2ray${SUFFIX}.zip
|
||||||
if [ -f $ZIP_FILE ]; then
|
if [ -f $ZIP_FILE ]; then
|
||||||
|
|
|
@ -24,8 +24,9 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *version {
|
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()
|
||||||
|
fmt.Println(core.Intro)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue