AnyEvent-Connector

 view release on metacpan or  search on metacpan

lib/AnyEvent/Connector.pm  view on Meta::CPAN


If C<< $conn->proxy_for($host, $port) >> returns a proxy URL, it
behaves in the following way.

=over

=item *

It connects to the proxy, and tells the proxy to connect to the final
destination, C<$host> and C<$port>.

=item *

It runs C<$connect_cb> after the connection to the proxy AND
(hopefully) the connection between the proxy and the final destination
are both established.

    $connect_cb->($cb_fh, $cb_host, $cb_port, $cb_retry)

C<$cb_fh> is the filehandle to the proxy. C<$cb_host> and C<$cb_port>
are the hostname and port of the proxy.

=item *

If the TCP connection to the proxy is established but the connection
to the final destination fails for some reason, C<$connect_cb> is
called with no argument passed (just as the original C<tcp_connect>
does).

=item *

If given, it runs C<$prepare_cb> before it starts connecting to the
proxy.

=back

=head2 $proxy = $conn->proxy_for($host, $port)

If C<$conn> uses a proxy to connect to the given C<$host> and
C<$port>, it returns the string of the proxy URL. Otherwise, it
returns C<undef>.


=head1 SEE ALSO

=over

=item *

L<AnyEvent::Socket>

=item *

L<AnyEvent::HTTP> - it has C<tcp_connect> option to implement proxy
connection. You can use L<AnyEvent::Connector> for it.

=back

=head1 REPOSITORY

L<https://github.com/debug-ito/AnyEvent-Connector>

=head1 BUGS AND FEATURE REQUESTS

Please report bugs and feature requests to my Github issues
L<https://github.com/debug-ito/AnyEvent-Connector/issues>.

Although I prefer Github, non-Github users can use CPAN RT
L<https://rt.cpan.org/Public/Dist/Display.html?Name=AnyEvent-Connector>.
Please send email to C<bug-AnyEvent-Connector at rt.cpan.org> to report bugs
if you do not have CPAN RT account.


=head1 AUTHOR
 
Toshio Ito, C<< <toshioito at cpan.org> >>


=head1 LICENSE AND COPYRIGHT

Copyright 2018 Toshio Ito.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See L<http://dev.perl.org/licenses/> for more information.


=cut



( run in 0.717 second using v1.01-cache-2.11-cpan-39bf76dae61 )