Chore: Migrate to Go 1.25 (#5024)

* Try to update to go1.25

* Remove unsafe usage
pull/5006/head^2
风扇滑翔翼 2025-08-15 22:50:35 +08:00 committed by GitHub
parent 836b6487e4
commit 5a8e9c25a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/xtls/xray-core
go 1.24
go 1.25
require (
github.com/cloudflare/circl v1.6.1

View File

@ -6,9 +6,7 @@ import (
"encoding/base64"
"fmt"
"net"
"reflect"
"strconv"
"unsafe"
"github.com/xtls/xray-core/main/commands/base"
. "github.com/xtls/xray-core/transport/internet/tls"
@ -139,14 +137,15 @@ func printCertificates(certs []*x509.Certificate) {
}
func printTLSConnDetail(tlsConn *gotls.Conn) {
connectionState := tlsConn.ConnectionState()
var tlsVersion string
if tlsConn.ConnectionState().Version == gotls.VersionTLS13 {
if connectionState.Version == gotls.VersionTLS13 {
tlsVersion = "TLS 1.3"
} else if tlsConn.ConnectionState().Version == gotls.VersionTLS12 {
} else if connectionState.Version == gotls.VersionTLS12 {
tlsVersion = "TLS 1.2"
}
fmt.Println("TLS Version: ", tlsVersion)
curveID := *(*gotls.CurveID)(unsafe.Pointer(reflect.ValueOf(tlsConn).Elem().FieldByName("curveID").UnsafeAddr()))
curveID := connectionState.CurveID
if curveID != 0 {
PostQuantum := (curveID == gotls.X25519MLKEM768)
fmt.Println("TLS Post-Quantum key exchange: ", PostQuantum, "("+curveID.String()+")")