add torrent version info

This commit is contained in:
nikk gitanes
2023-03-12 12:32:22 +03:00
parent 388ec778b1
commit 497a8f0dc7
2 changed files with 22 additions and 1 deletions

View File

@@ -1,3 +1,24 @@
package version
import (
"log"
"runtime/debug"
// "github.com/anacrolix/torrent"
)
const Version = "MatriX.120.6"
func GetTorrentVersion() string {
// _ = torrent.NewDefaultClientConfig()
bi, ok := debug.ReadBuildInfo()
if !ok {
log.Printf("Failed to read build info")
return ""
}
for _, dep := range bi.Deps {
if dep.Path == "github.com/anacrolix/torrent" {
return dep.Version
}
}
return ""
}