Finish implementing net.Dialer
This commit is contained in:
parent
ceddd8242d
commit
37577cf7a4
2
defs.go
2
defs.go
|
@ -94,7 +94,7 @@ func defOpt() *swampOptions {
|
|||
sm.recycle.Store(true)
|
||||
sm.debug.Store(false)
|
||||
sm.validationTimeout.Store(time.Duration(12) * time.Second)
|
||||
sm.serverTimeout.Store(time.Duration(360) * time.Second)
|
||||
sm.serverTimeout.Store(time.Duration(60) * time.Second)
|
||||
|
||||
sm.dialerBailout.Store(defBailout)
|
||||
sm.stale.Store(defaultStaleTime)
|
||||
|
|
|
@ -11,11 +11,16 @@ import (
|
|||
"h12.io/socks"
|
||||
)
|
||||
|
||||
// DialContext is a simple stub adapter for compatibility with certain packages.
|
||||
// DialContext is a simple stub adapter to implement a net.Dialer.
|
||||
func (s *Swamp) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
return s.MysteryDialer(ctx, network, addr)
|
||||
}
|
||||
|
||||
// DialContext is a simple stub adapter to implement a net.Dialer.
|
||||
func (s *Swamp) Dial(network, addr string) (net.Conn, error) {
|
||||
return s.DialContext(context.Background(), network, addr)
|
||||
}
|
||||
|
||||
// MysteryDialer is a dialer function that will use a different proxy for every request.
|
||||
func (s *Swamp) MysteryDialer(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
var sock *Proxy
|
||||
|
|
Loading…
Reference in New Issue