fix: name the proxy schemes that work, and stop panicking on the rest
"Which proxy does this support?" has a narrower answer than the docs
gave. `golang.org/x/net/proxy.FromURL` resolves `socks5` and `socks5h`
and nothing else, yet the README and `Proxy`'s doc comment both offered
"socks5, socks4 and socks4a". A `socks4://` URI fails every dial with
`proxy: unknown scheme: socks4`, which is what taking the docs at their
word looks like from the caller's side.
Corrected both, and pointed at `proxy.RegisterDialerType` -- the way
x/net/proxy expects a caller to add a scheme it does not carry.
That escape hatch had a second problem waiting. `establishProxyConnection`
asserted the dialer to `proxy.ContextDialer` unconditionally, but a
registered dialer need only implement `Dial`, and the assertion panicked
on those:
interface conversion: T is not proxy.ContextDialer: missing method
DialContext
It now falls back to dialing on a goroutine and abandoning the attempt
when the context expires, which is what x/net/proxy itself does for the
same case.
Closes: #95
This commit is contained in:
1 parent
74c6cde98a
commit
87744aa7c1
4 files changed
+80
-3
No files matched your search
+4
-1
@@ -226,7 +226,10 @@ func (v *Verifier) HelloName(domain string) *Verifier {
|
||||
|
||||
// Proxy sets a SOCKS5 proxy to verify the email,
|
||||
// proxyURI should be in the format: "socks5://user:password@127.0.0.1:1080".
|
||||
// The protocol could be socks5, socks4 and socks4a.
|
||||
//
|
||||
// The scheme must be socks5 or socks5h -- the only two golang.org/x/net/proxy
|
||||
// resolves. Anything else, socks4 and socks4a included, fails the dial with
|
||||
// "proxy: unknown scheme"; add it with proxy.RegisterDialerType.
|
||||
//
|
||||
// Only the scheme, credentials and host are read; a query string is ignored, so
|
||||
// a "?timeout=5s" has no effect. Use ConnectTimeout and OperationTimeout.
|
||||
|
||||
Reference in new issue
Block a user