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. |
mholt
left a comment
There was a problem hiding this comment.
Thanks for the simplification / consistency enhancements!
* right side in tls ln * remove ParseNetworkAddressFromHostPort * ignore placeholder port * remove println * update test cases (!!!) * [] * comment * Trim * Update addresses.go
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.