Sha256: 7760f6947d1cfbcbcf750fe7d68c28fda15d0465e2f66a24a86810617a16ece0

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

# frozen_string_literal: true

require "uri"
require_relative "uri/socks"

require_relative "proxifier/version"

require_relative "proxifier/proxy"
require_relative "proxifier/proxies/http"
require_relative "proxifier/proxies/socks"
require_relative "proxifier/proxies/socks"
require_relative "proxifier/proxies/socks4"
require_relative "proxifier/proxies/socks4a"

module Proxifier
  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

1 entries across 1 versions & 1 rubygems

Version Path
proxifier-fork-1.1.0 lib/proxifier.rb