Module: ProxyUtilities
- Defined in:
- lib/proxy_utilities.rb,
lib/proxy_utilities/getter.rb,
lib/proxy_utilities/checker.rb,
lib/proxy_utilities/version.rb
Overview
Give 2 main methods, that are needed to using the game
Defined Under Namespace
Modules: Getter Classes: Checker
Constant Summary collapse
- VERSION =
"1.4.1"
Class Method Summary collapse
-
.check_proxy(ip, port, websites: nil, check_websites: false) ⇒ Object
params ip ipadress of proxy server string port port of proxy server string webistes array of websites to check Array.
-
.check_proxy_list(list, websites: nil, check_websites: false) ⇒ Object
params list form of [=> “0.0.0.0”, :port => 80, .…, .…] check_websites if he has to check google and amazon boolean webistes array of websites to check Array.
-
.get_proxies ⇒ Object
Say hi to the world!.
Class Method Details
.check_proxy(ip, port, websites: nil, check_websites: false) ⇒ Object
params ip ipadress of proxy server string port port of proxy server string webistes array of websites to check Array
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/proxy_utilities.rb', line 29 def self.check_proxy(ip, port, websites: nil, check_websites: false) proxy = ProxyUtilities::Checker.new(ip, port) result = {} if proxy.check_online? result[:status] = true if check_websites result[:websites] = {} if proxy.check_google? result[:websites][:google] = true else result[:websites][:google] = false end if proxy.check_amazon? result[:websites][:amazon] = true else result[:websites][:amazon] = false end if websites.present? result[:websites] = result[:websites].merge(proxy.check_any_website(websites)) end end else result[:status] = false end return result end |
.check_proxy_list(list, websites: nil, check_websites: false) ⇒ Object
params list form of [=> “0.0.0.0”, :port => 80, .…, .…] check_websites if he has to check google and amazon boolean webistes array of websites to check Array
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/proxy_utilities.rb', line 66 def self.check_proxy_list(list, websites: nil, check_websites: false) result = [] threads = [] poolsize = 10 jobs = Queue.new list.each{|p| jobs.push p} poolsize.times do threads << Thread.new do begin while proxy = jobs.pop(true) Thread.exit if proxy.nil? if proxy.key?(:ip) and proxy.key?(:port) begin result << ProxyUtilities.check_proxy(proxy[:ip], proxy[:port], websites: websites, check_websites: check_websites).merge({:ip => proxy[:ip], :port => proxy[:port]}) end end end rescue Thread.exit end end end threads.each(&:join) return result end |
.get_proxies ⇒ Object
Say hi to the world!
Example:
>> ProxyUtilities.get_proxies
=> [{ip: "0.0.0.0", port: 80, country_code: "US", anonymity: elite, type: "HTTPS"}]
Arguments:
proxybroker: (String)
proxybroker_limit (Integer)
proxybroker_type (Array["HTTP", "HTTPS", "SOCKS4", "SOCKS5"])
19 20 21 |
# File 'lib/proxy_utilities.rb', line 19 def self.get_proxies() return ProxyUtilities::Getter.get_all() end |