POE::C...:Proxy(3pm)

πŸ“¦
version 6.95 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ POE::C...:Proxy(3pm) β€” the manual page, but make it make sense ✨

okay bestie, pull up a chair, we're reading the POE::Component::IRC::Plugin::Proxy page from the User Contributed Perl Documentation and honestly? it's a banger. it's a PoCo-IRC plugin that hands you a lightweight IRC proxy/bouncer. yes, a bouncer. we're building infrastructure today. πŸ’…


🌸 NAME 🌸

POE::Component::IRC::Plugin::Proxy β€” a PoCo-IRC plugin that provides a lightweight IRC proxy/bouncer. it's giving "one connection to rule them all" and I'm obsessed. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

look at this. look at how clean. copy it exactly, don't freestyle:

use strict;
use warnings;
use POE qw(Component::IRC::State Component::IRC::Plugin::Proxy Component::IRC::Plugin::Connector);

my $irc = POE::Component::IRC::State->spawn();

POE::Session->create(
    package_states => [
        main => [ qw(_start) ],
    ],
    heap => { irc => $irc },
);

$poe_kernel->run();

sub _start {
    my ($kernel, $heap) = @_[KERNEL, HEAP];
    $heap->{irc}->yield( register => 'all' );
    $heap->{proxy} = POE::Component::IRC::Plugin::Proxy->new( bindport => 6969, password => "m00m00" );
    $heap->{irc}->plugin_add( 'Connector' => POE::Component::IRC::Plugin::Connector->new() );
    $heap->{irc}->plugin_add( 'Proxy' => $heap->{proxy} );
    $heap->{irc}->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );
    return;
}

yeah, 6969 and "m00m00" are literally what the author wrote. iconic of him, honestly. 😭


πŸ’– DESCRIPTION πŸ’–

POE::Component::IRC::Plugin::Proxy is a POE::Component::IRC plugin that gives your POE::Component::IRC bots a lightweight IRC proxy/bouncer server. the whole point? it lets multiple IRC clients hide behind a single IRC client-server connection. sneaky. efficient. slay.

so here's the vibe: you spawn a POE::Component::IRC::State session and drop a POE::Component::IRC::Plugin::Proxy plugin object in there, handing it a bindport and a password that any connecting IRC client has to use. then, once the component is connected to an IRC network, the plugin opens up a listening port so all your little IRC clients can pile in. πŸ¦‹

Neat, huh? >;o) β€” and that's a direct quote, I would never steal that energy.

this plugin will activate POE::Component::IRC's raw events (irc_raw) by calling $irc->raw_events(1).
heads up bestie: this plugin requires the IRC component to be POE::Component::IRC::State or a subclass of it. no substitutions. 🚫

πŸ‘‘ METHODS πŸ‘‘

🌟 new

takes a number of arguments:

  • 'password' β€” the password to require from connecting clients. no password, no entry. πŸ’…
  • 'bindaddress' β€” a local address to bind the listener to, default is 'localhost'.
  • 'bindport' β€” what port to bind to, default is 0, ie. randomly allocated by OS. chaotic but valid.

returns an object suitable for passing to POE::Component::IRC's plugin_add method. handoff complete, bestie. 🀝

🌟 getsockname

takes no arguments. it accesses the listener's getsockname method. see POE::Wheel::SocketFactory for details of the return value. iykyk.

🌟 list_wheels

takes no arguments. returns a list of wheel ids of the currently connected clients. it's the guest list. ✨

🌟 wheel_info

takes one parameter β€” a wheel ID to query. returns undef if an invalid wheel id is passed (rude, but fair).

  • in scalar context: returns the time that the client connected in unix time.
  • in list context: returns a list consisting of the peer address, port, the connect time and the lag in seconds for that connection.

yes that's four things in a list. count them. πŸ“


🌈 OUTPUT EVENTS 🌈

the plugin emits the following POE::Component::IRC events:

πŸ’« irc_proxy_up

emitted when the listener is successfully started. ARG0 is the result of the listener getsockname. we're so up.

πŸ’« irc_proxy_connect

emitted when a client connects to the listener. ARG0 is the wheel ID of the client. hi bestie, welcome in. 🫢

πŸ’« irc_proxy_rw_fail

emitted when the POE::Wheel::ReadWrite fails on a connection. ARG0 is the wheel ID of the client. πŸ’€ it happens to the best of us.

πŸ’« irc_proxy_authed

emitted when a connecting client successfully negotiates an IRC session with the plugin. ARG0 is the wheel ID of the client. we love a smooth handshake. 😌

πŸ’« irc_proxy_close

emitted when a connected client disconnects. ARG0 is the wheel ID of the client. bye babe, see you next session. πŸ‘‹

πŸ’« irc_proxy_down

emitted when the listener is successfully shutdown. ARG0 is the result of the listener getsockname. lights off. πŸŒ™


πŸ™ˆ QUIRKS πŸ™ˆ

connecting IRC clients will not be able to change nickname.

this is a feature. not a bug. the author said it, I'm just relaying it, no cap. 🚫🧒

πŸ’œ AUTHOR πŸ’œ

Chris 'BinGOs' Williams. king behaviour, honestly.


πŸ”₯ SEE ALSO πŸ”₯

  • POE::Component::IRC
  • POE::Component::IRC::State

and that's the whole page bestie!! πŸ’– if you need me I'll be over here binding ports and handing out passwords like party favours. this page shipped with perl v5.40.1, dated 2025-08-21, from the User Contributed Perl Documentation β€” and that's on periodt. πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from