I’m using gRPC C/C++ library (v1.62.1) to build a grpc client on Linux (Ubuntu 22.04). On the running machine I have several network interfaces and I need to bind different connection sockets to different interfaces (bind to a give source ip address, port is not important). I need a solution where the client controls interfaces used for different connections so I can’t just configure iptables on the machine.
I see that in some other language implementations (e.g. Java) that functionality is exposed to the gRPC API.
I wonder if there is any way to do that in C/C++?
If it’s not possible to do using public API, are there any hacky solutions that would work particularly in this case?
What I’ve tried:
I’ve looked at the grpc::ChannelArguments::SetMutator method. The problem is that grpc_socket_mutator struct is not exposed in the API and seems to be part of implementation.