9d2301cae2
This diff has been extracted from c2f7ccab0e
See https://github.com/ooni/probe/issues/2096
While there, export DecodeReply to decode a raw reply without
interpreting the Rcode or parsing the results, which seems a
nice extra feature to have to more flexibly parse DNS replies
in other parts of the codebase.
12 lines
345 B
Go
12 lines
345 B
Go
package mocks
|
|
|
|
// DNSEncoder allows mocking dnsx.DNSEncoder.
|
|
type DNSEncoder struct {
|
|
MockEncode func(domain string, qtype uint16, padding bool) ([]byte, uint16, error)
|
|
}
|
|
|
|
// Encode calls MockEncode.
|
|
func (e *DNSEncoder) Encode(domain string, qtype uint16, padding bool) ([]byte, uint16, error) {
|
|
return e.MockEncode(domain, qtype, padding)
|
|
}
|