config+lnd+tor: Update naming
This commit is contained in:
1 parent
c4221c3c3a
commit
3378ad0120
6 files changed
+43
-40
No files matched your search
+8
-7
@@ -89,10 +89,10 @@ type ProxyNet struct {
|
||||
// will now use a distinct circuit.
|
||||
StreamIsolation bool
|
||||
|
||||
// DirectConnections allows the proxy network to use direct connections
|
||||
// to non-onion service targets. If enabled, the node IP address will be
|
||||
// revealed while communicating with such targets.
|
||||
DirectConnections bool
|
||||
// SkipProxyForClearNetTargets allows the proxy network to use direct
|
||||
// connections to non-onion service targets. If enabled, the node IP
|
||||
// address will be revealed while communicating with such targets.
|
||||
SkipProxyForClearNetTargets bool
|
||||
}
|
||||
|
||||
// Dial uses the Tor Dial function in order to establish connections through
|
||||
@@ -106,7 +106,8 @@ func (p *ProxyNet) Dial(network, address string,
|
||||
return nil, errors.New("cannot dial non-tcp network via Tor")
|
||||
}
|
||||
return Dial(
|
||||
address, p.SOCKS, p.StreamIsolation, p.DirectConnections, timeout,
|
||||
address, p.SOCKS, p.StreamIsolation,
|
||||
p.SkipProxyForClearNetTargets, timeout,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -122,8 +123,8 @@ func (p *ProxyNet) LookupSRV(service, proto,
|
||||
name string, timeout time.Duration) (string, []*net.SRV, error) {
|
||||
|
||||
return LookupSRV(
|
||||
service, proto, name, p.SOCKS, p.DNS,
|
||||
p.StreamIsolation, p.DirectConnections, timeout,
|
||||
service, proto, name, p.SOCKS, p.DNS, p.StreamIsolation,
|
||||
p.SkipProxyForClearNetTargets, timeout,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+12
-10
@@ -66,10 +66,11 @@ func (c *proxyConn) RemoteAddr() net.Addr {
|
||||
// around net.Conn in order to expose the actual remote address we're dialing,
|
||||
// rather than the proxy's address.
|
||||
func Dial(address, socksAddr string, streamIsolation bool,
|
||||
directConnections bool, timeout time.Duration) (net.Conn, error) {
|
||||
skipProxyForClearNetTargets bool, timeout time.Duration) (net.Conn, error) {
|
||||
|
||||
conn, err := dial(
|
||||
address, socksAddr, streamIsolation, directConnections, timeout,
|
||||
address, socksAddr, streamIsolation,
|
||||
skipProxyForClearNetTargets, timeout,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,11 +97,11 @@ func Dial(address, socksAddr string, streamIsolation bool,
|
||||
// connection. If enabled, new connections will use a fresh circuit, rather than
|
||||
// possibly re-using an existing circuit.
|
||||
//
|
||||
// directConnections argument allows the dialer to directly connect to the
|
||||
// provided address if it does not represent an union service, skipping the
|
||||
// SOCKS proxy.
|
||||
// skipProxyForClearNetTargets argument allows the dialer to directly connect
|
||||
// to the provided address if it does not represent an union service, skipping
|
||||
// the SOCKS proxy.
|
||||
func dial(address, socksAddr string, streamIsolation bool,
|
||||
directConnections bool, timeout time.Duration) (net.Conn, error) {
|
||||
skipProxyForClearNetTargets bool, timeout time.Duration) (net.Conn, error) {
|
||||
|
||||
// If we were requested to force stream isolation for this connection,
|
||||
// we'll populate the authentication credentials with random data as
|
||||
@@ -119,7 +120,7 @@ func dial(address, socksAddr string, streamIsolation bool,
|
||||
}
|
||||
|
||||
clearDialer := &net.Dialer{Timeout: timeout}
|
||||
if directConnections {
|
||||
if skipProxyForClearNetTargets {
|
||||
host, _, err := net.SplitHostPort(address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -158,12 +159,13 @@ func LookupHost(host, socksAddr string) ([]string, error) {
|
||||
// proxy by connecting directly to a DNS server and querying it. The DNS server
|
||||
// must have TCP resolution enabled for the given port.
|
||||
func LookupSRV(service, proto, name, socksAddr,
|
||||
dnsServer string, streamIsolation bool,
|
||||
directConnections bool, timeout time.Duration) (string, []*net.SRV, error) {
|
||||
dnsServer string, streamIsolation bool, skipProxyForClearNetTargets bool,
|
||||
timeout time.Duration) (string, []*net.SRV, error) {
|
||||
|
||||
// Connect to the DNS server we'll be using to query SRV records.
|
||||
conn, err := dial(
|
||||
dnsServer, socksAddr, streamIsolation, directConnections, timeout,
|
||||
dnsServer, socksAddr, streamIsolation,
|
||||
skipProxyForClearNetTargets, timeout,
|
||||
)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
|
||||
Reference in new issue
Block a user