-
-
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: Change getListenerFromPlugin signature #6651
base: master
Are you sure you want to change the base?
Conversation
… addresses-funcs-rename
Can you share more on the reasoning for the rename? It's one of the oldest methods in Caddy codebase, and I worry the rename will break plugins relying on it. |
the rename is just to make its syntax distinct from net.JoinHostPort, because it has no host or port parameters. I did intend for the change to affect plugins, because when the host port and offset get passed together to getListenerFromPlugin, it is confusing which should be passed to net.JoinHostPort v.s. na.JoinHostPort without the rename. |
True, but arguably, that's even more reason to keep the I think we should leave this one, since it's been around a while and may be used in a lot of places. |
& to address your concern, currently any plugins passing a port offset to na.JoinHostPort are making one up, because before this PR they did not know the actual offset of the port they were passed, or the full port range. so that break is intentional / overlapping with the |
I'm with it if we can figure out where the offset is coming from. if plugins actually use it, it probably needs to be changed to the new offset parameter in this branch. |
The NetworkAddress is an address family and IP address and a port range, where the offset is 0 at the first port in the range, and it extends to I admit, it's my fault for not making the method return an error if the offset join result goes beyond the defined range. |
I think I get it, and that port range would come from config / a custom module? I only considered plugins using RegisterNetwork, so if plugins are reading port ranges from somewhere else I'll revert. |
It comes from user configuration. It's the value set with |
ok, RegisterNetwork plugins will be fine with the current func name. |
preemptive caddy-tailscale update: MayCXC/caddy-tailscale@afda8ef |
I wanted #6622 to go into the next release 100%, because it cleaned up an unnecessary func added in #6573 . this PR separates the address, port range, and port offset in
getListenerFromPlugin
. this lets plugins create listeners in the caddy pool if they want, and map port ranges to their own groups of listen addresses (e.g systemd socket units) in a direct way.