Repository is archived
No commit activity in last 3 years
No release in over 3 years
FaradayAdapterSocks supports connection throughing socks proxy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.12
~> 0.10
~> 0.9
~> 1.1
~> 11.2
~> 3.5

Runtime

~> 0.9
~> 1.7
 Project Readme

FaradayAdapterSocks Build Status

Faraday adapter for socks proxy

Installation

Add this line to your application's Gemfile:

gem 'faraday_adapter_socks'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faraday_adapter_socks

Usage

Adapter symbol :net_http_socks should be set to faraday_adapter

Example: faraday connection

require 'faraday_adapter_socks'

options = { proxy: { uri: URI.parse("socks://#{your_socks_server}") } }

conn = Faraday.new(url, options) do |faraday|
  faraday.request :url_encoded
  faraday.adapter :net_http_socks  # please assign ":net_http_socks" adapter
end

response = conn.get do |req|
  req.url request_path
end

Example: get oauth2 client using intridea/oauth2

require 'faraday_adapter_socks'

client_options = { connection_opts: { proxy: { uri: URI.parse("socks://#{your_socks_server}") } }

client = ::OAuth2::Client.new(client_id, client_secret, client_options) do |conn|
  conn.request :url_encoded
  conn.response :json, content_type: /\bjson$/
  conn.adapter :net_http_socks  # please assign ":net_http_socks" adapter
end

Development

Setup

$ git clone https://github.com/goldeneggg/faraday_adapter_socks.git
$ bin/setup

Run tests

$ bundle exec rake spec

Debug using pry

$ bin/console

To release a new version, update the version number in version.rb.

Contributing

Bug reports and pull requests are welcome on GitHub at issues

Author

goldeneggg