Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NodeAddress everywhere instead of InetAddress #2202

Merged
merged 6 commits into from Mar 25, 2022
Merged

Use NodeAddress everywhere instead of InetAddress #2202

merged 6 commits into from Mar 25, 2022

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Mar 8, 2022

This makes us control more strictly when and where name resolution happens, which is important in a security-hardened setup. The InetAddress jdk class indeed does a lot of things behind the scenes, but now we restrict it to tcp-related classes like Client and Server.

Also, in cluster mode all outgoing connections (including tor) are now made on the front.

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change, this will also make it much easier to implement lightning/bolts#911

Also, in cluster mode all outgoing connections (including tor) are now made on the front.

Can you remind me why we previously couldn't resolve tor addresses on the front?

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
@codecov-commenter
Copy link

Codecov Report

Merging #2202 (a81390b) into master (7b5cefa) will increase coverage by 0.02%.
The diff coverage is 70.00%.

@@            Coverage Diff             @@
##           master    #2202      +/-   ##
==========================================
+ Coverage   83.86%   83.89%   +0.02%     
==========================================
  Files         186      186              
  Lines       13940    13952      +12     
  Branches      580      590      +10     
==========================================
+ Hits        11691    11705      +14     
+ Misses       2249     2247       -2     
Impacted Files Coverage Δ
.../main/scala/fr/acinq/eclair/io/ClientSpawner.scala 40.00% <ø> (ø)
...n/scala/fr/acinq/eclair/json/JsonSerializers.scala 91.17% <ø> (ø)
...nt/src/main/scala/fr/acinq/eclair/FrontSetup.scala 0.00% <0.00%> (ø)
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 92.80% <27.27%> (+0.02%) ⬆️
...ore/src/main/scala/fr/acinq/eclair/io/Client.scala 55.76% <66.66%> (-1.68%) ⬇️
...n/scala/fr/acinq/eclair/tor/Socks5Connection.scala 8.66% <80.00%> (ø)
...re/src/main/scala/fr/acinq/eclair/io/NodeURI.scala 83.33% <100.00%> (ø)
...-core/src/main/scala/fr/acinq/eclair/io/Peer.scala 90.41% <100.00%> (ø)
...main/scala/fr/acinq/eclair/io/PeerConnection.scala 85.98% <100.00%> (+0.37%) ⬆️
...in/scala/fr/acinq/eclair/io/ReconnectionTask.scala 98.07% <100.00%> (-0.08%) ⬇️
... and 10 more

There is no reason to use the version of guava targetting android
anymore. Also `HostAndPort` was in beta in our current lib version.

We now use guava's `InetAddresses.toUriString()` to format host string,
instead of manually adding brackets.

Reworked `NodeURI` tests:
- less repetition with one single test and multiple `testCases`
- focus on non-reg (no need to verify what we know we don't support)
@pm47 pm47 requested a review from t-bast March 25, 2022 12:12
@pm47
Copy link
Member Author

pm47 commented Mar 25, 2022

Can you remind me why we previously couldn't resolve tor addresses on the front?

There is no real reason, except that a prerequisite was to move the tor gateway on a separate machine, which happened later.

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pm47 pm47 merged commit 6823309 into master Mar 25, 2022
@pm47 pm47 deleted the node-address branch March 25, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants