Sha256: adac26495ee72799f5529ebd53cb1ce8d0f15061ba1d68a1f87fbfaaeb034843

Contents?: true

Size: 669 Bytes

Versions: 6

Compression:

Stored size: 669 Bytes

Contents

require "uri"
require "uri/socks"

module Proxifier
  require "proxifier/version"

  autoload :HTTPProxy, "proxifier/proxies/http"
  autoload :SOCKSProxy, "proxifier/proxies/socks"
  autoload :SOCKS5Proxy, "proxifier/proxies/socks"
  autoload :SOCKS4Proxy, "proxifier/proxies/socks4"
  autoload :SOCKS4AProxy, "proxifier/proxies/socks4a"

  def self.Proxy(url, options = {})
    url = URI.parse(url)

    raise(ArgumentError, "proxy url has no scheme") unless url.scheme
    begin
      klass = const_get("#{url.scheme.upcase}Proxy")
    rescue NameError
      raise(ArgumentError, "unknown proxy scheme `#{url.scheme}'")
    end

    klass.new(url, options)
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
proxifier2-1.1.0 lib/proxifier.rb
proxifier-fork-1.0.4 lib/proxifier.rb
proxifier-1.0.3 lib/proxifier.rb
proxifier-1.0.2 lib/proxifier.rb
proxifier-1.0.1 lib/proxifier.rb
proxifier-1.0.0 lib/proxifier.rb