mdlayher / vsock

Package vsock provides access to Linux VM sockets (AF_VSOCK) for communication between a hypervisor and its virtual machines. MIT Licensed.
MIT License
328 stars 65 forks source link

Add FileListener() #44

Closed cfergeau closed 2 years ago

cfergeau commented 3 years ago

This is an implementation of https://golang.org/pkg/net/#FileListener but for a vsock file. I'm going to use this in combination with https://github.com/coreos/go-systemd/tree/main/activation to make use of systemd vsock support for socket activation.

Ideally go would get native vsock support in its net module, or has this been tried already, and deemed not possible?

cfergeau commented 3 years ago

I don't think the go-1.11.yml failure is related to this PR:

# honnef.co/go/tools/analysis/lint
../go/pkg/mod/honnef.co/go/tools@v0.2.0/analysis/lint/lint.go:76:9: undefined: strings.ReplaceAll
note: module requires Go 1.14# golang.org/x/tools/go/packages
../go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/golist_overlay.go:550:7: undefined: strings.ReplaceAll
note: module requires Go 1.12
praveenkumar commented 3 years ago

cc @mdlayher

mdlayher commented 3 years ago

Thank you for the PR and I apologize for the delay: I am mostly on hiatus from open source software development at the moment. However I intend to address this and the other outstanding PRs as part of #45 and will follow up once I'm able to do so. Thanks again.

cfergeau commented 3 years ago

However I intend to address this and the other outstanding PRs as part of #45 and will follow up once I'm able to do so. Thanks again.

Is there anything I can do to help move this forward?

mdlayher commented 3 years ago

No, please continue to use your fork for the time being.

cfergeau commented 2 years ago

Still did not have time to take a look?

mdlayher commented 2 years ago

Apologies, I was taking a break from open source but have finally cleaned things up and tagged v1.0.0. I wanted to stabilize what's been in use for years before committing to any additional APIs.

I will try to take a look in the next couple of days to see what it would take to port this on top of my *socket.Conn type which now backs this library. This may be a good excuse to export socket.NewConn or similar which works with an existing file descriptor, but currently wraps that in a new *os.File:

https://github.com/mdlayher/socket/blob/main/conn.go#L226

Since that library is much lower level than this one, I am sure we can find an API boundary that makes sense to seamlessly integrate this. After that, I'm fine with adding FileListener to a v1.1.0 since socket activation is a valid use case that isn't possible with the existing APIs.

Thank you again for your patience.

mdlayher commented 2 years ago

Superseded by v1.1.0, thank you again. I've opened https://github.com/code-ready/crc/issues/3001 to follow up with the new version for crc!