class HideMyAss::Proxy::Base

Interface for the attributes of each proxy. Such attributes include the ip, port and protocol.

@example Get the proxy's ip address.

proxy.ip
# => '178.22.148.122'

@example Get the proxy's port.

proxy.port
# => 3129

@example Get the proxy's protocol.

proxy.protocol
# => 'HTTPS'

@example Get the hosted country.

proxy.country
# => 'FRANCE'

@example Get the complete url.

proxy.url
# => 'https://178.22.148.122:3129'

Attributes

row[R]

Raw data of the row element.

@return [ Object ]

Public Class Methods

new(row) click to toggle source

Initializes the proxy instance by passing a single row of the fetched result list. All attribute readers are lazy implemented.

@param [ Object ] row Pre-parsed row element.

@return [ HideMyAss::Proxy::Base ]

# File lib/hidemyass/proxy/base.rb, line 33
def initialize(row)
  @row = row
end

Public Instance Methods

anonym?() click to toggle source

If the proxy's anonymity is high or even higher.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 95
def anonym?
  anonymity.start_with? 'high'
end
http?() click to toggle source

If the proxy's network protocol is HTTP.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 67
def http?
  protocol == 'http'
end
https?() click to toggle source

If the proxy's network protocol is HTTPS.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 74
def https?
  protocol == 'https'
end
inspect() click to toggle source

Custom inspect method.

@example

inspect

> '<HideMyAss::Proxy 123.57.52.171:80>'

@return [ String ] :nocov:

# File lib/hidemyass/proxy/base.rb, line 114
def inspect
  "<#{self.class.name} #{url}>"
end
protocol() click to toggle source

The network protocol in in downcase letters. (https or http or socks)

@return [ String ]

# File lib/hidemyass/proxy/base.rb, line 46
def protocol
  type
end
rel_url() click to toggle source

The relative URL without the leading protocol.

@return [ String ]

# File lib/hidemyass/proxy/base.rb, line 53
def rel_url
  "#{ip}:#{port}"
end
secure?() click to toggle source

If the proxy's anonymity is at least high and protocol is encrypted.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 102
def secure?
  anonym? && ssl?
end
socks?() click to toggle source

If the proxy's network protocol is SOCKS.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 81
def socks?
  protocol.start_with? 'socks'
end
ssl?() click to toggle source

If the proxy supports SSL encryption.

@return [ Boolean ]

# File lib/hidemyass/proxy/base.rb, line 88
def ssl?
  https? || socks?
end
url() click to toggle source

The complete URL of that proxy server.

@return [ String ]

# File lib/hidemyass/proxy/base.rb, line 60
def url
  "#{protocol}://#{rel_url}"
end