mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 04:17:38 +03:00
17 lines
271 B
Go
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
|
|
}
|