如何用Ruby的Faraday指定网络接口? [英] How to specify network interface with Ruby's Faraday?

查看:92
本文介绍了如何用Ruby的Faraday指定网络接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用法拉第,它包装了各种适配器,包括Net :: HTTP,Excon,Typhoeus,赞助人和EventMachine.我想指定网络接口(例如en0en1),但是我不确定如何或是否可行.我愿意接受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.

推荐答案

我认为甚至可以用法拉第和Typhoeus做到这一点:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆