Skip to content

Commit

Permalink
refactor: move ID check out of main
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Nov 2, 2023
1 parent 3df3120 commit 7ce44fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 1 addition & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,6 @@ All long form (--) flags can be toggled with the dig-standard +[no]flag notation
}
log.Debugf("Using server %s with transport %s", server, transportType)

// QUIC specific overrides
if transportType == transport.TypeQUIC {
tlsConfig.NextProtos = opts.QUICALPNTokens
// Skip ID check if QUIC (https://datatracker.ietf.org/doc/html/rfc9250#section-4.2.1)
opts.NoIDCheck = true
}

// Recursive zone transfer
if opts.RecAXFR {
if opts.Name == "" {
Expand All @@ -456,7 +449,7 @@ All long form (--) flags can be toggled with the dig-standard +[no]flag notation
return err
}

if !opts.NoIDCheck && reply.Id != msg.Id {
if transportType != transport.TypeQUIC && !opts.NoIDCheck && reply.Id != msg.Id {
return fmt.Errorf("ID mismatch: expected %d, got %d", msg.Id, reply.Id)
}
replies = append(replies, reply)
Expand Down
6 changes: 5 additions & 1 deletion resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ func newTransport(server string, transportType transport.Type, tlsConfig *tls.Co
}
case transport.TypeQUIC:
log.Debugf("Using QUIC transport: %s", server)

tc := tlsConfig.Clone()
tlsConfig.NextProtos = opts.QUICALPNTokens

ts = &transport.QUIC{
Server: server,
TLSConfig: tlsConfig,
TLSConfig: tc,
NoPMTUD: opts.QUICNoPMTUD,
AddLengthPrefix: !opts.QUICNoLengthPrefix,
ReuseConn: !opts.NoReuseConn,
Expand Down

0 comments on commit 7ce44fb

Please sign in to comment.