Hello, every one
I want to send request through specific network interface using HTTP.jl like it works in here . In lib python requests it works correct. Or if to use curl, request should look like this:
curl --interface <ip/name_of_interface> <host>
But in HTTP.jl I didnt find this feature. if I send request, my server is receiving request from tun0 interface.
Does anyone know how this can be realize using the HTTP package. How to select the desired interface from the HTTP package
I don’t know about HTTP.jl, but you can do this in the lower level LibCURL.jl wrapper as
using LibCURL
# init a curl handle
curl = curl_easy_init()
curl_easy_setopt(curl, CURLOPT_URL, "https://docs.julialang.org")
curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
ret = curl_easy_perform(curl)
Not sure if this is useful to your task.
(Ref: CURLOPT_INTERFACE)
After reviewing HTTP.jl’s source code, I don’t think it supports binding to a different local interface. The good news is that it doesn’t seem to be too difficult to modify the code to accept another IP address via the kw
keyword argument. Perhaps you can quick hack together something if that’s really needed