-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to specify localAdress? #51
Comments
You can do this per-context using the So, if you want this globally for your app, before doing any fetch call, set it up using e.g.: const { setup, fetch } = require( "fetch-h2" );
setup( { session: { localAddress: "1.2.3.4" } } );
fetch( ... ); // Bound to 1.2.3.4 or you create a new context where fetch requests are explicitly bound to the address: const { context, fetch } = require( "fetch-h2" );
const { fetch: fetch1234 } = context( { session: { localAddress: "1.2.3.4" } } );
fetch( ... ); // Unspecified interface
fetch1234( ... ); // Bound to 1.2.3.4 I haven't tested this exact usage, please let me know if it works for you. I'll leave this open. |
OK thanks! I will report the results |
Does not work in both cases. Per context or via setup. Ignores and uses the route with the lowest metric. Tested on win64/node 12.2.0, lan, wlan and usb modem interfaces. Simple code with requests to server responding with external IP. I don't see localAddress option mentioned in node http2.connect options, only in http.request options. |
I think it might work over https, but these properties aren't forwarded for plain http now that I look at it. I'll fix this as soon as I'm done with a bigger issue - #39 |
Did you fix this issue @grantila ? |
It would be great if you could specify the network interface in the options of each instance. Similar to Node localAddress. But maybe I did not notice and there is a way to do this?
The text was updated successfully, but these errors were encountered: