ruby-proxifier/lib/uri/socks.rb

33 lines
632 B
Ruby
Raw Permalink Normal View History

2024-02-24 04:15:11 +00:00
require 'uri/generic'
2011-06-09 15:28:05 +00:00
module URI
2024-02-24 04:15:11 +00:00
class Socks < Generic
2011-06-09 15:28:05 +00:00
DEFAULT_PORT = 1080
COMPONENT = [:scheme, :userinfo, :host, :port, :query].freeze
2024-02-24 04:15:11 +00:00
def self.build(args)
tmp = Util.make_components_hash(self, args)
super(tmp)
end
end
class Socks4 < Socks
2011-06-09 15:28:05 +00:00
end
2024-02-24 04:15:11 +00:00
class Socks4A < Socks
2011-06-09 15:28:05 +00:00
end
2024-02-24 04:15:11 +00:00
mapping = {
'SOCKS' => Socks,
'SOCKS5' => Socks,
'SOCKS4' => Socks4,
'SOCKS4A' => Socks4A
}
if URI::VERSION_CODE >= "001100"
mapping.each { |scheme, class_name| register_scheme scheme, class_name }
else
mapping.each { |scheme, class_name| @@schemes[scheme] = class_name }
2011-06-09 15:28:05 +00:00
end
end
2024-02-24 04:15:11 +00:00