Documentation
¶
Overview ¶
Package socks dials connections through a SOCKS5 proxy such as Tor.
It wraps golang.org/x/net/proxy and keeps the behavior bchd relied on from github.com/btcsuite/go-socks:
- A connection reports the requested destination as its remote address, and the address the proxy bound for it as its local address, rather than the addresses of the connection to the proxy.
- With Tor stream isolation, every connection authenticates with new random credentials, so Tor puts it on a circuit of its own.
- Destinations are sent to the proxy unresolved, so the proxy resolves hostnames, including onion addresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProxiedAddr ¶
ProxiedAddr is the address of a connection made through a proxy. Host may be a hostname, such as an onion address, since the proxy resolves it.
func (*ProxiedAddr) Network ¶
func (a *ProxiedAddr) Network() string
Network returns the network of the address, such as "tcp".
func (*ProxiedAddr) String ¶
func (a *ProxiedAddr) String() string
String returns the address in host:port form.
type Proxy ¶
type Proxy struct {
// Addr is the host:port address of the proxy.
Addr string
// Username and Password are the credentials for the proxy, if it
// requires them. They are ignored when TorIsolation is set.
Username string
Password string
// TorIsolation makes every connection authenticate with new random
// credentials, which Tor uses to isolate it on a circuit of its own.
TorIsolation bool
}
Proxy dials connections through a SOCKS5 proxy.
func (*Proxy) DialContext ¶
DialContext connects to addr through the proxy. The network is "tcp", "tcp4", "tcp6" or "onion", which bchd uses for onion addresses. The context covers both connecting to the proxy and the SOCKS handshake.