Net::P...nnector(3pm)
β¨ NAME β¨
Net::Proxy::Connector β the base class for all the Net::Proxy protocols, bestie π it's giving "parent class energy" and honestly? iconic.
πΈ SYNOPSIS πΈ
okay so if you wanna make your own connector, here's the template β this one is for the hypothetical zlonk connector:
#
# template for the zlonk connector
#
package Net::Proxy::Connector::zlonk;
use strict;
use Net::Proxy::Connector;
our @ISA = qw( Net::Proxy::Connector );
# here are the methods you need to write for your connector
# if it can be used as an 'in' connector
sub listen { }
sub accept_from { }
# if it can be used as an 'out' connector
sub connect { }
# to process data
sub read_from { }
sub write_to { }
1;
π¦ DESCRIPTION π¦
So like. Net::Proxy::Connector is the base class for every single specialised protocol that Net::Proxy uses. Every connector out there is basically a glow-up of this one. π
π METHODS π
π Class methods
The base class is serving the following methods, periodt:
newβ the constructor. That's it, that's the vibe. β¨
π Instance methods
set_proxy
$connector->set_proxy( $proxy );
Sets the proxy that "owns" this connector. π
get_proxy
my $proxy = $connector->get_proxy();
Hands you back the Net::Proxy object that "owns" the connector. no cap.
is_in
$connector->is_in();
Returns a boolean β true if this Net::Proxy::Connector object is the "in" connector of its proxy. π
is_out
$connector->is_out();
Returns a boolean β true if this Net::Proxy::Connector object is the "out" connector of its proxy. πΈ
new_connection_on
$connector->new_connection_on( $socket );
Net::Proxy calls this one to deal with incoming connections, and it in turn calls accept_from() on the 'in' connector and connect() on the 'out' connector. she's the middleman fr fr π«
raw_read_from
my $data = $connector->raw_read_from( $socket );
For Net::Proxy::Connector subclasses to use inside their own read_from() methods β it fetches raw data off a socket. π
raw_write_to
$connector->raw_write_to( $socket, $data );
For subclasses to use inside their write_to() methods β it sends raw data on a socket. π
raw_listen
my $sock = $connector->raw_listen();
For subclasses to use inside their listen() methods β it creates a listening socket on their "host" and "port" parameters. π§
raw_accept_from
my $sock = $connector->raw_accept_from( $socket );
For subclasses to use internaly inside their accept_from() methods β it accepts a newly connected socket. π«Ά
π₯ SUBCLASS METHODS π₯
These are the ones you gotta define yourself in your Net::Proxy::Connector subclasses. main character homework, bestie π
π« Initialisation
init
$connector->init;
This method initalizes the connector. (yes queen, get it set up β¨)
π Processing incoming/outgoing data
read_from
my $data = $connector->read_from( $socket );
Returns the data that was possibly decapsulated by the connector. π¦
write_to
$connector->write_to( $socket, $data );
Writes $data to the given $socket, according to the connector scheme. π
π "in" connector
listen
my $sock = $connector->listen();
Kicks off listening sockets and returns them. This method can use the raw_listen() method to do the low-level listen call. πΈ
accept_from
my $sock = $connector->accept_from( $socket );
$socket is a listening socket created by listen(). This method returns the connected socket. It can use the raw_accept_from() method to do the low-level accept call. π
β "out" connector
connect
my $sock = $connector->connect();
Returns a socket connected to the remote server. slay. π₯
π AUTHOR π
Philippe 'BooK' Bruhat, "<book@cpan.org>". π
π COPYRIGHT π
Copyright 2006-2014 Philippe 'BooK' Bruhat, All Rights Reserved.
π LICENSE π
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
and that's the whole page, bestie!! this was Net::P...nnector(3pm) from the User Contributed Perl Documentation, shipped with perl v5.38.2 on 2024-05-15. go forth and write your own connector, i believe in you π
β¨π
π¦ where this page comes from
- debian trixie: libnet-proxy-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-proxy-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-proxy-perl 0.13-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