A summary of data about the Ruby ecosystem.

https://github.com/astro/socksify-ruby

Redirect any TCP connection initiated by a Ruby script through a SOCKS5 proxy
https://github.com/astro/socksify-ruby

Keywords

ruby rubygem socks socks5

Keywords from Contributors

activerecord ruby-gem feature-flag

Last synced: about 22 hours ago
JSON representation

Repository metadata

Redirect any TCP connection initiated by a Ruby script through a SOCKS5 proxy

README.md

Gem Version
Actions Status

SOCKSify Ruby

What is it?

SOCKSify Ruby redirects any TCP connection initiated by a Ruby script through a SOCKS5 proxy. It serves as a small drop-in alternative to tsocks, except that it handles Ruby programs only and doesn't leak DNS queries.

How does it work?

require 'socksify/http'

This adds a new class method Net::HTTP.socks_proxy which takes the host and port address of a socks proxy. Once set, all requests will be routed via socks. This is acheived by patching a private method in Net::HTTP, as sadly Ruby no longer has native socks proxy support out of the box.

Additionally, Socksify.resolve can be used to resolve hostnames to IPv4 addresses via SOCKS.

Installation

$ gem install socksify

Usage

Redirect all TCP connections of a Ruby program

Run a Ruby script with redirected TCP through a local Tor anonymizer:

$ socksify_ruby localhost 9050 script.rb

Explicit SOCKS usage in a Ruby program (Deprecated in Ruby 3.1 onwards)

Set up SOCKS connections for a local Tor anonymizer, TCPSockets can be used as usual:

require 'socksify'

TCPSocket.socks_server = "127.0.0.1"
TCPSocket.socks_port = 9050
rubyforge_www = TCPSocket.new("rubyforge.org", 80)
# => #<TCPSocket:0x...>

Use Net::HTTP explicitly via SOCKS

Require the additional library socksify/http and use the Net::HTTP.socks_proxy method. It is similar to Net::HTTP.Proxy from the Ruby standard library:

require 'socksify/http'

uri = URI.parse('http://ipecho.net/plain')
Net::HTTP.socks_proxy('127.0.0.1', 9050).start(uri.host, uri.port) do |http|
  req = Net::HTTP::Get.new uri
  resp = http.request(req)
  puts resp.inspect
  puts resp.body
end
# => #<Net::HTTPOK 200 OK readbody=true>
# => <A tor exit node ip address>

Note that Net::HTTP.socks_proxy never relies on TCPSocket.socks_server/socks_port. You should either set socks_proxy arguments explicitly or use Net::HTTP directly.

Authentication

require 'socksify/http'

uri = URI.parse('http://ipecho.net/plain')
Net::HTTP.socks_proxy('127.0.0.1', 1080, username: 'my_username', password: 'my_pwd').start(uri.host, uri.port) do |http|
  req = Net::HTTP::Get.new uri
  resp = http.request(req)
  puts resp.inspect
  puts resp.body
end

Resolve addresses via SOCKS

Socksify.resolve("spaceboyz.net")
# => "87.106.131.203"

Testing and Debugging

A tor proxy and socks5 proxy with auth is required before running the tests.

  • Install tor from your usual package manager, check it is running with pidof tor
  • Start a SOCKS5 proxy using Docker docker run -d --name socks5 -p 1080:1080 -e PROXY_USER=user -e PROXY_PASSWORD=password serjs/go-socks5-proxy

Then run the tests with:
bundle exec rake

Colorful diagnostic messages are enabled by default via:

Socksify::debug = true`

Development

The repository can be checked out with:

$ git-clone git@github.com:astro/socksify-ruby.git

Send patches via pull requests.

Further ideas

  • Resolv replacement code, so that programs which resolve by themselves don't leak DNS queries
  • IPv6 address support
  • UDP as soon as Tor supports it
  • Perhaps using standard exceptions for better compatibility when acting as a drop-in?

Author

License

SOCKSify Ruby is distributed under the terms of the GNU General Public License version 3 (see file COPYING) or the Ruby License (see file LICENSE) at your option.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 110
Total Committers: 19
Avg Commits per committer: 5.789
Development Distribution Score (DDS): 0.6

Commits in past year: 9
Committers in past year: 4
Avg Commits per committer in past year: 2.25
Development Distribution Score (DDS) in past year: 0.667

Name Email Commits
Astro a****o@s****t 44
Musy Bite m****e@g****m 20
MatzFan b****n@g****m 16
MatzFan m****n@m****m 7
Andrey Kouznetsov s****k@g****m 3
David Dollar d****r@g****m 3
liz johnson l****8@g****m 3
Anton Smagin s****n@g****m 2
Yuichi Tateno h****h@g****m 2
Andrew Nesbitt a****z@g****m 1
Bachue Zhou b****u@g****m 1
Bobby Lawrence d****7@g****m 1
Christopher Thorpe c****t@e****u 1
Florin Asavoaie f****e@g****m 1
Michael Xavier m****l@m****t 1
Naoyoshi Aikawa n****1@g****m 1
Erik Gustavson e****k@b****m 1
Yilin Chen s****f@g****m 1
codener d****r@m****e 1

Committer domains:


Issue and Pull Request metadata

Last synced: 6 months ago

Total issues: 23
Total pull requests: 45
Average time to close issues: almost 2 years
Average time to close pull requests: 9 months
Total issue authors: 23
Total pull request authors: 23
Average comments per issue: 3.3
Average comments per pull request: 1.47
Merged pull request: 30
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 10
Past year average time to close issues: 1 day
Past year average time to close pull requests: about 12 hours
Past year issue authors: 1
Past year pull request authors: 4
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.4
Past year merged pull request: 6
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/astro/socksify-ruby

Top Issue Authors

  • dlahn (1)
  • ecnalyr (1)
  • pirj (1)
  • joeldrapper (1)
  • fokx (1)
  • rusch (1)
  • patrickhno (1)
  • joshweir (1)
  • ruehsn (1)
  • MatzFan (1)
  • cozmogeek (1)
  • peck (1)
  • karis10 (1)
  • da2x (1)
  • erwin (1)

Top Pull Request Authors

  • MatzFan (11)
  • musybite (4)
  • ddollar (3)
  • onsails (3)
  • anton-smagin (3)
  • lizzypy (2)
  • ojab (2)
  • andrew (2)
  • paccator (2)
  • pavelkvasnikov (1)
  • artamonovdev (1)
  • awakia (1)
  • dblommesteijn (1)
  • goosetav (1)
  • olleolleolle (1)

Top Issue Labels

Top Pull Request Labels


Package metadata

gem.coop: socksify

Redirect all TCPSockets through a SOCKS5 proxy

  • Homepage: https://github.com/astro/socksify-ruby
  • Documentation: http://www.rubydoc.info/gems/socksify/
  • Licenses: Ruby,GPL-3.0-only
  • Latest release: 1.8.1 (published 8 months ago)
  • Last Synced: 2026-03-02T05:31:59.762Z (1 day ago)
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 74,451,703 Total
  • Docker Downloads: 8,226,748
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.374%
    • Downloads: 0.389%
    • Docker downloads count: 1.108%
  • Maintainers (2)
  • Funding:
    • https://github.com/sponsors/astro
rubygems.org: socksify

Redirect all TCPSockets through a SOCKS5 proxy

  • Homepage: https://github.com/astro/socksify-ruby
  • Documentation: http://www.rubydoc.info/gems/socksify/
  • Licenses: Ruby,GPL-3.0-only
  • Latest release: 1.8.1 (published 8 months ago)
  • Last Synced: 2026-03-01T20:02:18.633Z (2 days ago)
  • Versions: 15
  • Dependent Packages: 40
  • Dependent Repositories: 627
  • Downloads: 74,445,605 Total
  • Docker Downloads: 8,226,748
  • Rankings:
    • Downloads: 0.351%
    • Dependent packages count: 0.632%
    • Dependent repos count: 1.412%
    • Docker downloads count: 1.585%
    • Average: 1.897%
    • Forks count: 2.997%
    • Stargazers count: 4.407%
  • Maintainers (2)
  • Funding:
    • https://github.com/sponsors/astro
ubuntu-23.10: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 18 days ago)
  • Last Synced: 2026-02-13T18:33:17.758Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.04: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 25 days ago)
  • Last Synced: 2026-02-06T16:04:30.538Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-23.04: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 21 days ago)
  • Last Synced: 2026-02-11T06:50:17.905Z (21 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.10: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 22 days ago)
  • Last Synced: 2026-02-09T17:22:00.394Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
debian-11: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Documentation: https://packages.debian.org/bullseye/ruby-socksify
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 21 days ago)
  • Last Synced: 2026-02-13T08:24:54.067Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-22.04: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 18 days ago)
  • Last Synced: 2026-02-13T13:26:20.086Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-20.04: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 19 days ago)
  • Last Synced: 2026-02-13T07:23:12.689Z (19 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-13: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Documentation: https://packages.debian.org/trixie/ruby-socksify
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 19 days ago)
  • Last Synced: 2026-02-13T13:20:00.984Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-socksify

  • Homepage: https://github.com/astro/socksify-ruby/
  • Documentation: https://packages.debian.org/bookworm/ruby-socksify
  • Licenses:
  • Latest release: 1.7.1+gh-1 (published 19 days ago)
  • Last Synced: 2026-02-12T23:42:04.673Z (19 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:

Dependencies

socksify.gemspec rubygems
  • minitest ~> 5.16 development
  • rubocop ~> 1.31 development
  • rubocop-minitest ~> 0.20 development
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • ruby/setup-ruby v1 composite
Gemfile rubygems
  • minitest ~> 5.16 development
  • rake ~> 13.2 development
  • rubocop ~> 1.31 development
  • rubocop-minitest ~> 0.20 development
  • rubocop-performance ~> 1.21 development
  • rubocop-rake ~> 0.6 development
Gemfile.lock rubygems
  • ast 2.4.2
  • bundler 2.5.17
  • json 2.7.2
  • language_server-protocol 3.17.0.3
  • minitest 5.24.1
  • parallel 1.26.1
  • parser 3.3.4.2
  • racc 1.8.1
  • rainbow 3.1.1
  • rake 13.2.1
  • regexp_parser 2.9.2
  • rexml 3.3.4
  • rubocop 1.65.1
  • rubocop-ast 1.32.0
  • rubocop-minitest 0.35.1
  • rubocop-performance 1.21.1
  • rubocop-rake 0.6.0
  • ruby-progressbar 1.13.0
  • strscan 3.1.0
  • unicode-display_width 2.5.0

Score: 27.044172823091415