如何在 Ruby 中使用 event_machine 在发出请求时绑定到 IP?
我有一个可以访问一些 Web API 的应用程序,但它们通过 IP 限制我。如何使用 EM 绑定到我的专用服务器上分配给我的另一个 IP?
我真的希望它像这样简单:
http = EM::HttpRequest.new(address).send(method, :query => params, :head => head, :timeout => 13, :redirects => 3, :ip_to_bind_to => '192.168.1.22')
I have an app that accesses some web APIs, but they limit me by IP. How can I use EM to bind to another IP that is assigned to me on my dedicated server?
I really hope its as easy as:
http = EM::HttpRequest.new(address).send(method, :query => params, :head => head, :timeout => 13, :redirects => 3, :ip_to_bind_to => '192.168.1.22')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑最好的方法是在操作系统上配置静态路由,通过所需的 IP 地址将请求路由到 Web API。
你的系统的路由是什么?
默认的gw在哪里?
i suspect the best way to do this is to configure a static route on your operating system to route the request to the web API thru the desired ip address.
what are to routes of your system?
where is the default gw?