2021-09-09 21:24:27 +02:00
|
|
|
package mocks
|
|
|
|
|
2021-09-27 23:09:41 +02:00
|
|
|
import "github.com/ooni/probe-cli/v3/internal/netxlite/dnsx/model"
|
|
|
|
|
|
|
|
// HTTPSSvc is the result of HTTPS queries.
|
|
|
|
type HTTPSSvc = model.HTTPSSvc
|
|
|
|
|
2021-09-09 21:24:27 +02:00
|
|
|
// Decoder allows mocking dnsx.Decoder.
|
|
|
|
type Decoder struct {
|
2021-09-27 23:09:41 +02:00
|
|
|
MockDecodeLookupHost func(qtype uint16, reply []byte) ([]string, error)
|
|
|
|
|
|
|
|
MockDecodeHTTPS func(reply []byte) (*HTTPSSvc, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeLookupHost calls MockDecodeLookupHost.
|
|
|
|
func (e *Decoder) DecodeLookupHost(qtype uint16, reply []byte) ([]string, error) {
|
|
|
|
return e.MockDecodeLookupHost(qtype, reply)
|
2021-09-09 21:24:27 +02:00
|
|
|
}
|
|
|
|
|
2021-09-27 23:09:41 +02:00
|
|
|
// DecodeHTTPS calls MockDecodeHTTPS.
|
|
|
|
func (e *Decoder) DecodeHTTPS(reply []byte) (*HTTPSSvc, error) {
|
|
|
|
return e.MockDecodeHTTPS(reply)
|
2021-09-09 21:24:27 +02:00
|
|
|
}
|