aboutsummaryrefslogtreecommitdiff
path: root/proxy.go
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-11-26 15:00:15 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-11-26 15:00:15 +0100
commit99e7034d912d566a3601005ea5770774edfa43fa (patch)
tree86b34c21cee27c92f3debb7494d588709c9c0f59 /proxy.go
parent8ecf41a01f54a9c3ba8bc80a5cfad31d28aaabcf (diff)
add function to get proxy version
Diffstat (limited to 'proxy.go')
-rw-r--r--proxy.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/proxy.go b/proxy.go
index 71c5f83..6628aec 100644
--- a/proxy.go
+++ b/proxy.go
@@ -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
+}