Bind/listen on 0.0.0.0 to allow incoming connections #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes bisq-network/bisq#6149
Setups which use an external Tor on a different VM (such as Whonix) have a problem that they never get incoming connections. Bisq looks like it is running ok, but peers attempting to connect get rejected. This means that offers cannot be taken, they are shown the error "Maker is offline".
Bisq can be run in two different modes: Native Tor and External. Native is the default configuration, where Bisq spawns its local copy of the Tor binary. In External mode Bisq connects to Tor service. If Tor service is on a different machine, it cannot connect back to 127.0.0.1 on the workstation.
Solution is to bind/listen on
0.0.0.0
as suggested by @JeremyRand in bisq-network/bisq#6149. It is better to listen on0.0.0.0
for all configurations, rather than having special cases (IMHO).Ref: https://unix.stackexchange.com/questions/419880/connecting-to-ip-0-0-0-0-succeeds-how-why?answertab=scoredesc#tab-top
Diagram showing the problem of binding to 127.0.0.1:
Testing:
Test that Bisq runs ok in Native mode.
Start bisq with the normal command line options. Perform Tests shown below.
Test that Bisq runs ok in External mode.
Setup & run Tor service. Control port should be accessible from the workstation.
Start bisq with the following options included:
--torControlPort=9051 --torControlPassword="notrequired"
Perform Tests shown below.
Tests
While checking this issue, I wrote simple standalone apps DemoTorReceiver / DemoTorSender that send and receive a hello world message using the same libraries that Bisq uses. There's an example run shown in the readme. I found them useful for understanding netlayer, and simplifying / testing the problem.