aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/version
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-01-28 17:20:40 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-02-01 16:55:02 +0100
commit7357c40796ba4223f92d99afd7e680aa53a46d1b (patch)
treeb3a92077444048a6157943e5c5517b21162576cb /version
parentbuild: use go 1.16rc1 (diff)
downloadwireguard-windows-7357c40796ba4223f92d99afd7e680aa53a46d1b.tar.xz
wireguard-windows-7357c40796ba4223f92d99afd7e680aa53a46d1b.zip
version: stop using go version tags in repo
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'version')
-rw-r--r--version/protocol.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/version/protocol.go b/version/protocol.go
new file mode 100644
index 00000000..72a35e95
--- /dev/null
+++ b/version/protocol.go
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2019-2021 WireGuard LLC. All Rights Reserved.
+ */
+
+package version
+
+import (
+ "runtime/debug"
+ "strings"
+)
+
+func ProtoImplementation() string {
+ info, ok := debug.ReadBuildInfo()
+ if !ok {
+ return "unknown"
+ }
+ for _, dep := range info.Deps {
+ if dep.Path == "golang.zx2c4.com/wireguard" {
+ parts := strings.Split(dep.Version, "-")
+ if len(parts) == 3 && len(parts[2]) == 12 {
+ return parts[2][:7]
+ }
+ return dep.Version
+ }
+ }
+ return "unknown"
+}