Revert "Add new TCPBufferSize parameter to network"

This reverts commit 57cb1b5aa0.
This commit is contained in:
9seconds
2021-03-17 22:03:36 +03:00
parent 83eeedc008
commit adf4ab1a35
11 changed files with 3 additions and 54 deletions
+1 -19
View File
@@ -2,34 +2,16 @@ package network
import (
"fmt"
"net"
"net/url"
"golang.org/x/net/proxy"
)
type socks5Dialer struct {
proxy.ContextDialer
bufferSize int
}
func (s socks5Dialer) Dial(protocol, address string) (net.Conn, error) {
return s.ContextDialer.(proxy.Dialer).Dial(protocol, address)
}
func (s socks5Dialer) TCPBufferSize() int {
return s.bufferSize
}
func NewSocks5Dialer(baseDialer Dialer, proxyURL *url.URL) (Dialer, error) {
rv, err := proxy.FromURL(proxyURL, baseDialer)
if err != nil {
return nil, fmt.Errorf("cannot initialize socks5 proxy dialer: %w", err)
}
return socks5Dialer{
ContextDialer: rv.(proxy.ContextDialer),
bufferSize: baseDialer.TCPBufferSize(),
}, nil
return rv.(Dialer), nil
}