aboutsummaryrefslogtreecommitdiff
path: root/src/internal/syscall
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2024-03-08 09:37:29 +0100
committerQuim Muntal <quimmuntal@gmail.com>2024-03-08 22:14:32 +0000
commitc220fbabd517ed66cb77e148aa015a80964ddcc4 (patch)
treea1cf1577e7d15cf807eefdc8d30775dd8d2acfd8 /src/internal/syscall
parent336617186a6c01a1874685d4577042ab007609ea (diff)
downloadgo-c220fbabd517ed66cb77e148aa015a80964ddcc4.tar.xz
internal/syscall/windows: unexport Version
windows.Version is just a thin wrapper around RtlGetNtVersionNumbers, which is an undocumented Windows API. This CL unexports windows.Version so it is harder to use by accident. Change-Id: Ib782da04e4e8be66970111a75f5c2df27ef51643 Reviewed-on: https://go-review.googlesource.com/c/go/+/570055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/internal/syscall')
-rw-r--r--src/internal/syscall/windows/version_windows.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/internal/syscall/windows/version_windows.go b/src/internal/syscall/windows/version_windows.go
index f0abb5d5a2..6ceed2f304 100644
--- a/src/internal/syscall/windows/version_windows.go
+++ b/src/internal/syscall/windows/version_windows.go
@@ -9,10 +9,10 @@ import (
_ "unsafe" // for linkname
)
-// Version retrieves the major, minor, and build version numbers
+// version retrieves the major, minor, and build version numbers
// of the current Windows OS from the RtlGetNtVersionNumbers API
// and parse the results properly.
-func Version() (major, minor, build uint32) {
+func version() (major, minor, build uint32) {
rtlGetNtVersionNumbers(&major, &minor, &build)
build &= 0x7fff
return
@@ -23,24 +23,25 @@ func Version() (major, minor, build uint32) {
func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32)
// SupportFullTCPKeepAlive indicates whether the current Windows version
-// supports the full TCP keep-alive configurations, the minimal requirement
-// is Windows 10, version 1709.
+// supports the full TCP keep-alive configurations.
+// The minimal requirement is Windows 10.0.16299.
var SupportFullTCPKeepAlive = sync.OnceValue(func() bool {
- major, _, build := Version()
+ major, _, build := version()
return major >= 10 && build >= 16299
})
// SupportTCPInitialRTONoSYNRetransmissions indicates whether the current
-// Windows version supports the TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS, the
-// minimal requirement is Windows 10.0.16299.
+// Windows version supports the TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS.
+// The minimal requirement is Windows 10.0.16299.
var SupportTCPInitialRTONoSYNRetransmissions = sync.OnceValue(func() bool {
- major, _, build := Version()
+ major, _, build := version()
return major >= 10 && build >= 16299
})
// SupportUnixSocket indicates whether the current Windows version supports
-// Unix Domain Sockets, the minimal requirement is Windows 10, build 17063.
+// Unix Domain Sockets.
+// The minimal requirement is Windows 10.0.17063.
var SupportUnixSocket = sync.OnceValue(func() bool {
- major, _, build := Version()
+ major, _, build := version()
return major >= 10 && build >= 17063
})