umgefahren / libp2p-tor

Tor transport for libp2p
MIT License
22 stars 3 forks source link

Do not attempt to dial loopback address #23

Open binarybaron opened 2 days ago

binarybaron commented 2 days ago

We shouldn't even attempt to dial a loopback address (e.g 127.0.0.1) because this cannot be successfull. We should do something along the line of:

https://github.com/UnstoppableSwap/core/blob/d0108fd857c559ea7b2667c05598a55e45cb63a4/swap/src/network/tor_transport.rs#L159-L166

umgefahren commented 2 days ago

I agree but this problem is more complicated than it seems. For just the loopback address it's true but this should then also be implemented for local addresses and that's pretty hard to determine. However, if you are interested, I made a PR to rust to detect those special cases for IPv6 too: rust-lang/rust#129238 I would suggest waiting until that is merged before we go forward.