mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2026-10-19 16:16:35 +00:00
fix build crash
This commit is contained in:
@@ -4,15 +4,17 @@ 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 "github.com/xjasonlyu/tun2socks/constant.Version=$(VERSION)" -X "github.com/xjasonlyu/tun2socks/constant.BuildTime=$(BUILD_TIME)"'
|
||||
GOBUILD=go build -ldflags -X "github.com/xjasonlyu/tun2socks/constant.Version=$(VERSION)" \
|
||||
-X "github.com/xjasonlyu/tun2socks/constant.BuildTime=$(BUILD_TIME)" \
|
||||
-s -w
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
cd $(CMD_DIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -o $(BUILD_DIR)/$(NAME)
|
||||
cd $(CMD_DIR) && $(GOBUILD) -v -tags $(BUILD_TAGS) -o $(BUILD_DIR)/$(NAME)
|
||||
|
||||
debug:
|
||||
cd $(CMD_DIR) && go build -ldflags $(BUILD_LDFLAGS) -v -tags $(BUILD_TAGS) -race -o $(BUILD_DIR)/$(NAME)
|
||||
cd $(CMD_DIR) && $(GOBUILD) -v -tags $(BUILD_TAGS) -race -o $(BUILD_DIR)/$(NAME)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
@@ -18,7 +18,6 @@ func init() {
|
||||
|
||||
// Set stats variables
|
||||
session.ServeAddr = *args.StatsAddr
|
||||
session.StatsVersion = version
|
||||
|
||||
// Start session stater
|
||||
sessionStater.Start()
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/xjasonlyu/tun2socks/common/log"
|
||||
"github.com/xjasonlyu/tun2socks/common/queue"
|
||||
"github.com/xjasonlyu/tun2socks/common/stats"
|
||||
C "github.com/xjasonlyu/tun2socks/constant"
|
||||
)
|
||||
|
||||
const maxCompletedSessions = 100
|
||||
@@ -19,8 +20,6 @@ const maxCompletedSessions = 100
|
||||
var (
|
||||
ServeAddr = "localhost:6001"
|
||||
ServePath = "/stats/session/plain"
|
||||
|
||||
StatsVersion = ""
|
||||
)
|
||||
|
||||
type simpleSessionStater struct {
|
||||
@@ -87,7 +86,7 @@ table, th, td {
|
||||
text-align: right;
|
||||
padding: 4;
|
||||
}</style><title>Go-tun2socks Sessions</title></head>`)
|
||||
_, _ = fmt.Fprintf(w, "<h2>Go-tun2socks %s</h2>", StatsVersion)
|
||||
_, _ = fmt.Fprintf(w, "<h2>Go-tun2socks %s</h2>", C.Version)
|
||||
_, _ = fmt.Fprintf(w, "<h3>Now: %s ; Uptime: %s</h3>", now(), uptime())
|
||||
_, _ = fmt.Fprintf(w, "<p>Active sessions %d</p>", len(activeSessions))
|
||||
tablePrint(w, activeSessions)
|
||||
|
||||
Reference in New Issue
Block a user