mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-23 10:24:15 +00:00
Refine unsafe usage
This commit is contained in:
parent
d8557bf279
commit
bcb11ad45f
1 changed files with 3 additions and 4 deletions
|
@ -129,10 +129,9 @@ func printTLSConnDetail(tlsConn *gotls.Conn) {
|
|||
tlsVersion = "TLS 1.2"
|
||||
}
|
||||
fmt.Println("TLS Version:", tlsVersion)
|
||||
p, _ := reflect.TypeOf(tlsConn).Elem().FieldByName("curveID")
|
||||
curveID := (*gotls.CurveID)(unsafe.Pointer(uintptr(unsafe.Pointer(tlsConn)) + p.Offset))
|
||||
if curveID != nil {
|
||||
PostQuantum := (*curveID == gotls.X25519MLKEM768)
|
||||
curveID := *(*gotls.CurveID)(unsafe.Pointer(reflect.ValueOf(tlsConn).Elem().FieldByName("curveID").UnsafeAddr()))
|
||||
if curveID != 0 {
|
||||
PostQuantum := (curveID == gotls.X25519MLKEM768)
|
||||
fmt.Println("Post-Quantum key exchange:", PostQuantum, "("+curveID.String()+")")
|
||||
} else {
|
||||
fmt.Println("Post-Quantum key exchange: false (RSA Exchange)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue