Use go:linkname in qtls_go118.go

Once and for all, whatever
This commit is contained in:
RPRX 2023-02-04 21:27:13 +08:00 committed by GitHub
parent fa7300e910
commit 00c9576118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -1,16 +1,18 @@
package quic package quic
import ( import (
"crypto"
"crypto/cipher" "crypto/cipher"
_ "crypto/tls"
"github.com/quic-go/qtls-go1-20" _ "unsafe"
) )
type ( type CipherSuiteTLS13 struct {
// A CipherSuiteTLS13 is a cipher suite for TLS 1.3 ID uint16
CipherSuiteTLS13 = qtls.CipherSuiteTLS13 KeyLen int
) AEAD func(key, fixedNonce []byte) cipher.AEAD
Hash crypto.Hash
func AEADAESGCMTLS13(key, fixedNonce []byte) cipher.AEAD {
return qtls.AEADAESGCMTLS13(key, fixedNonce)
} }
//go:linkname AEADAESGCMTLS13 crypto/tls.aeadAESGCMTLS13
func AEADAESGCMTLS13(key, nonceMask []byte) cipher.AEAD

2
go.mod
View file

@ -11,7 +11,6 @@ require (
github.com/miekg/dns v1.1.50 github.com/miekg/dns v1.1.50
github.com/pelletier/go-toml v1.9.5 github.com/pelletier/go-toml v1.9.5
github.com/pires/go-proxyproto v0.6.2 github.com/pires/go-proxyproto v0.6.2
github.com/quic-go/qtls-go1-20 v0.1.0
github.com/quic-go/quic-go v0.32.0 github.com/quic-go/quic-go v0.32.0
github.com/refraction-networking/utls v1.2.0 github.com/refraction-networking/utls v1.2.0
github.com/sagernet/sing v0.1.6 github.com/sagernet/sing v0.1.6
@ -46,6 +45,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qtls-go1-18 v0.2.0 // indirect github.com/quic-go/qtls-go1-18 v0.2.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.0 // indirect github.com/quic-go/qtls-go1-19 v0.2.0 // indirect
github.com/quic-go/qtls-go1-20 v0.1.0 // indirect
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
go.uber.org/atomic v1.10.0 // indirect go.uber.org/atomic v1.10.0 // indirect
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect