UniEvent::Socks - Socks support for UniEvent's tcp handles.
UniEvent::Socks makes it possible to connect UniEvent's tcp handle via socks proxy server.
UniEvent::Socks is a stream filter, it doesn't change API of tcp handle. Just use it as you would without socks proxy.
my $tcp = UniEvent::Tcp->new;
UniEvent::Socks::use_socks($tcp, $proxy_host, $proxy_port);
$tcp->connect($host, $port); # connect to destination via proxy
# called when connect to destination via proxy is established
... # use as arbitrary connection
# via object method
Enables socks proxy for tcp handle.
$proxy_host and $proxy_port is the location of socks 5 proxy. Optional login and password can be defined to authorize on socks proxy.
If $socks_resolve is true and host supplied to tcp handle's connect() method is a domain name, then name resolution will be made on socks proxy server's side.
Gets host, port, login and password from an URI and calls the above version of use_socks() with these params and socks_resolve = true.
URI must be a string or an object of class URI::XS. It must have "socks5" scheme ("sock5://user:pass@host:port/").
For convenience, UniEvent::Socks adds use_socks() method to UniEvent::Tcp package. Its synopsis is the same as for functions described above except for the first argument $tcp_handle which should not be passed.
Pronin Oleg <email@example.com>, Crazy Panda LTD
You may distribute this code under the same terms as Perl itself.
To install UniEvent::Socks, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.