diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-28 17:20:40 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-01 16:55:02 +0100 |
commit | 7357c40796ba4223f92d99afd7e680aa53a46d1b (patch) | |
tree | b3a92077444048a6157943e5c5517b21162576cb /version | |
parent | build: use go 1.16rc1 (diff) | |
download | wireguard-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.go | 28 |
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" +} |