LWP::P...:socks(3pm)

πŸ“¦
version 1.7 Β· 2 versions
  • 1.7 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.7 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ LWP::Protocol::socks ✨

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's all about LWP::Protocol::socks β€” the little module that adds support for the socks protocol and proxy facility πŸ’–


🌸 NAME 🌸

LWP::Protocol::socks β€” it literally just adds support for the socks protocol and the proxy facility. that's the whole job. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

use LWP::Protocol::socks;

that's it. one line. iconic behavior honestly πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like β€” you reach for this package when you wanna use a socks proxy for your connections. that's the vibe.

it provides some essential hooks into the LWP system so it can implement a socks "scheme" β€” think of it as a sibling to http, except it describes your socks connection instead. and it can proxy either http or https connections. both. equal opportunity proxy-ing 🫢

the use case, fr fr? you use LWP::UserAgent's proxy method to register your socks proxy, like this:

$ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');

and then you just… use your $ua object as usual! that's the whole thing. main character energy, zero extra steps ⭐


πŸ’œ EXAMPLES πŸ’œ

here's a whole little script to look at:

#!/usr/local/bin/perl
use strict;
use LWP::UserAgent;

my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
# for socks5, use socks like so:
$ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');
# for socks4, use socks4 like so:
$ua->proxy([qw(http https)] => 'socks4://socks.yahoo.com:1080');
my $response = $ua->get("http://www.freebsd.org");
print $response->code,' ', $response->message,"\n";
my $response = $ua->get("https://www.microsoft.com");
print $response->code,' ', $response->message,"\n";

so quick breakdown bestie:

  • for socks5, you use socks β€” like so: socks://socks.yahoo.com:1080 πŸ”₯
  • for socks4, you use socks4 β€” like so: socks4://socks.yahoo.com:1080 πŸ”₯
  • then you just $ua->get(...) and print the code and the message. slay.

πŸ“ NOTES πŸ“

the author is being so real here: "I don't have much time to contribute to this." 😭

if you'd like to contribute, please fork https://github.com/scr/cpan and send a pull request. that's the whole ask. go be the change you wanna see in the socks world 🧚


πŸ‘‘ AUTHORS πŸ‘‘

  • Sheridan C Rawlins <sheridan.rawlins@yahoo.com>
  • Oleg G <oleg@cpan.org>

okay that's the whole page, you're officially socks-pilled πŸ’– this was perl v5.34.0, dated 2022-06-15, straight from the User Contributed Perl Documentation β€” mwah, go proxy something cute 🌈✨

πŸ“¦ where this page comes from