Is there any way to get the file descriptor from a tls.Conn?
I'm trying to add tls to epoll. But I can't find fd in a tls.Conn.
Is there any way to get the file descriptor from a tls.Conn?
I'm trying to add tls to epoll. But I can't find fd in a tls.Conn.
func FDFromTLSConn(conn tls.Conn) int {
tcpConn := reflect.Indirect(reflect.ValueOf(conn)).FieldByName("conn")
fdVal := tcpConn.FieldByName("fd")
pfdVal := reflect.Indirect(fdVal).FieldByName("pfd")
return int(pfdVal.FieldByName("Sysfd").Int())
}