Covertness/coap-rs

Add bind address to CoAPClient::new()

robbym opened this issue · 2 comments

So by default CoAPClient::new() binds to 0.0.0.0:0 for Ipv4 and :::0 for Ipv6.
I have the need to use Ipv6's scope_id when binding, so I can specify which interface I want the packet to go out on. SocketAddrV6::new() lets me specify the scope_id I want to use, but the current CoAPClient assumes I want :::0. Allowing the user to pass in another ToSocketAddrs for the bind address would alleviate this issue.

I have forked the repo and made the change so I can continue working, but it'd be cool if the main repo had support for it. Change is here: robbym@4fa038d

To prevent API breakage, maybe a different function that takes both the bind address and destination address?

Thank you for your advice. I will add another construct function new_with_specific_source.

code updated: 499c01a.