p2panda / aquadoggo

Node for the p2panda network handling validation, storage, aggregation and replication
GNU Affero General Public License v3.0
69 stars 5 forks source link

Accept domain name and ip addresses for peers #612

Closed sandreae closed 2 months ago

sandreae commented 2 months ago

We want to be able to pass addresses for direct peers and relay peers into aquadoggo as both ip addresses and domain names. This PR implements parsing either addresses in string format to a SocketAddr using ToSocketAddrs and then constructs a Multiaddr in the format libp2p expects.

Addresses for relay and direct peers are now accepted in the following formats:

I was under the impression that libp2p would do this lookup for us under the hood, but even after many attempts I couldn't get it to work, so I switched to this method which is preferable in my opinion anyway.

closes: #610

📋 Checklist

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 92.74%. Comparing base (508a5f4) to head (4ced3a8). Report is 4 commits behind head on main.

:exclamation: Current head 4ced3a8 differs from pull request most recent head 9adc9aa

Please upload reports for the commit 9adc9aa to get more accurate results.

Files Patch % Lines
aquadoggo/src/api/config_file.rs 0.00% 12 Missing :warning:
aquadoggo/src/network/service.rs 0.00% 7 Missing :warning:
aquadoggo/src/network/utils.rs 0.00% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #612 +/- ## ========================================== + Coverage 91.68% 92.74% +1.05% ========================================== Files 110 104 -6 Lines 18839 20191 +1352 ========================================== + Hits 17273 18726 +1453 + Misses 1566 1465 -101 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.