Skip to content

ClientBuilder::interface could use IP_BOUND_IF on macOS-ish and Solarish systems #2571

Closed
@hawkw

Description

@hawkw

reqwest's ClientBuilder provides an interface method that will configure the client to bind all sockets on a particular interface. Currently, this method is only available on Linux/Android, as it uses the Linux-specific socket option SO_BINDTODEVICE.

On BSD-like systems, including macOS, illumos, etc, similar functionality exists for IP sockets in the form of the IP_BOUND_IF socket option. Per the manual page ip(4p):

IP_BOUND_IF
Limit reception and transmission of packets to this interface. Takes an integer as an argument. The integer is the selected interface index.

It seems like reqwest could probably provide an implementation of the ClientBuilder::interface method on BSD-ish systems using this socket option. I'd be happy to contribute such an implementation if maintainers are open to it.

Metadata

Metadata

Assignees

Labels

E-pr-welcomeThe feature is welcome to be added, instruction should be found in the issue.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions