lightning icon indicating copy to clipboard operation
lightning copied to clipboard

IP auto detection function fine tuning

Open devastgh opened this issue 1 year ago • 0 comments

I've been using the IP address autodetection for quite some time on my node. It's basic functionality works as expected. However i have some proposals, to make it more robust: When my node is running, and my network address changes, my node will be the one making the outgoing connections from my new IP (unless a TOR address is announced!), therefore autodetection works as expected, and it quickly picks up my ip. However, when i simply restart my node, the following happens: Since my address remains the same, almost 99% of the connections will be incoming, and basically autodetection will fail to get a new address and lightningd will only announce my ipv6 address that he can pick up as its a local routable interface address. To fix this, i have to force disconnect and reconnect to a number of clearnet cln peers, so i can get my ip address from them.

To solve this, i propose the following:

  • CLN should store in-db the last announced ipv4/6 address
  • After node start, if a number of incoming connections (2 or 3 or 4 or 10% debatable) happen in selected interface type ipv4/ipv6, then CLN can safely assume that the last known announced ip address for the selected interface type is correct, and it should announce that.

This does not deal with:

  • If you're hybrid, and have a TOR address announced, most of your hybrid peers will be able to connect to you over TOR and reducing the chance that you can make an outgoing connection on clearnet to them to get your IP. My solution to this is to have TOR connectivity, but don't announce it.

devastgh avatar Aug 16 '22 11:08 devastgh