Skip to content

Commit 00c9576

Browse files
authored
Use go:linkname in qtls_go118.go
Once and for all, whatever
1 parent fa7300e commit 00c9576

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

common/protocol/quic/qtls_go118.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package quic
22

33
import (
4+
"crypto"
45
"crypto/cipher"
5-
6-
"github.com/quic-go/qtls-go1-20"
7-
)
8-
9-
type (
10-
// A CipherSuiteTLS13 is a cipher suite for TLS 1.3
11-
CipherSuiteTLS13 = qtls.CipherSuiteTLS13
6+
_ "crypto/tls"
7+
_ "unsafe"
128
)
139

14-
func AEADAESGCMTLS13(key, fixedNonce []byte) cipher.AEAD {
15-
return qtls.AEADAESGCMTLS13(key, fixedNonce)
10+
type CipherSuiteTLS13 struct {
11+
ID uint16
12+
KeyLen int
13+
AEAD func(key, fixedNonce []byte) cipher.AEAD
14+
Hash crypto.Hash
1615
}
16+
17+
//go:linkname AEADAESGCMTLS13 crypto/tls.aeadAESGCMTLS13
18+
func AEADAESGCMTLS13(key, nonceMask []byte) cipher.AEAD

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require (
1111
github.com/miekg/dns v1.1.50
1212
github.com/pelletier/go-toml v1.9.5
1313
github.com/pires/go-proxyproto v0.6.2
14-
github.com/quic-go/qtls-go1-20 v0.1.0
1514
github.com/quic-go/quic-go v0.32.0
1615
github.com/refraction-networking/utls v1.2.0
1716
github.com/sagernet/sing v0.1.6
@@ -46,6 +45,7 @@ require (
4645
github.com/pmezard/go-difflib v1.0.0 // indirect
4746
github.com/quic-go/qtls-go1-18 v0.2.0 // indirect
4847
github.com/quic-go/qtls-go1-19 v0.2.0 // indirect
48+
github.com/quic-go/qtls-go1-20 v0.1.0 // indirect
4949
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
5050
go.uber.org/atomic v1.10.0 // indirect
5151
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect

0 commit comments

Comments
 (0)