Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Track: enabling the DHT by default #3905

Closed
6 of 13 tasks
achingbrain opened this issue Oct 1, 2021 · 8 comments
Closed
6 of 13 tasks

Track: enabling the DHT by default #3905

achingbrain opened this issue Oct 1, 2021 · 8 comments
Assignees
Labels
awesome endeavour kind/enhancement A net-new feature or improvement to an existing feature

Comments

@achingbrain
Copy link
Member

achingbrain commented Oct 1, 2021

Steps

  1. Support DHT client mode
    • E.g. be able to make queries for content and peers
  2. Implement autonat
    • To become a server (e.g. to store DHT records), we need ensure we are dialable. Autonat will give us confidence we are externally dialable
  3. Support DHT server mode
    • Once we know we are dialable we can become a DHT server and store records

Each step depends on the previous but represents a stand-alone piece of functionality so will be useful when shipped.

DHT client mode

Autonat

DHT server mode

Testing

Testing will be done through interop and Testground. The interop test suite PR needs updating but will help establish an absolute baseline. More advanced testing will need to be done in Testground which will require the js-sdk being usable.

Wrap up

  • Update the spec in libp2p with learnings
@achingbrain achingbrain added the need/triage Needs initial labeling and prioritization label Oct 1, 2021
@ipfs ipfs deleted a comment from welcome bot Oct 1, 2021
@achingbrain achingbrain added awesome endeavour kind/enhancement A net-new feature or improvement to an existing feature and removed need/triage Needs initial labeling and prioritization labels Oct 1, 2021
@achingbrain achingbrain pinned this issue Oct 1, 2021
@achingbrain achingbrain changed the title Track enabling the DHT by default Track: enabling the DHT by default Oct 1, 2021
achingbrain added a commit to ipfs/interop that referenced this issue Oct 1, 2021
Adds additional tests from #36 as well as some extras requested in
the PR comments.

Refs: ipfs/js-ipfs#3905
@2color
Copy link
Member

2color commented Aug 10, 2022

As it currently stands, I presume that we only support DHT client mode, right?

@achingbrain
Copy link
Member Author

DHT server mode works, but for the time being you have to enable it explicitly with "Type": "dhtserver".

Once autonat lands in libp2p we'll be able to flip into server mode automatically.

@2color
Copy link
Member

2color commented Aug 10, 2022

That's amazing! Thanks for clarifying that.

Is upnp supported by js-libp2p to map ports?

@achingbrain
Copy link
Member Author

achingbrain commented Aug 10, 2022

Yes, it's on by default for node & electron - if your node manages to negotiate uPnP port forwarding with your router it should start to report a public IP address a few seconds after startup.

You should ensure your node is publicly addressable in this or some other fashion before enabling DHT server mode, otherwise it'll start storing provider records for peers but they'll not be resolvable on the network as other peers won't be able to dial your node.

If you just want DHT support to find other peers and content, client mode is all you need.

@2color
Copy link
Member

2color commented Aug 11, 2022

Can js-ipfs running in a browser use the DHT in client mode over a WSS connection?

@achingbrain
Copy link
Member Author

Yes, and it's recommended that they only use the DHT in client mode as browser nodes aren't typically around for long enough to make good DHT servers (it should be on the order of days).

One thing to bear in mind is that although you'll get results from DHT queries in the browser, most nodes on the network are not dialable from browsers due to them only supporting TCP and/or QUIC transports so you'll probably want to set up a circuit relay or similar to be able to connect to them. This will change with the arrival of WebRTC transports that don't need a signalling server.

@tinytb
Copy link

tinytb commented Nov 22, 2022

backlog grooming: Autonat is the next step for this.

@achingbrain
Copy link
Member Author

achingbrain commented May 22, 2023

The DHT is enabled by default in Helia - if anyone is watching this issue for updates, please see the migration guide and update as soon as possible.

@achingbrain achingbrain unpinned this issue May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awesome endeavour kind/enhancement A net-new feature or improvement to an existing feature
Projects
No open projects
Archived in project
Status: Done
Status: Done
Development

No branches or pull requests

3 participants