class Proxtopus::Proxy

Attributes

anonymity[RW]
country[RW]
host[RW]
port[RW]
protocol[RW]

Public Class Methods

new(host, port, protocol, country, anonymity) click to toggle source
# File lib/proxtopus/proxy.rb, line 6
def initialize(host, port, protocol, country, anonymity)
  @host = host.to_s.downcase
  @port = port.to_i
  @protocol = protocol.to_s.downcase
  @country = country.to_s
  if anonymity =~ /h(igh(ly)?)?\s*a(non(ymous)?)?\s*(p(roxy)?)?/ix
    @anonymity = 'HAP'
  elsif anonymity =~ /a(non(ymous)?)?\s*(p(roxy)?)?/ix
    @anonymity = 'AP'
  elsif anonymity =~ /t(rans(parent)?)?\s*(p(roxy)?)?/ix
    @anonymity = 'TP'
  else
    puts "Invalid anonymity '#{anonymity}'... ignoring."
    @anonymity = nil
  end
  
  #puts "[Initialized Proxy]"
  #puts "#{@procotol}://#{@host}:#{@port} w/ #{@anonymity},#{@country}"
  #puts
  #puts
end

Public Instance Methods

==(other) click to toggle source
# File lib/proxtopus/proxy.rb, line 28
def ==(other)
  if other.is_a?(Proxtopus::Proxy)
    if @host == other.host && @port == other.port && @protocol == other.protocol
      true
    else
      false
    end
  else
    false
  end
end