class Spidy::Connector::TorConnector
tor proxy
Attributes
connector[R]
socks_proxy[R]
Public Class Methods
new(connector, socks_proxy)
click to toggle source
# File lib/spidy/connector.rb, line 100 def initialize(connector, socks_proxy) @connector = connector @socks_proxy = socks_proxy end
Public Instance Methods
call(url, &block)
click to toggle source
# File lib/spidy/connector.rb, line 105 def call(url, &block) Socksify::proxy(socks_proxy[:host], socks_proxy[:port]) do connector.call(url, &block) end end
try_connection!()
click to toggle source
# File lib/spidy/connector.rb, line 118 def try_connection! Tor::Controller.new(host: @socks_proxy[:host], port: @socks_proxy[:port]).close end
try_connection?()
click to toggle source
# File lib/spidy/connector.rb, line 111 def try_connection? try_connection! true rescue Errno::ECONNREFUSED false end