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

chore: upgrade go-libp2p-kad-dht #10378

Merged
merged 6 commits into from
Apr 4, 2024
Merged

chore: upgrade go-libp2p-kad-dht #10378

merged 6 commits into from
Apr 4, 2024

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Mar 27, 2024

Supersedes and closes #10100.

[..] go-libp2p-kad-dht v0.25.0 introduced a change (libp2p/go-libp2p-kad-dht#839) to prevent private addresses to land on the public Amino DHT, so some tests may need to be modified.

My solution by using an environment variable to disable the address filtering in the DHT is definitely not the best. But something along this lines seems to be necessary for testing since we don't have multiple public IPs available. My other solution would be to add some test flag to Kubo (or config).

@hacdias hacdias added the skip/changelog This change does NOT require a changelog entry label Mar 27, 2024
@hacdias hacdias self-assigned this Mar 27, 2024
@hacdias hacdias marked this pull request as ready for review March 27, 2024 14:09
@hacdias hacdias requested a review from a team as a code owner March 27, 2024 14:09
@hacdias hacdias force-pushed the dht-0.25.2 branch 2 times, most recently from cf992ab to fe340cb Compare March 27, 2024 14:18
Copy link

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

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

Looks good!

IMO it would be great to have options in Kubo for disabling address filtering (loopback and private addresses)

@hacdias
Copy link
Member Author

hacdias commented Mar 27, 2024

@guillaumemichel I can certainly add an option (it would be better than an environment variable). I think it's just important to understand whether or not it would be useful.

The only case I can think of for the LAN DHT is if someone is running multiple Kubo nodes on the same machine.

Disabling the private addresses in the WAN DHT can be useful for private networks maybe. Now that I think of it: if we don't add this option, aren't we literally breaking private IPFS clusters within private networks with no public IPs?

@guillaumemichel
Copy link

Yes, it would essentially be useful for local ipfs clusters I guess (see libp2p/go-libp2p-kad-dht#839 (comment))

@hacdias
Copy link
Member Author

hacdias commented Mar 28, 2024

@guillaumemichel ok, then I will rework this to be an option in the Kubo configuration instead.

Copy link

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks @hacdias 👍🏻

@hacdias hacdias mentioned this pull request Apr 2, 2024
11 tasks
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thanks. Lgtm, only blocking ask is to change from bool to a Flag (details inline)

docs/changelogs/v0.28.md Show resolved Hide resolved
Comment on lines +120 to +126
wanOptions := []dht.Option{
dht.BootstrapPeers(args.BootstrapPeers...),
}
lanOptions := []dht.Option{}
if args.LoopbackAddressesOnLanDHT {
lanOptions = append(lanOptions, dht.AddressFilter(nil))
}
Copy link
Member

@lidel lidel Apr 2, 2024

Choose a reason for hiding this comment

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

💭 LoopbackAddressesOnLanDHT Feels overly specific given how generic go-libp2p config option is:

We have similar setup for WAN.

I would expect this a Flag to be named close to what we do in libp2p config, Routing.DisableNoAddressFiltersOnLanDHT and have similar one for WAN (Routing.DisableAddressFiltersOnWanDHT) just in case we break people running custom overlay networks that don't follow official RFCs (giving them an escape hatch to self-fix, without having to report bugs to us).

I don't know how real this problem is, we would have to itnterview someone working with IPFS and overlays, so don't want to block on this.

For now, if we make LoopbackAddressesOnLanDHT a Flag we can leave this as-is, and fix later, if/once someone reports we broke their setup.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed to Flag. I would keep it as-is for now and see if someone complains. Otherwise we'll have to add many options. I had already discussed yesterday with @aschmahmann and we had decided on removing the WAN option for now.

config/routing.go Outdated Show resolved Hide resolved
@hacdias hacdias force-pushed the dht-0.25.2 branch 2 times, most recently from 8b0a7ed to ab8c4ea Compare April 4, 2024 11:08

Whether loopback addresses (e.g. 127.0.0.1) should not be ignored on the local LAN DHT.

Most users do not need this setting. It can be useful during testing, when multiple Kubo nodes run on the same machine but some of them do not have `Discovery.MDNS.Enabled`.
Copy link
Member

Choose a reason for hiding this comment

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

ℹ️ I played a bit with various setups and this seems to be useful only when mDNS discovery is not available. Had two nodes with MDNS, and they discovered each other and connected over /ip6/::1/udp/4001/quic-v1/ just fine.

Added this note so our config docs explain why and when the option matters, so users save time and not bother with it.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Tested locally, was not able to find regressions.

Running two desktop nodes should still work fine due to mDNS being enabled by default in Kubo, and in IPFS Desktop and Brave.

@lidel lidel enabled auto-merge (squash) April 4, 2024 12:52
@lidel lidel merged commit 11183bb into master Apr 4, 2024
14 checks passed
@lidel lidel deleted the dht-0.25.2 branch April 4, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip/changelog This change does NOT require a changelog entry
Projects
No open projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

3 participants