Jack Applegame
Jack Applegame

Reputation: 198

How to bind a request to a specific network interface with Rust Hyper HTTP client?

I have a Linux server with multiple network interfaces. Each interface has its own IP address. How to force HTTP requests to use a specific interface by specifying its IP address? Just like curl --interface command line option.

Upvotes: 4

Views: 1975

Answers (1)

spease
spease

Reputation: 766

You'd need to build your own HttpConnector probably starting from the vanilla connector, perhaps using net2::TcpBuilder.

This is definitely something that seems like it should be easier, perhaps specified in the config. You might want to open an issue for hyper or submit a pull request if you implement it yourself.

Upvotes: 2

Related Questions