Open arriven opened 2 years ago
I think I've implemented it in https://github.com/Arriven/db1000n/commit/9fbca3f1cc29d8a1e67655886f0ed57b6f9a1240 but it needs some additional testing
@deputinizer you were the one who initially requested the feature, can you check if this implementation has any issues compared to BindToDevice?
Yeah, I'm not looking to implementing that on windows, just wanted to ensure that it works properly on unix without BindToDevice
--interface option uses syscall.BindToDevice which is only available for linux. It should be possible to use net.InterfaceByName inside conn.Control to get an addr that could then be transformed into sockaddr for regular syscall.Bind which is available for all unix systems. Doing it in the control function should be enough to not have troubles when network changes at runtime