sing/common/net.go
2022-06-16 13:13:25 +08:00

17 lines
271 B
Go

package common
import (
"syscall"
)
func GetFileDescriptor(conn syscall.Conn) (uintptr, error) {
rawConn, err := conn.SyscallConn()
if err != nil {
return 0, err
}
var rawFd uintptr
err = rawConn.Control(func(fd uintptr) {
rawFd = fd
})
return rawFd, err
}