2021-09-09 21:24:27 +02:00
|
|
|
package mocks
|
|
|
|
|
2022-01-03 13:53:23 +01:00
|
|
|
import "github.com/ooni/probe-cli/v3/internal/model"
|
2021-09-27 23:09:41 +02:00
|
|
|
|
2021-09-28 10:47:59 +02:00
|
|
|
// DNSDecoder allows mocking dnsx.DNSDecoder.
|
|
|
|
type DNSDecoder struct {
|
2021-09-27 23:09:41 +02:00
|
|
|
MockDecodeLookupHost func(qtype uint16, reply []byte) ([]string, error)
|
|
|
|
|
2022-01-03 13:53:23 +01:00
|
|
|
MockDecodeHTTPS func(reply []byte) (*model.HTTPSSvc, error)
|
2021-09-27 23:09:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeLookupHost calls MockDecodeLookupHost.
|
2021-09-28 10:47:59 +02:00
|
|
|
func (e *DNSDecoder) DecodeLookupHost(qtype uint16, reply []byte) ([]string, error) {
|
2021-09-27 23:09:41 +02:00
|
|
|
return e.MockDecodeLookupHost(qtype, reply)
|
2021-09-09 21:24:27 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 23:09:41 +02:00
|
|
|
// DecodeHTTPS calls MockDecodeHTTPS.
|
2022-01-03 13:53:23 +01:00
|
|
|
func (e *DNSDecoder) DecodeHTTPS(reply []byte) (*model.HTTPSSvc, error) {
|
2021-09-27 23:09:41 +02:00
|
|
|
return e.MockDecodeHTTPS(reply)
|
2021-09-09 21:24:27 +02:00
|
|
|
}
|