-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
QUIC/DoQ support using quic-go #1377
Conversation
Draft implementation of DoQ support using quic-go, example: cert, _ := tls.LoadX509KeyPair("<cert>", "<key>") config := tls.Config{ Certificates: []tls.Certificate{cert}, } server := &dns.Server{Addr: "<addr>", Net: "doq", TLSConfig: &config, Handler: <handle>})
thanks for doing this. I'll go over the code and try to ask stupid questions. Note: I have no intention to merge this, because I'm waiting what Go's std lib will do here. Also |
@@ -74,6 +81,7 @@ type response struct { | |||
tsigProvider TsigProvider | |||
udp net.PacketConn // i/o connection if UDP was used | |||
tcp net.Conn // i/o connection if TCP was used | |||
doq quic.Stream // i/o connection if QUIC was used |
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.
can't we check if it's a quick stream when we accept a udp conn? And then do a type assertion on the net.PacketConn
we have if it implements Stream()
- or whatever the interface is?
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.
A quic.Stream
is not a net.PacketConn
, and a quic.Connection
can have many quic.Stream
s (each stream will carry one query/response)
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.
yes, but https://github.com/lucas-clemente/quic-go/blob/master/example/echo/echo.go#L39 shows it is a conn first and after that some quic stuff happens, I wonder if we could do the same to avoid much code duplication (this may be impossible)
Ah OK. So are you willing to change the internal of If so, then I can spend next week hammering out an suggestion. If not, then I'll solved all of this in another way. Please let me know ASAP, thanks! |
honestly don't know - when we added grpc in coredns nothing needed changing this lib, so I don't see yet why quic is somehow special here (yes I understand the streams are fundamentally different than anything before) Also once we merged we can't easily break folks because of backwards compat and we might also design it towards quic-go while noone knows how the final impl. looks that will hopefully end up in the std lib. |
ref golang/go#32204 |
The suggestion, if any, would be made in a way that has zero affect on the current API and interfaces. I'm thinking just internal stuff to add more protocol via Basically use-case would be:
Of course if there is no interest at all in having such pluggable design then I'll solve it in another way and we can close this PR. |
[ Quoting ***@***.***> in "Re: [miekg/dns] QUIC/DoQ support us..." ]
The suggestion, if any, would be made in a way that has zero affect on the
current API and interfaces. I'm thinking just internal stuff to add more
protocol via dns.Server.Net in a pluggable way so that I can make (and manage)
a "dns-quic-go" module that people can use seamlessly.
Basically use-case would be:
import (
"github.com/miekg/dns"
"github.com/DNS-OARC/dns-quic-go"
)
func () {
srv := &dns.Server{Addr: "...", Net: "quic-go", Handler: ...}
srv.ListenAndServe()
}
Of course if there is no interest at all in having such pluggable design then
I'll solve it in another way and we can close this PR.
That would be a nice way forward.
Cevaet: a new protocol happens every 5/10 years-ish?? So it may turn out having this
pluggeable doesn't give us that much and we should rip it out again.
|
After looking over the code I can't really see a simple way to make protocols pluggable, they are too tied into a lot of things such as the The design is also around having one listener listening for one connection that delivers DNS messages where QUIC is conn listener -> stream listener -> streams. Sure, that could be solved with channels etc but then it's workarounds which makes the code clunky and slow. I think a better approach is to make my own module that mimics Thanks for the reviews and discussion! |
Work In Progress !
Draft implementation of DoQ support using quic-go, this PR serves as discussion forum for if this is the right way forward as the dependencies are quite large.
TODO:
ListenAndServeDoQ()
?_test
coderesponse.tcp
when using QUIC+ all TODO's in the code
Example:
ref #1370