update constant

This commit is contained in:
Jason
2019-08-14 21:39:18 +08:00
parent d6c40a736e
commit 899e154c92
3 changed files with 15 additions and 12 deletions
+7 -7
View File
@@ -1,18 +1,18 @@
NAME=tun2socks
BUILDDIR=$(shell pwd)/build
CMDDIR=$(shell pwd)/cmd
BUILD_DIR=$(shell pwd)/build
CMD_DIR=$(shell pwd)/cmd
VERSION=$(shell git describe --tags --long || echo "unknown version")
BUILD_TIME=$(shell date -u)
BUILD_TAGS='fakeDNS stats'
BUILD_LDFLAGS='-s -w -X "main.version=$(VERSION)"'
DEBUG_BUILD_LDFLAGS='-s -w -X "main.version=$(VERSION)-debug"'
BUILD_LDFLAGS='-s -w -X "github.com/xjasonlyu/tun2socks/constant.Version=$(VERSION)" -X "github.com/xjasonlyu/tun2socks/constant.BuildTime=$(BUILD_TIME)"'
all: build
build:
cd $(CMDDIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -o $(BUILDDIR)/$(NAME)
cd $(CMD_DIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -o $(BUILD_DIR)/$(NAME)
debug:
cd $(CMDDIR) && go build -ldflags $(DEBUG_BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -race -o $(BUILDDIR)/$(NAME)
cd $(CMD_DIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -race -o $(BUILD_DIR)/$(NAME)
clean:
rm -rf $(BUILDDIR)
rm -rf $(BUILD_DIR)
+2 -5
View File
@@ -19,6 +19,7 @@ import (
D "github.com/xjasonlyu/tun2socks/common/dns"
S "github.com/xjasonlyu/tun2socks/common/stats"
C "github.com/xjasonlyu/tun2socks/constant"
// init logger
_ "github.com/xjasonlyu/tun2socks/common/log/simple"
@@ -27,9 +28,6 @@ import (
const MTU = 1500
var (
version = "unknown version"
description = "A tun2socks implementation written in Go."
args = new(CmdArgs)
postFlagsInitFn []func()
@@ -87,8 +85,7 @@ func main() {
flag.Parse()
if *args.Version {
fmt.Println("Go-tun2socks", version)
fmt.Println(description)
fmt.Println("Go-tun2socks", C.Version, C.BuildTime)
os.Exit(0)
}
+6
View File
@@ -0,0 +1,6 @@
package constant
var (
Version = "unknown version"
BuildTime = "unknown time"
)