mdlayher / vsock

Package vsock provides access to Linux VM sockets (AF_VSOCK) for communication between a hypervisor and its virtual machines. MIT Licensed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fd behind the Conn?

paul-lalonde opened this issue · comments

Thanks for this great package - it does exactly what it says on the tin!

I need to pass the file descriptor to a vsock connection to a child process. Is there a straightforward way to get the fd (or an os.File) from the Conn retured from Accept?

I know my type, and am willing to type assert.

Yep, see: https://pkg.go.dev/github.com/mdlayher/vsock#Conn.SyscallConn

This will give you access to methods that expose the file descriptor. Closing!

Genius - thanks!