From 357fef581a8d97421e1817001d48dbb68ead3975 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:11:44 -0400 Subject: [PATCH] all: document legacy //go:linkname for final round of modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add linknames for most modules with ≥50 dependents. Add linknames for a few other modules that we know are important but are below 50. Remove linknames from badlinkname.go that do not merit inclusion (very small number of dependents). We can add them back later if the need arises. Fixes #67401. (For now.) Change-Id: I1e49fec0292265256044d64b1841d366c4106002 Reviewed-on: https://go-review.googlesource.com/c/go/+/587756 Auto-Submit: Russ Cox TryBot-Bypass: Russ Cox Reviewed-by: Cherry Mui --- badlinkname.go | 23 ----------------------- cipher_suites.go | 2 ++ defaults.go | 2 ++ 3 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 badlinkname.go diff --git a/badlinkname.go b/badlinkname.go deleted file mode 100644 index ad44bab..0000000 --- a/badlinkname.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2024 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package reality - -import _ "unsafe" - -// As of Go 1.22, the symbols below are found to be pulled via -// linkname in the wild. We provide a push linkname here, to -// keep them accessible with pull linknames. -// This may change in the future. Please do not depend on them -// in new code. - -//go:linkname cipherSuiteTLS13ByID -//go:linkname errShutdown - -// The compiler doesn't allow linknames on methods, for good reasons. -// We use this trick to push linknames of the methods. -// Do not call them in this package. - -//go:linkname badlinkname_halfConn_incSeq crypto/tls.(*halfConn).incSeq -func badlinkname_halfConn_incSeq(*halfConn) diff --git a/cipher_suites.go b/cipher_suites.go index 44d9057..3ce93a8 100644 --- a/cipher_suites.go +++ b/cipher_suites.go @@ -201,6 +201,7 @@ type cipherSuiteTLS13 struct { // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go // // Do not remove or change the type signature. // See go.dev/issue/67401. @@ -524,6 +525,7 @@ func aeadAESGCM(key, noncePrefix []byte) aead { // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/xtls/xray-core +// - github.com/v2fly/v2ray-core // // Do not remove or change the type signature. // See go.dev/issue/67401. diff --git a/defaults.go b/defaults.go index 4b8b145..cdb7675 100644 --- a/defaults.go +++ b/defaults.go @@ -61,6 +61,7 @@ func defaultCipherSuites() []uint16 { // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go // // Do not remove or change the type signature. // See go.dev/issue/67401. @@ -76,6 +77,7 @@ var defaultCipherSuitesTLS13 = []uint16{ // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/quic-go/quic-go +// - github.com/sagernet/quic-go // // Do not remove or change the type signature. // See go.dev/issue/67401.