2023-02-25 08:24:08 +00:00
|
|
|
//go:build with_reality_server
|
|
|
|
|
|
|
|
package vless
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"reflect"
|
|
|
|
"unsafe"
|
|
|
|
|
2023-02-26 12:55:36 +00:00
|
|
|
"github.com/sagernet/reality"
|
2023-02-25 08:24:08 +00:00
|
|
|
"github.com/sagernet/sing/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
tlsRegistry = append(tlsRegistry, func(conn net.Conn) (loaded bool, netConn net.Conn, reflectType reflect.Type, reflectPointer uintptr) {
|
|
|
|
tlsConn, loaded := common.Cast[*reality.Conn](conn)
|
|
|
|
if !loaded {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
return true, tlsConn.NetConn(), reflect.TypeOf(tlsConn).Elem(), uintptr(unsafe.Pointer(tlsConn))
|
|
|
|
})
|
|
|
|
}
|