mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2024-12-30 02:37:01 +00:00
update constant
This commit is contained in:
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package constant
|
||||
|
||||
var (
|
||||
Version = "unknown version"
|
||||
BuildTime = "unknown time"
|
||||
)
|
||||
Reference in New Issue
Block a user