It seems unfortunate this has to be a repeated pattern. That said, I don't know what else to do.

It's a little confusing here that node is the client and n is the server's node object. A comment here that says something like "# If the server is in the cloud and our client is in the cloud, we probably want to contact the servers internal address, because we're probably in the same cloud" -- Or something like that. think on it. but there are a few use cases here and it would help if we explained them.

What if my server and client are in the same cloud? Then I want use_local_ipv4 to be true.
What if my server and client are in different clouds? Then I want use_local_ipv4 to be false.
...