如何用Ruby的Faraday指定网络接口? [英] How to specify network interface with Ruby's Faraday?
问题描述
我正在使用法拉第,它包装了各种适配器,包括Net :: HTTP,Excon,Typhoeus,赞助人和EventMachine.我想指定网络接口(例如en0
或en1
),但是我不确定如何或是否可行.我愿意接受Ruby级别或Linux级别的答案.
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.
这篇关于如何用Ruby的Faraday指定网络接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!