Sha256: 0df2a9ac86149c9c5a0578e634a56d9b9ee2f0bd09daa96de1739d26dab2471f

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

# -*- coding: binary -*-

module Rex
  module Socket
    module Proxies
      module ProxyType
        SAPNI = 'sapni'
        HTTP = 'http'
        SOCKS4 = 'socks4'
        SOCKS5 = 'socks5'
      end

      # @param [String,nil] value A proxy chain of format {type:host:port[,type:host:port][...]}
      # @return [Array] The array of proxies, i.e. {[['type', 'host', 'port']]}
      def self.parse(value)
        value.to_s.strip.split(',').map { |a| a.strip }.map { |a| a.split(':').map { |b| b.strip } }
      end

      def self.supported_types
        ProxyType.constants.map { |c| ProxyType.const_get(c) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rex-socket-0.1.59 lib/rex/socket/proxies.rb