mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2024-12-30 02:37:01 +00:00
Chore: move all to version
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
// Package debug indicates if the debug tag is enabled at build time.
|
||||
package debug
|
||||
|
||||
var _debug = false
|
||||
|
||||
func Debug() bool {
|
||||
return _debug
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package version
|
||||
|
||||
var _debug = false
|
||||
|
||||
func Debug() bool {
|
||||
return _debug
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//go:build debug
|
||||
|
||||
package debug
|
||||
package version
|
||||
|
||||
func init() {
|
||||
_debug = true
|
||||
@@ -1,4 +1,4 @@
|
||||
package module
|
||||
package version
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/v2/internal/debug"
|
||||
)
|
||||
|
||||
const Name = "tun2socks"
|
||||
@@ -25,7 +23,7 @@ func versionize(s string) string {
|
||||
}
|
||||
|
||||
func String() string {
|
||||
if !debug.Debug() {
|
||||
if !Debug() {
|
||||
return fmt.Sprintf("%s-%s", Name, versionize(Version))
|
||||
}
|
||||
return fmt.Sprintf("%s-%s (debug)", Name, versionize(Version))
|
||||
|
||||
+2
-4
@@ -8,8 +8,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/v2/internal/debug"
|
||||
"github.com/xjasonlyu/tun2socks/v2/internal/module"
|
||||
V "github.com/xjasonlyu/tun2socks/v2/internal/version"
|
||||
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||
@@ -217,7 +215,7 @@ func version(w http.ResponseWriter, r *http.Request) {
|
||||
render.JSON(w, r, render.M{
|
||||
"version": V.Version,
|
||||
"commit": V.GitCommit,
|
||||
"debug": debug.Debug(),
|
||||
"modules": module.Info(),
|
||||
"debug": V.Debug(),
|
||||
"modules": V.Info(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user