-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
multiplexing: Introduce packet conn wrappers #7180
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
base: master
Are you sure you want to change the base?
Conversation
a211f69
to
985e05d
Compare
@@ -431,7 +431,7 @@ func JoinNetworkAddress(network, host, port string) string { | |||
// | |||
// NOTE: This API is EXPERIMENTAL and may be changed or removed. | |||
// NOTE: user should close the returned listener twice, once to stop accepting new connections, the second time to free up the packet conn. | |||
func (na NetworkAddress) ListenQUIC(ctx context.Context, portOffset uint, config net.ListenConfig, tlsConf *tls.Config) (http3.QUICListener, error) { | |||
func (na NetworkAddress) ListenQUIC(ctx context.Context, portOffset uint, config net.ListenConfig, tlsConf *tls.Config, pcWrappers []PacketConnWrapper) (http3.QUICListener, error) { |
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.
I would use variadic parameters ...PacketConnWrapper
so that callers won't have to change anything if no packet conn wrappers are present.
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.
I have nothing against your suggestion, But I've searched for this function callers and found there is only one. It's also mentioned that this function is experimental and subject to change. Could you please elaborate on the callers your are referring to?
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.
In caddy core, there is only this one. But who knows what plugin authors will do?
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.
I can see your point and sorry for being tedious, but I've searched again, and found 23 mentions of caddy.ListenQUIC
in the code with all of them being outdated Caddy forks. So there are virtually no plugins using this function yet. Why shall we take care of anything that doesn't even exist?
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.
I'm not requesting a change, just voice my opinion. It's not taking care of something, it's defensive programming.
Thanks for working on this @vnxme ! I will get back to this soon, I just need to tag a new Caddy release first. |
This PR introduces
packet_conn_wrappers
. They are designed to work for packet connections (i.e., UDP) the same waylistener_wrappers
are applicable to listeners (i.e., TCP).At the moment, there are no modules that implement this interface, but it's a matter of time and effort. The first one could be
layer4
. Unliketls
, there is no placeholder wrapper, i.e. all wrappers come before the QUIC handshake.This change expands Caddy's multiplexing capabilities (e.g., allow for serving HTTP/3 and anything UDP-based like WireGuard, OpenVPN, DNS, etc. simultaneously on the same port).