Skip to content

Commit

Permalink
refactor(dnscoretest): embed io.Writer in ResponseWriter (#11)
Browse files Browse the repository at this point in the history
This is more clear, obvious, and idiomatic.

While there, document by NewServerAddr constructs a pointer and other
API functions expect a `*ServerAddr` value.
  • Loading branch information
bassosimone authored Nov 25, 2024
1 parent 959e3be commit 4a077f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dnscoretest/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package dnscoretest

import (
"io"
"net"

"github.com/miekg/dns"
Expand All @@ -11,7 +12,7 @@ import (

// ResponseWriter allows writing raw DNS responses.
type ResponseWriter interface {
Write(rawMsg []byte) (int, error)
io.Writer
}

// Handler is a function that handles a DNS query.
Expand Down
4 changes: 4 additions & 0 deletions serveraddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const (

// ServerAddr is a DNS server address.
//
// While currently minimal, ServerAddr is designed as a pointer type to
// allow for future extensions of server-specific properties (e.g., custom
// headers for DoH) without requiring breaking API changes.
//
// Construct using [NewServerAddr].
type ServerAddr struct {
// Protocol is the transport protocol to use.
Expand Down

0 comments on commit 4a077f4

Please sign in to comment.