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:
parent
43161a8138
commit
8afb3ee0d5
|
@ -1,17 +1,8 @@
|
||||||
package ptx
|
package ptx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net"
|
|
||||||
|
|
||||||
"github.com/ooni/probe-cli/v3/internal/model"
|
"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.
|
// defaultLogger is the default silentLogger instance.
|
||||||
var defaultLogger model.Logger = model.DiscardLogger
|
var defaultLogger model.Logger = model.DiscardLogger
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
pt "git.torproject.org/pluggable-transports/goptlib.git"
|
pt "git.torproject.org/pluggable-transports/goptlib.git"
|
||||||
|
"github.com/ooni/probe-cli/v3/internal/model"
|
||||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||||
"gitlab.com/yawning/obfs4.git/transports/base"
|
"gitlab.com/yawning/obfs4.git/transports/base"
|
||||||
"gitlab.com/yawning/obfs4.git/transports/obfs4"
|
"gitlab.com/yawning/obfs4.git/transports/obfs4"
|
||||||
|
@ -50,7 +51,7 @@ type OBFS4Dialer struct {
|
||||||
|
|
||||||
// UnderlyingDialer is the optional underlying dialer to
|
// UnderlyingDialer is the optional underlying dialer to
|
||||||
// use. If not set, we will use &net.Dialer{}.
|
// 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
|
// 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)
|
return factory.ParseArgs(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// underlyingDialer returns a suitable UnderlyingDialer.
|
// underlyingDialer returns a suitable SimpleDialer.
|
||||||
func (d *OBFS4Dialer) underlyingDialer() UnderlyingDialer {
|
func (d *OBFS4Dialer) underlyingDialer() model.SimpleDialer {
|
||||||
if d.UnderlyingDialer != nil {
|
if d.UnderlyingDialer != nil {
|
||||||
return d.UnderlyingDialer
|
return d.UnderlyingDialer
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ type obfs4CancellableDialer struct {
|
||||||
parsedargs interface{}
|
parsedargs interface{}
|
||||||
|
|
||||||
// ud is the underlying Dialer to use.
|
// ud is the underlying Dialer to use.
|
||||||
ud UnderlyingDialer
|
ud model.SimpleDialer
|
||||||
}
|
}
|
||||||
|
|
||||||
// dial performs the dial.
|
// dial performs the dial.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user