#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long;

# $Id: make_tsocks.pl 459 2010-10-01 18:50:47Z ed $
# $URL: svn+ssh://s5h.net/home/ed/services/repos/desktop/home/ed/code/perl/tsocks/make_tsocks.pl $

my %params;

my $result = GetOptions ( 
	"connect=s" => \$params{'connect'},
	"host=s" => \$params{'host'},
	"port=i" => \$params{'port'},
	"proto=i" => \$params{'proto'},
	);

sub usage {
	print "\n\t--connect <host>:<port>\n\tor --host <host> --port <port>\n\tby default socks5 will be used, unless --proto N is defined:\n\t5 = socks5, 4 = socks4\n\n";
}

( $params{'host'}, $params{'port'} ) = $params{'connect'} =~ /^(.*):(.*)$/  if( defined( $params{'connect'} ) );

$params{'proto'} = 5 if( !defined( $params{'proto'} ) );

if( !defined( $params{'host'} ) || !defined( $params{'port'} ) ) {
	usage();
	exit(1);
}

printf "server = ${params{'host'}}\nserver_port = ${params{'port'}}\nserver_type = ${params{'proto'}}\nlocal = ${params{'host'}}/255.255.255.255\n";



