Net::Proxy::Connector::tcp_balance - A Net::Proxy connector for outbound tcp balancing and failover
version 0.006
# sample proxy using Net::Proxy::Connector::tcp_balance use Net::Proxy; use Net::Proxy::Connector::tcp_balance; # optional # proxy connections from localhost:6789 to remotehost:9876 # using standard TCP connections my $proxy = Net::Proxy->new( { in => { type => 'tcp', port => '6789' }, out => { type => 'tcp_balance', hosts => [ 'remotehost1', 'remotehost2' ], port => '9876', verbose => 1 }, } ); $proxy->register(); Net::Proxy->mainloop();
Net::Proxy::Connector::tcp_balance is an outbound tcp connector for Net::Proxy that provides randomized load balancing and also provides failover when outbound tcp hosts are unavailable.
Net::Proxy::Connector::tcp_balance
Net::Proxy
It will randomly connect to one of the specified hosts. If that host is unavailable, it will continue to try the other hosts until it makes a connection.
The capabilities of the Net::Proxy::Connector::tcp_balance are otherwise identical to those Net::Proxy::Connector::tcp
Net::Proxy::Connector::tcp
Net::Proxy::Connector::tcp_balance - connector for outbound tcp balancing and failover
The connector accept the following options:
in
host
The listening address. If not given, the default is localhost.
localhost
port
The listening port.
out
hosts
The remote hosts. An array ref.
The remote port.
sort
(Optional) Connect to the hosts in sort algorithm. Possible values: order, none, random. Default is random.
timeout
The socket timeout for connection (out only).
verbose
(Optional) Will print to STDERR the list of sorted hosts for every request.
Jesse Thompson <zjt@cpan.org>
This software is copyright (c) 2019 by Jesse Thompson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Proxy::Connector::tcp_balance, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Proxy::Connector::tcp_balance
CPAN shell
perl -MCPAN -e shell install Net::Proxy::Connector::tcp_balance
For more information on module installation, please visit the detailed CPAN module installation guide.