cleanup(ptx): remove redundant dialer definition (#644)

We can just use model.SimpleDialer here.

See https://github.com/ooni/probe/issues/1885.
This commit is contained in:
Simone Basso 2022-01-04 12:46:55 +01:00 committed by GitHub
parent 43161a8138
commit 8afb3ee0d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -1,17 +1,8 @@
package ptx
import (
"context"
"net"
"github.com/ooni/probe-cli/v3/internal/model"
)
// UnderlyingDialer is the underlying dialer used for dialing.
type UnderlyingDialer interface {
// DialContext behaves like net.Dialer.DialContext.
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
// defaultLogger is the default silentLogger instance.
var defaultLogger model.Logger = model.DiscardLogger

View File

@ -8,6 +8,7 @@ import (
"time"
pt "git.torproject.org/pluggable-transports/goptlib.git"
"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/runtimex"
"gitlab.com/yawning/obfs4.git/transports/base"
"gitlab.com/yawning/obfs4.git/transports/obfs4"
@ -50,7 +51,7 @@ type OBFS4Dialer struct {
// UnderlyingDialer is the optional underlying dialer to
// use. If not set, we will use &net.Dialer{}.
UnderlyingDialer UnderlyingDialer
UnderlyingDialer model.SimpleDialer
}
// DialContext establishes a connection with the given obfs4 proxy. The context
@ -94,8 +95,8 @@ func (d *OBFS4Dialer) parseargs(factory base.ClientFactory) (interface{}, error)
return factory.ParseArgs(args)
}
// underlyingDialer returns a suitable UnderlyingDialer.
func (d *OBFS4Dialer) underlyingDialer() UnderlyingDialer {
// underlyingDialer returns a suitable SimpleDialer.
func (d *OBFS4Dialer) underlyingDialer() model.SimpleDialer {
if d.UnderlyingDialer != nil {
return d.UnderlyingDialer
}
@ -120,7 +121,7 @@ type obfs4CancellableDialer struct {
parsedargs interface{}
// ud is the underlying Dialer to use.
ud UnderlyingDialer
ud model.SimpleDialer
}
// dial performs the dial.