Skip to content

Commit 95e33c7

Browse files
committed
chore: replace HasAESGCMHardwareSupport in vless encryption
1 parent 8be130a commit 95e33c7

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f
3838
github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719
3939
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0
40-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2
40+
github.com/metacubex/utls v1.8.1-0.20250923135100-82a67cb8e6fc
4141
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f
4242
github.com/miekg/dns v1.1.63 // lastest version compatible with golang1.20
4343
github.com/mroth/weightedrand/v2 v2.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKea
145145
github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE=
146146
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE=
147147
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw=
148-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY=
149-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88=
148+
github.com/metacubex/utls v1.8.1-0.20250923135100-82a67cb8e6fc h1:qLKXsTxye1WESfWrKvKjJ0DfgOsEePKrqE8NzA+Bp9M=
149+
github.com/metacubex/utls v1.8.1-0.20250923135100-82a67cb8e6fc/go.mod h1:KmvTxsY4vXq71DXBN4V54zyNeYJF4oujRSW4nCvSF24=
150150
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk=
151151
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4=
152152
github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E=

transport/vless/encryption/client.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,12 @@ import (
77
"errors"
88
"io"
99
"net"
10-
"runtime"
1110
"sync"
1211
"time"
1312

1413
"github.com/metacubex/blake3"
14+
utls "github.com/metacubex/utls"
1515
"github.com/metacubex/utls/mlkem"
16-
"golang.org/x/sys/cpu"
17-
)
18-
19-
var (
20-
// Keep in sync with crypto/tls/cipher_suites.go.
21-
hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ && cpu.X86.HasSSE41 && cpu.X86.HasSSSE3
22-
hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL
23-
hasGCMAsmS390X = cpu.S390X.HasAES && cpu.S390X.HasAESCTR && cpu.S390X.HasGHASH
24-
hasGCMAsmPPC64 = runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le"
25-
26-
HasAESGCMHardwareSupport = hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X || hasGCMAsmPPC64
2716
)
2817

2918
type ClientInstance struct {
@@ -77,7 +66,7 @@ func (i *ClientInstance) Handshake(conn net.Conn) (*CommonConn, error) {
7766
if i.NfsPKeys == nil {
7867
return nil, errors.New("uninitialized")
7968
}
80-
c := NewCommonConn(conn, HasAESGCMHardwareSupport)
69+
c := NewCommonConn(conn, utls.HasAESGCMHardwareSupport())
8170

8271
ivAndRealysLength := 16 + i.RelaysLength
8372
pfsKeyExchangeLength := 18 + 1184 + 32 + 16

0 commit comments

Comments
 (0)