-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Advertise multiple listeners via Alt-Svc and improve perf of SetQuicHeaders #3352
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3352 +/- ##
==========================================
+ Coverage 85.52% 85.57% +0.04%
==========================================
Files 135 135
Lines 9837 9860 +23
==========================================
+ Hits 8413 8437 +24
Misses 1046 1046
+ Partials 378 377 -1
Continue to review full report at Codecov.
|
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.
There is a valid use case for using a listener running on top of a net.PacketConn
that is not a net.UDPConn
, and which might not have a port to begin with. I'm wondering if we should just log the error, and skip addresses for which we can't determine the port. We could then extract the port on addListener
.
wdyt?
http3/server.go
Outdated
return 0, err | ||
} | ||
|
||
portInt, err := net.LookupPort("tcp", portStr) |
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 aware this wasn't introduced by this PR, but is this correct? Can't we just do a strconv.Atoi
here?
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.
Well, there's technically a test which supplies ":https" as the port, and it is valid to run http3.Server.ListenAndServe
with an address like ":https" given (which should launch a udp listener on 0.0.0.0:443). I don't really find it meaningful to support this and would rather have the function simply split by ':' and then do an Atoi
, so that SetQuicHeaders
doesn't return an error. But since it's already supported and SetQuicHeaders
returns an error, doesn't make sense to change the API now 😕
What do you mean by "extract the port on |
I wasn't suggesting to use 443 by default. Sorry for the confusion. Let me rephrase: We could get rid of the |
Ah, okay, this makes sense now. Though I think in this case, if no other ports are found from the listeners, I think we should try using |
Thank you! |
…eaders (quic-go#3352) * feat: cache alt-svc headers and announce all listeners instead of just one * feat: use Server.Addr for SetQuicHeaders if no port is available from listeners
PR to resolve #3350.
Looking at the profile of Caddy with this commit used,
SetQuicHeaders
seems to work 5 times faster now, and pretty much consists of a single slice append.