cleanup: remove UnderlyingNetworkLibrary and TProxy (#874)

* cleanup: remove UnderlyingNetworkLibrary and TProxy

While there, replace mixture of mocking and real connections inside
quicping with pure mocking of network connections.

Closes https://github.com/ooni/probe/issues/2224

* cleanup: we don't need a SimpleResolver now

This type was only used by UnderlyingNetworkLibrary and all the
rest of the code uses Resolver. So, let's avoid complexity by zapping
the SimpleResolver type and merging it inside Resolver.
This commit is contained in:
Simone Basso
2022-08-23 11:43:44 +02:00
committed by GitHub
parent 2301a30630
commit da1c13e312
8 changed files with 75 additions and 164 deletions
+2 -24
View File
@@ -211,9 +211,8 @@ type QUICDialer interface {
CloseIdleConnections()
}
// SimpleResolver is a simplified resolver that only allows to perform
// an ordinary lookup operation and to know the resolver's name.
type SimpleResolver interface {
// Resolver performs domain name resolutions.
type Resolver interface {
// LookupHost behaves like net.Resolver.LookupHost.
LookupHost(ctx context.Context, hostname string) (addrs []string, err error)
@@ -239,12 +238,6 @@ type SimpleResolver interface {
// for an explanation of why it would not be proper to call "netgo" the
// resolver we get by default from the standard library.
Network() string
}
// Resolver performs domain name resolutions.
type Resolver interface {
// A Resolver is also a SimpleResolver.
SimpleResolver
// Address returns the resolver address (e.g., 8.8.8.8:53).
Address() string
@@ -484,18 +477,3 @@ type UDPLikeConn interface {
// which is also instrumental to setting the read buffer.
SyscallConn() (syscall.RawConn, error)
}
// UnderlyingNetworkLibrary defines the basic functionality from
// which the network extensions depend. By changing the default
// implementation of this interface, we can implement a wide array
// of tests, including self censorship tests.
type UnderlyingNetworkLibrary interface {
// ListenUDP creates a new model.UDPLikeConn conn.
ListenUDP(network string, laddr *net.UDPAddr) (UDPLikeConn, error)
// DefaultResolver returns the default resolver.
DefaultResolver() SimpleResolver
// NewSimpleDialer returns a new SimpleDialer.
NewSimpleDialer(timeout time.Duration) SimpleDialer
}