Created
October 7, 2012 02:33
-
-
Save leedo/3846894 to your computer and use it in GitHub Desktop.
randomize IP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Alice/Role/IRCEvents.pm b/lib/Alice/Role/IRCEvents.pm | |
index 2c6e676..9dd0bf9 100644 | |
--- a/lib/Alice/Role/IRCEvents.pm | |
+++ b/lib/Alice/Role/IRCEvents.pm | |
@@ -10,6 +10,13 @@ use Class::Throwable qw/InvalidNetwork DisconnectError ConnectError/; | |
our %EVENTS; | |
+# array of all our IPs | |
+our @IPS; | |
+push @IPS, v208.100.5.108; | |
+push @IPS, v208.100.5.109; | |
+push @IPS, v208.100.5.110; | |
+push @IPS, v208.100.5.111; | |
+ | |
sub build_events { | |
my ($self, $irc) = @_; | |
@@ -524,6 +531,13 @@ sub connect_irc { | |
user => $config->{username}, | |
real => $config->{ircname}, | |
password => $config->{password}, | |
+ timeout => sub { | |
+ my $fh = shift; | |
+ my $ip = POSIX::floor(rand(scalar @IPS)); | |
+ my $sa = Socket::pack_sockaddr_in(0, $IPS[$ip]); | |
+ bind($fh, $sa); | |
+ return undef; | |
+ } | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment