From: <jun...@us...> - 2013-02-07 05:49:47
|
Revision: 37 http://tentacled.svn.sourceforge.net/tentacled/?rev=37&view=rev Author: junichi-satoh Date: 2013-02-07 05:49:28 +0000 (Thu, 07 Feb 2013) Log Message: ----------- 2013-02-07 Junichi Satoh <ju...@rw...> * client/bin/tentacle_client: Added IPv6 support and updated version. Modified Paths: -------------- trunk/perl/ChangeLog trunk/perl/client/bin/tentacle_client Modified: trunk/perl/ChangeLog =================================================================== --- trunk/perl/ChangeLog 2013-01-28 07:32:47 UTC (rev 36) +++ trunk/perl/ChangeLog 2013-02-07 05:49:28 UTC (rev 37) @@ -1,3 +1,7 @@ +2013-02-07 Junichi Satoh <ju...@rw...> + + * client/bin/tentacle_client: Added IPv6 support and updated version. + 2013-01-28 Junichi Satoh <ju...@rw...> * server/bin/tentacle_server: Updated version. Modified: trunk/perl/client/bin/tentacle_client =================================================================== --- trunk/perl/client/bin/tentacle_client 2013-01-28 07:32:47 UTC (rev 36) +++ trunk/perl/client/bin/tentacle_client 2013-02-07 05:49:28 UTC (rev 37) @@ -26,7 +26,7 @@ =head1 VERSION -Version 0.3.0 +Version 0.4.0 =head1 USAGE @@ -50,16 +50,26 @@ The client and server (B<TCP port 41121>) are designed to be run from the command line or called from a shell script, and B<no configuration files are needed>. +If IO::Socket::INET6 is installed, the tentacle client supports IPv6. + =cut use strict; use File::Basename; use Getopt::Std; use IO::Select; -use IO::Socket::INET; +use Socket (qw(SOCK_STREAM)); +my $SOCKET_MODULE = + eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6' + : eval { require IO::Socket::INET } ? 'IO::Socket::INET' + : die $@; +if ($SOCKET_MODULE eq 'IO::Socket::INET') { + print_log ("IO::Socket::INET6 is not found. IPv6 is disabled."); +} + # Program version -our $VERSION = '0.3.0'; +our $VERSION = '0.4.0'; # Server address my $t_address = '127.0.0.1'; @@ -164,9 +174,10 @@ # Address if (defined ($opts{'a'})) { $t_address = $opts{'a'}; - if ($t_address !~ /^[a-zA-Z\.][a-zA-Z0-9\.\-]+$/ && ($t_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ + if (($t_address !~ /^[a-zA-Z\.][a-zA-Z0-9\.\-]+$/ && ($t_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ || $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255 - || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) { + || $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) && + ($t_address !~ /^[0-9a-f:]+$/o)) { error ("Address $t_address is not valid."); } @@ -297,7 +308,7 @@ sub start_client { # Connect to server - $t_socket = IO::Socket::INET->new ( + $t_socket = $SOCKET_MODULE->new ( PeerAddr => $t_address, PeerPort => $t_port, Type => SOCK_STREAM @@ -321,7 +332,7 @@ sub start_client_proxy { # Connect to proxy - $t_socket = IO::Socket::INET->new ( + $t_socket = $SOCKET_MODULE->new ( PeerAddr => $t_proxy_address, PeerPort => $t_proxy_port, ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |