Module: HideMyAss
- Extended by:
- Logger
- Defined in:
- lib/hidemyass.rb,
lib/hidemyass/ip.rb,
lib/hidemyass/http.rb,
lib/hidemyass/logger.rb,
lib/hidemyass/railtie.rb,
lib/hidemyass/version.rb
Defined Under Namespace
Modules: HTTP, Logger
Classes: IP, Railtie
Constant Summary
collapse
- SITE =
"http://hidemyass.com".freeze
- ENDPOINT =
"http://hidemyass.com/proxy-list/search-291666".freeze
- LOG_PREFIX =
'** [hidemyass] '
- HTTP_ERRORS =
[Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError]
- VERSION =
"0.1.1"
Class Method Summary
collapse
Methods included from Logger
log, logger, logger=, logging?
Class Method Details
.clear_cache ⇒ Object
49
50
51
|
# File 'lib/hidemyass.rb', line 49
def self.clear_cache
@proxies = nil
end
|
.options ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/hidemyass.rb', line 27
def self.options
@options ||= {
:log => true,
:local => false,
:clear_cache => false
}
end
|
.proxies ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/hidemyass.rb', line 35
def self.proxies
clear_cache if options[:clear_cache]
html = Nokogiri::HTML(open(URI.parse(ENDPOINT))) unless @proxies
@proxies ||= html.xpath('//table[@id="listtable"]/tr').collect do |node|
ip = HideMyAss::IP.new(node.at_xpath('td[2]/span'))
next unless ip.valid?
{
host: ip.address,
port: node.at_xpath('td[3]').content.strip
}
end
end
|