jhthorsen / mojo-irc

IRC Client for the Mojo IOLoop
14 stars 12 forks source link

Add local_address support #2

Closed ghost closed 10 years ago

jhthorsen commented 10 years ago

I don't like the extra attribute. I'm thinking we should rather start supporting URL, like we do in Mojo::Redis:

$irc->server("irc://irc.perl.org:6667?local_address=1.2.3.4");
jhthorsen commented 10 years ago

Then we need something like this in the actual code:

$url = Mojo::URL->new($self->server);
$self->{stream_id} = $self->ioloop->client(
  address => $url->host,
  port => $url->port || 6667,
  local_address => $url->param('local_address'),
  ...

What I really don't like about this is that i just realized I should have done the same thing for the TLS stuff.

ghost commented 10 years ago

Thank you for the code example ^^ and for the assistance!