ooni-probe-cli/internal/model/mocks/resolver.go
Simone Basso ce052b665e
feat(netxlite): implements NS queries (#734)
This diff has been extracted from eb0bf38957.

See https://github.com/ooni/probe/issues/2096.

While there, skip the broken tests caused by issue
https://github.com/ooni/probe/issues/2098.
2022-05-16 10:46:53 +02:00

49 lines
1.3 KiB
Go

package mocks
import (
"context"
"net"
"github.com/ooni/probe-cli/v3/internal/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) (*model.HTTPSSvc, error)
MockLookupNS func(ctx context.Context, domain string) ([]*net.NS, 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()
}
// LookupHTTPS calls MockLookupHTTPS.
func (r *Resolver) LookupHTTPS(ctx context.Context, domain string) (*model.HTTPSSvc, error) {
return r.MockLookupHTTPS(ctx, domain)
}
// LookupNS calls MockLookupNS.
func (r *Resolver) LookupNS(ctx context.Context, domain string) ([]*net.NS, error) {
return r.MockLookupNS(ctx, domain)
}