pojntfx / go-nbd

Pure Go NBD server and client library.
Apache License 2.0
353 stars 18 forks source link

Support socket activation #12

Closed rwmjones closed 3 months ago

rwmjones commented 7 months ago

To make go-nbd easier to use from libnbd or systemd, you should probably add support for systemd socket activation. This doesn't require or involve libnbd or systemd, it just means you parse a few environment variables in a standardized way. Many, many servers of all kinds support this protocol, eg. Apache.

In its simplest form:

If this was enabled, then you'd be able to start up go-nbd either from a systemd unit or (more interesting to me) from this libnbd call: https://libguestfs.org/nbd_connect_systemd_socket_activation.3.html

Example of code that does this in nbdkit:

https://gitlab.com/nbdkit/nbdkit/-/blob/master/server/socket-activation.c?ref_type=heads

rwmjones commented 7 months ago

(Adding @ebblake)

pojntfx commented 3 months ago

Similarly to https://github.com/pojntfx/go-nbd/issues/11#issuecomment-2259370646 this isn't really something that would be part of the scope of this library. We don't create the listener in this library, that is up to the consumer.