Net::P...nnector(3pm)

πŸ“¦
version 0.13 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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 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