[英]start erlang/elixir on a defined interface ip address
I'm using elixir to make some XMLRPC queries to an host on my machine that accepts only call from 127.0.xy where x and y can be configurable but the ip can not be 127.0.0.1. 我正在使用elixir对我的计算机上的主机进行一些XMLRPC查询,该主机仅接受来自127.0.xy的呼叫,其中x和y是可配置的,但ip不能为127.0.0.1。
Simple curl
requests to this host would fail unless I add the flag --interface 127.0.xy
. 除非我添加标志
--interface 127.0.xy
否则对此主机的简单curl
请求将失败。
How can I start my elixir application with a given interface ip different from 127.0.0.1? 如何使用与127.0.0.1不同的给定接口ip启动我的elixir应用程序?
The library I use to send the request is HTTPoison if this can be helpful. 如果有帮助,我用来发送请求的库是HTTPoison。
You can pass ip
in the connect_options
to hackney
. 您可以在
connect_options
中将ip
传递给hackney
。 hackney
passes connect_options
directly to gen_tcp
, which accepts an ip
: hackney
传递connect_options
直接gen_tcp
,它接受一个ip
:
HTTPoison.get("http://...", [], [hackney: [connect_options: [ip: {127, 0, 0, 1}]]])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.