diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-26 15:00:15 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-26 15:00:15 +0100 |
commit | 99e7034d912d566a3601005ea5770774edfa43fa (patch) | |
tree | 86b34c21cee27c92f3debb7494d588709c9c0f59 /proxy.go | |
parent | 8ecf41a01f54a9c3ba8bc80a5cfad31d28aaabcf (diff) |
add function to get proxy version
Diffstat (limited to 'proxy.go')
-rw-r--r-- | proxy.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -9,6 +9,7 @@ import ( "os" "path/filepath" "regexp" + "runtime/debug" "strings" "sync" ) @@ -40,3 +41,19 @@ func Path(path ...string) string { return proxyDir + "/" + strings.Join(path, "") } + +// Version returns the version string of the running instance. +func Version() (version string, ok bool) { + info, ok := debug.ReadBuildInfo() + if !ok { + return + } + + for _, dep := range info.Deps { + if dep.Path == "github.com/HimbeerserverDE/mt-multiserver-proxy" { + return dep.Version, true + } + } + + return +} |