Net::SOCKS(3pm)

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

πŸ’– Net::SOCKS πŸ’–

okay bestie, so this is Net::SOCKS β€” a SOCKS client class for Perl, and it's living in the User Contributed Perl Documentation corner of your manual pages. she's an old one, she's an icon, she still works. let's get into it 🧚


✨ NAME ✨

Net::SOCKS β€” a SOCKS client class. that's it, that's the whole name. short, sweet, slays πŸ’…


🌸 SYNOPSIS 🌸

establishing a connection πŸ¦‹

my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
               socks_port => 1080,
               user_id => 'the_user',
               user_password => 'the_password',
               force_nonanonymous => 1,
               protocol_version => 5);

# connect to finger port and request finger information for some_user
my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);
print $f "some_user\n";    # example writing to socket
while (<$f>) { print }     # example reading from socket
$sock->close();

accepting an incoming connection πŸ‘‘

my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
               socks_port => 1080,
               user_id => 'the_user',
               user_password => 'the_password',
               force_nonanonymous => 1,
               protocol_version => 5);

my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "128.10.10.11",
                       peer_port => 9999);

$f= $sock->accept();
print $f "Hi!  Type something.\n";    # example writing to socket
while (<$f>) { print }                # example reading from socket
$sock->close();

πŸ’œ DESCRIPTION πŸ’œ

okay so. every single one of these examples starts the exact same way, and it's giving main character energy:

my $sock = new Net::SOCKS(socks_addr => '192.168.1.3',
               socks_port => 1080,
               user_id => 'the_user',
               user_password => 'the_password',
               force_nonanonymous => 1,
               protocol_version => 5);

to connect to a SOCKS server, you tell it the SOCKS server's hostname, the port number, the SOCKS protocol version, a username, and a password. user_id and user_password are optional β€” you only need them if you're using a SOCKS server that doesn't require any authentication. and if you want to force the connection to be nonanonymous, you set the force_nonanonymous parameter. no cap. ✨


my $f= $sock->connect(peer_addr => '192.168.1.3', peer_port => 79);

to connect to another machine using SOCKS, you use the connect method. hand it the host and the port number as parameters. that's the whole vibe. 🫢


my ($ip, $ip_dot_dec, $port) = $sock->bind(peer_addr => "192.168.1.3",
                       peer_port => 9999);

if you wanted to accept a connection with SOCKS, you specify the host and port of the machine you expect a connection from. and upon success, bind() returns the ip address and port number that the SOCKS server is listening at on your behalf. she's working for you. she's your employee. πŸ’…


$f= $sock->accept();

if a call to bind() returns a success status code SOCKS_OKAY, then a call to the accept() method will return when the peer host connects</c> to the host/port that was returned by the bind() method. upon success, accept() returns SOCKS_OKAY. periodt. πŸ”₯


$sock->close();

closes the connection. say bye, bestie πŸ‘‹πŸ’€


πŸ‘€ SEE ALSO πŸ‘€

go read the RFCs, iykyk πŸ“š


🌈 AUTHOR 🌈

Clinton Wong, clintdw@netcom.com β€” the legend herself. thank you for your service πŸ«‘πŸ’–


Copyright (c) 1997-1998 Clinton Wong. All rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so like, go off, respectfully. 🌸


that's the whole page bestie, you ate it, nothing skipped, every flag and every example preserved πŸ’…βœ¨

perl v5.36.0 Β· 2022-11-19 Β· Net::SOCKS(3pm) β€” mwah, xoxo, go write some sockets πŸ’–πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from