Leser: 26
1
2
3
4
5
6
7
route add default dev eth0
...
route del default
...
route add default dev eth0.1
...
route del default
1 2 3 4 5 6 7 8
my $nextIpIndex = 0; my @ips = ('xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx'); sub callBeforeRequest { @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( LocalAddr => @ips[$nextIpIndex] ); if( (++$nextIpIndex) >= @ips ) { $nextIpIndex = 0; } }
1 2 3 4 5 6 7
my @ips = ('xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx', 'xxx.xx.xx.xx'); sub callBeforeRequest { @LWP::Protocol::http::EXTRA_SOCK_OPTS = ( LocalAddr => $ips[0] ); push(@ips,shift(@ips)); }
@list=@ips[0..3]
$element=$ips[0]