diff --git a/internal/module/module.go b/internal/module/module.go new file mode 100644 index 0000000..c85ba42 --- /dev/null +++ b/internal/module/module.go @@ -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 +} diff --git a/stats/server.go b/stats/server.go index d798248..fdcbfb3 100644 --- a/stats/server.go +++ b/stats/server.go @@ -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(), + }) }