strophe / libstrophe

A simple, lightweight C library for writing XMPP clients
http://strophe.im/libstrophe
Other
401 stars 163 forks source link

specify the network interface from which the xmpp traffic will be sent #220

Closed Anisel closed 1 year ago

Anisel commented 1 year ago

Specify the network interface from which the xmpp traffic will be sent

Expected Behavior

when using the libstrophe function to set up a connection like following / create a connection / conn = xmpp_conn_new(ctx); is it possible to specify from which network interface the xmpp traffic will be sent through

sjaeckel commented 1 year ago

There's a SO_BINDTODEVICE option that can be set via the setsockopt() API.

You should be able to do this by creating your own xmpp_sockopt_callback that calls setsockopt() with the correct arguments

https://github.com/strophe/libstrophe/blob/37555868f656cbe5aa513ed8008028e8dffe26c2/strophe.h#L321-L351 https://github.com/strophe/libstrophe/blob/37555868f656cbe5aa513ed8008028e8dffe26c2/strophe.h#L386-L387