LWP::P...:socks(3pm)
β¨ 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 thecodeand themessage. 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
- debian bookworm: liblwp-protocol-socks-perl 1.7-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liblwp-protocol-socks-perl 1.7-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liblwp-protocol-socks-perl 1.7-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblwp-protocol-socks-perl 1.7-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblwp-protocol-socks-perl 1.7-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms