Documentation ¶
Index ¶
- func TorDial(address, socksPort string, streamIsolation bool) (net.Conn, error)
- func TorLookupHost(host, socksPort string) ([]string, error)
- func TorLookupSRV(service, proto, name, socksPort, dnsServer string) (string, []*net.SRV, error)
- func TorResolveTCP(address, socksPort string) (*net.TCPAddr, error)
- type Net
- type RegularNet
- func (r *RegularNet) Dial(network, address string) (net.Conn, error)
- func (r *RegularNet) LookupHost(host string) ([]string, error)
- func (r *RegularNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error)
- func (r *RegularNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error)
- type TorProxyNet
- func (t *TorProxyNet) Dial(network, address string) (net.Conn, error)
- func (t *TorProxyNet) LookupHost(host string) ([]string, error)
- func (t *TorProxyNet) LookupSRV(service, proto, name string) (string, []*net.SRV, error)
- func (t *TorProxyNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TorDial ¶
TorDial returns a connection to a remote peer via Tor's socks proxy. Only TCP is supported over Tor. The final argument determines if we should force stream isolation for this new connection. If we do, then this means this new connection will use a fresh circuit, rather than possibly re-using an existing circuit.
func TorLookupHost ¶
TorLookupHost performs DNS resolution on a given hostname via Tor's native resolver. Only IPv4 addresses are returned.
func TorLookupSRV ¶
TorLookupSRV uses Tor's socks proxy to route DNS SRV queries. Tor does not natively support SRV queries so we must route all SRV queries THROUGH the Tor proxy and connect directly to a DNS server and query it. NOTE: TorLookupSRV uses golang's proxy package since go-socks will cause the SRV request to hang.
Types ¶
type Net ¶
type Net interface { // Dial accepts a network and address and returns a connection to a remote // peer. Dial(string, string) (net.Conn, error) // LookupHost performs DNS resolution on a given hostname and returns // addresses of that hostname LookupHost(string) ([]string, error) // LookupSRV allows a service and network to be specified and makes queries // to a given DNS server for SRV queries. LookupSRV(string, string, string) (string, []*net.SRV, error) // ResolveTCPAddr is a used to resolve publicly advertised TCP addresses. ResolveTCPAddr(string, string) (*net.TCPAddr, error) }
Net is an interface housing a Dial function and several DNS functions, to abstract the implementation of these functions over both Regular and Tor
type RegularNet ¶
type RegularNet struct{}
RegularNet is an implementation of the Net interface that defines behaviour for Regular network connections
func (*RegularNet) Dial ¶
func (r *RegularNet) Dial(network, address string) (net.Conn, error)
Dial on the regular network uses net.Dial
func (*RegularNet) LookupHost ¶
func (r *RegularNet) LookupHost(host string) ([]string, error)
LookupHost for regular network uses the net.LookupHost function
func (*RegularNet) ResolveTCPAddr ¶
func (r *RegularNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error)
ResolveTCPAddr for regular network uses net.ResolveTCPAddr function
type TorProxyNet ¶
type TorProxyNet struct { // TorDNS is the IP:PORT of the DNS server for Tor to use for SRV queries TorDNS string // TorSocks is the port which Tor's exposed SOCKS5 proxy is listening on. // This is used for an outbound-only mode, so the node will not listen for // incoming connections TorSocks string // StreamIsolation is a bool that determines if we should force the // creation of a new circuit for this connection. If true, then this // means that our traffic may be harder to correlate as each connection // will now use a distinct circuit. StreamIsolation bool }
TorProxyNet is an implementation of the Net interface that defines behaviour for Tor network connections
func (*TorProxyNet) Dial ¶
func (t *TorProxyNet) Dial(network, address string) (net.Conn, error)
Dial on the Tor network uses the torsvc TorDial() function, and requires that network specified be tcp because only that is supported
func (*TorProxyNet) LookupHost ¶
func (t *TorProxyNet) LookupHost(host string) ([]string, error)
LookupHost on Tor network uses the torsvc TorLookupHost function.
func (*TorProxyNet) ResolveTCPAddr ¶
func (t *TorProxyNet) ResolveTCPAddr(network, address string) (*net.TCPAddr, error)
ResolveTCPAddr on Tor network uses the towsvc TorResolveTCP function, and requires network to be "tcp" because only "tcp" is supported