Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proxifier-fork

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxifier-fork

  • 1.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

ruby-proxifier

Fork status

This is a fork of https://github.com/samuelkadolph/ruby-proxifier

Changes in the fork:

  • v1.1.0: Fix schemes to work with Ruby >= 3.1. Remove use of autoload.

  • v1.0.4: Allow customizing HTTP User-Agent header sent when connecting to proxy.

Installing

gem install proxifier-fork

Edge

git clone https://github.com/ab/ruby-proxifier
cd ruby-proxifier && rake install

Rationale

This gem was created for 2 purposes.

First is to enable ruby programmers to use HTTP or SOCKS proxies interchangeably when using TCPSockets. Either manually with Proxifier::Proxy#open or by require "proxifier/env".

The second purpose is to use ruby code that doesn't use proxies for users that have to use proxies.
The pruby and pirb executables are simple wrappers for their respective ruby executables that support proxies from environment variables.

Usage

Executable Wrappers & Environment Variables

proxifier provides two executables: pruby and pirb. They are simple wrappers for your current ruby and irb executables that requires the "proxifier/env" script which installs hooks into TCPSocket which will use the proxy environment variables to proxy any TCPSocket.

The environment variables that proxifier will check are (in order of descending precedence):

Variable NameAlternativesNotes
proxyPROXYRequires the proxy scheme to be present.
socks_proxySOCKS_PROXY
socks5_proxy
SOCKS5_PROXY
Implies the SOCKS5 proxy scheme.
socks4a_proxySOCKS4A_PROXYImplies the SOCKS4A proxy scheme.
socks4_proxyPROXYImplies the SOCKS4 proxy scheme.
http_proxyHTTP_PROXYImplies the HTTP proxy scheme.

Ruby

require "proxifier"

proxy = Proxifier::Proxy("socks://localhost")
socket = proxy.open("www.google.com", 80)
socket << "GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n"
socket.gets # => "HTTP/1.1 200 OK\r\n"

Supported Proxies

ProtocolFormatsNotes
HTTP
http://[username[:password]@]host[:port][?tunnel=false]
The port defaults to 80. This is currently a limitation that may be solved in the future.
Appending ?tunnel=false forces the proxy to not use CONNECT.
SOCKS5
socks://[username[:password]@]host[:port]
socks5://[username[:password]@]host[:port]
Port defaults to 1080.
SOCKS4A
socks4a://[username@]host[:port]
Not yet implemented.
SOCKS4
socks4://[username@]host[:port]
Currently hangs. Not sure if the problem is with code or server.

FAQs

Package last updated on 01 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc