Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add FilesWithNames() to activation #448

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

MayCXC
Copy link

@MayCXC MayCXC commented Oct 9, 2024

I'd like to upstream the function here https://github.com/MayCXC/caddy-systemd-socket-activation/blob/master/networks.go#L25

which is like the *WithNames funcs here

func ListenersWithNames() (map[string][]net.Listener, error) {
, but with the benefit that it works for any network (tcp/udp/unix/unixgram/etc.) that a socket might be bound to, and lets the caller choose how to make a FileListener or FilePacketConn from them.

@prestist
Copy link

Thank you for contributing! Would you mind explaining your usecase ?

@MayCXC
Copy link
Author

MayCXC commented Oct 18, 2024

sure, my program uses socket units with both Listen and ListenDatagram settings, some of which may be used to create TLS listeners, and some of which may not. The existing *WithNames functions assume that all the sockets use the same protocol, and that either all or none will be used to create TLS listeners. FilesWithNames() provides the same LISTEN_FDS/LISTEN_FDNAMES mapping to files that the appropriate listeners can be created with, but without making these assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants