-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choosing outgoing IP #14
Comments
Hmm, that's a great question. Assuming your box has multiple IP's assigned to it... I'm not sure if EventMachine has any API's for picking a specific interface to initiate an outgoing connection. @tmm1: any thought on this? Equivalent for curl: http://stackoverflow.com/questions/2425651/select-outgoing-ip-for-curl-request |
Use |
Ah, figures.. Never used that API before. Thanks! @barbolo, so the answer is: yes it is possible, but it would require some patching to support this use case :-) |
Thanks @tmm1 and @igrigorik! I tryed patching the em-proxy gem and believe I got it working. One new problem is that EM.bind_connect (as well as EM.connect) seems not to work correctly with IPv6. The IP addresses attached to my machine are all IPv6. I replaced the following line of lib/em-proxy/connection.rb: srv = EventMachine::connect(opts[:host], opts[:port], EventMachine::ProxyServer::Backend, @debug) do |c| with: ipv6 = Socket.ip_address_list.sample # choose a random ipv6 attached to the machine
srv = EventMachine::bind_connect(ipv6, nil, opts[:host], opts[:port], EventMachine::ProxyServer::Backend, @debug) do |c| |
My machine has a pool of IPs. Is it possible to choose the outgoing IP the proxy will use to make the requests? Would it be possible to randomly use more than one IP?
Thanks
The text was updated successfully, but these errors were encountered: