mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-29 09:55:31 +00:00
Remove unsafe usage
This commit is contained in:
parent
fc4a8314c1
commit
1e5c668286
@ -6,9 +6,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/main/commands/base"
|
"github.com/xtls/xray-core/main/commands/base"
|
||||||
. "github.com/xtls/xray-core/transport/internet/tls"
|
. "github.com/xtls/xray-core/transport/internet/tls"
|
||||||
@ -139,14 +137,15 @@ func printCertificates(certs []*x509.Certificate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printTLSConnDetail(tlsConn *gotls.Conn) {
|
func printTLSConnDetail(tlsConn *gotls.Conn) {
|
||||||
|
connectionState := tlsConn.ConnectionState()
|
||||||
var tlsVersion string
|
var tlsVersion string
|
||||||
if tlsConn.ConnectionState().Version == gotls.VersionTLS13 {
|
if connectionState.Version == gotls.VersionTLS13 {
|
||||||
tlsVersion = "TLS 1.3"
|
tlsVersion = "TLS 1.3"
|
||||||
} else if tlsConn.ConnectionState().Version == gotls.VersionTLS12 {
|
} else if connectionState.Version == gotls.VersionTLS12 {
|
||||||
tlsVersion = "TLS 1.2"
|
tlsVersion = "TLS 1.2"
|
||||||
}
|
}
|
||||||
fmt.Println("TLS Version: ", tlsVersion)
|
fmt.Println("TLS Version: ", tlsVersion)
|
||||||
curveID := *(*gotls.CurveID)(unsafe.Pointer(reflect.ValueOf(tlsConn).Elem().FieldByName("curveID").UnsafeAddr()))
|
curveID := connectionState.CurveID
|
||||||
if curveID != 0 {
|
if curveID != 0 {
|
||||||
PostQuantum := (curveID == gotls.X25519MLKEM768)
|
PostQuantum := (curveID == gotls.X25519MLKEM768)
|
||||||
fmt.Println("TLS Post-Quantum key exchange: ", PostQuantum, "("+curveID.String()+")")
|
fmt.Println("TLS Post-Quantum key exchange: ", PostQuantum, "("+curveID.String()+")")
|
||||||
|
Loading…
Reference in New Issue
Block a user