I'm using Faraday which wraps various adapters, including Net::HTTP, Excon, Typhoeus, Patron, and EventMachine. I would like to specify the network interface (e.g. en0
or en1
), but I'm not sure how or if it is possible. I'd be open to answers at the Ruby level or the Linux level.
Note: According to Making HTTP requests from different network interfaces with Ruby and Curb, this is possible with Curb.
I think it even is possible to do that with Faraday and Typhoeus: https://github.com/typhoeus/typhoeus/blob/92d19df7af06034ae28996e097676b01301042f5/lib/typhoeus/adapters/faraday.rb#L139.