mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2024-12-30 02:37:01 +00:00
Feature: more fields in stats version
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package module
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
// Info returns project dependencies as []*debug.Module.
|
||||
func Info() []*debug.Module {
|
||||
bi, _ := debug.ReadBuildInfo()
|
||||
return bi.Deps
|
||||
}
|
||||
+8
-1
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/v2/internal/debug"
|
||||
"github.com/xjasonlyu/tun2socks/v2/internal/module"
|
||||
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||
V "github.com/xjasonlyu/tun2socks/v2/version"
|
||||
@@ -212,5 +214,10 @@ func traffic(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func version(w http.ResponseWriter, r *http.Request) {
|
||||
render.JSON(w, r, render.M{"version": V.Version, "commit": V.GitCommit})
|
||||
render.JSON(w, r, render.M{
|
||||
"version": V.Version,
|
||||
"commit": V.GitCommit,
|
||||
"debug": debug.Debug(),
|
||||
"modules": module.Info(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user