8b9fe1a160
This new API call performs DNS lookups for HTTPS records. Part of https://github.com/ooni/probe/issues/1733 and diff has been extracted from https://github.com/ooni/probe-cli/pull/506.
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/netxlite/dnsx/model"
|
|
)
|
|
|
|
// Resolver is a mockable Resolver.
|
|
type Resolver struct {
|
|
MockLookupHost func(ctx context.Context, domain string) ([]string, error)
|
|
MockNetwork func() string
|
|
MockAddress func() string
|
|
MockCloseIdleConnections func()
|
|
MockLookupHTTPS func(ctx context.Context, domain string) (*HTTPSSvc, error)
|
|
}
|
|
|
|
// LookupHost calls MockLookupHost.
|
|
func (r *Resolver) LookupHost(ctx context.Context, domain string) ([]string, error) {
|
|
return r.MockLookupHost(ctx, domain)
|
|
}
|
|
|
|
// Address calls MockAddress.
|
|
func (r *Resolver) Address() string {
|
|
return r.MockAddress()
|
|
}
|
|
|
|
// Network calls MockNetwork.
|
|
func (r *Resolver) Network() string {
|
|
return r.MockNetwork()
|
|
}
|
|
|
|
// CloseIdleConnections calls MockCloseIdleConnections.
|
|
func (r *Resolver) CloseIdleConnections() {
|
|
r.MockCloseIdleConnections()
|
|
}
|
|
|
|
// HTTPSSvc is an HTTPSSvc reply.
|
|
type HTTPSSvc = model.HTTPSSvc
|
|
|
|
// LookupHTTPS calls MockLookupHTTPS.
|
|
func (r *Resolver) LookupHTTPS(ctx context.Context, domain string) (*HTTPSSvc, error) {
|
|
return r.MockLookupHTTPS(ctx, domain)
|
|
}
|