-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
core: addresses.go funcs renames #6622
Conversation
the last commit widens some test cases for so all that is left to put custom network plugins where I want them to be is na.JoinHostPort -> na.JoinAt, and the new getListenerFromPlugin parameters. |
it might also be better to return an error if network, host, and port are all "". but I do think any two of the three should be allowed to be blank. |
You don't need to keep clicking merge btw, we can do that after reviewed and about to be merged. This looks like a good simplification to me. But I'll let @mholt take a look first. |
I do that to check if conflicts need to be resolved ahead of time. This PR is also just half the change, to check if changing split is viable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the simplification / consistency enhancements!
HEAD removes the unreleased ParseNetworkAddressFromHostPort that I added in #6573. I would also like to rename na.JoinHostPort to na.JoinAt, to make it clear that it does not take the same parameters as net.JoinHostPort. finally, I would like to change the signature
func getListenerFromPlugin(ctx context.Context, network, addr string, config net.ListenConfig) (any, error)
to
func getListenerFromPlugin(ctx context.Context, network, host, portRange string, portOffset uint, config net.ListenConfig) (any, error)
so that plugins are aware of the port range and offset of their network addresses.
Together, these changes are meant to make a clearer interface for plugins to choose either ParseNetworkAddress(JoinNetworkAddress(...)).Listen or net.Listen(ParseNetworkAddress(JoinNetworkAddress(...)).JoinAt(portOffset)) to create their listeners, with preference for the former so they are added to the listener pool. The offset parameter in getListenerFromPlugin also lets https://github.com/MayCXC/caddy-systemd-socket-activation?tab=readme-ov-file use its custom networks to listen to a port range with a systemd named socket unit, which is a very clean integration.