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

Allow users to add IPFS peer servers #15567

Closed
Tracked by #17112
spylogsster opened this issue Apr 29, 2021 · 5 comments · Fixed by brave/brave-core#8839
Closed
Tracked by #17112

Allow users to add IPFS peer servers #15567

spylogsster opened this issue Apr 29, 2021 · 5 comments · Fixed by brave/brave-core#8839

Comments

@spylogsster
Copy link

spylogsster commented Apr 29, 2021

Allow users to enter the peers to the config
https://github.com/ipfs/go-ipfs/blob/master/docs/config.md#peering

##Test Plan

  • Add peers in IPFS Settings
  • Restart node if launched
  • Go to brave://ipfs -> My Node -> PEERS
  • Find your peer in the list( should be noted as "bootstrap" )
@spylogsster spylogsster self-assigned this Apr 29, 2021
@lidel
Copy link

lidel commented May 12, 2021

When it comes to UX, you may have the best luck with a single input that takes a string and extracts ID and Addrs from it.

Usually, user will just copy a single address in form of (could be any of those):

  • /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
  • /p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
  • QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ and adds it to peers.

To keep things simple:

  • split at /p2p/ (if present), and put the first part in Addrs and the second one in ID.
  • if no /p2p is present, just assume its ID.

This is enough because even if none of Addrs work, IPFS node will fall back to DHT lookup for ID (ipfs dht findpeer)

@spylogsster
Copy link
Author

for compatibility reasons decided to add 1 as a valid prefix if it is preceded with /p2p/ in order to validate PeerIDs like
/ip4/46.21.210.45/udp/14406/quic/p2p/12D3KooWBdmLJjhpgJ9KZgLM3f894ff9xyBfPvPjFNn7MKJpyrC2

@stephendonner
Copy link

@spylogsster mind adding a step-by-step testplan with instructions for a two-machine setup (running the same build, I presume) with the 2nd machine's ports changed appropriately, to test?

I tried to get this working by changing the port via the Settings page available after clicking My Node in brave://ipfs-internals, but it didn't seem to stick, even after restarting IPFS, so wasn't sure how to test this.

Screen Shot 2021-06-07 at 6 21 24 PM

@spylogsster
Copy link
Author

@stephendonner added steps, please disable "Method to resolve Unstoppable Domains" and "Method to resolve Ethereum Name Service (ENS)" and "Redirect IPFS resources to the configured IPFS gateway" options in settings, while https://github.com/brave/brave-core/pull/9031/files is not merged, then node status page will be loaded successfully

@stephendonner
Copy link

Verified PASSED using

Brave 1.27.78 Chromium: 91.0.4472.114 (Official Build) beta (x86_64)
Revision 4bb19460e8d88c3446b360b0df8fd991fee49c0b-refs/branch-heads/4472@{#1496}
OS macOS Version 11.4 (Build 20F71)

Pre-requisite (to make it easier):
machine1: macbook pro (running 1.27.x with Gateway port 48083)
machine2: Windows desktop (running 1.28.x, with Gateway port 48081)

Steps (do 1-4 on both machine1 and machine2)

  1. clean profile
  2. load ipns://brantly.eth
  3. click on Use a local node
  4. load brave://ipfs-internals
  5. note/copy the Peer ID on machine2
  6. note the Gateway path/port
  7. on machine1, go to brave://settings/ipfs/peers
  8. click Add
  9. enter /ip4/127.0.0.1/tcp/48081/quic/p2p/12D3KooWQt6ndYjevTTtgVFwKUeZYaU5aFtnogrLKgjvgZiRBT3m
  10. click Submit
  11. restart both IPFS nodes
  12. load brave://ipfs-internals
  13. click on My Node
  14. click on Peers
  15. confirm on machine1 you see an entry for Local Network with the matching Peer ID of the one you entered from machine2, above (in this case, it's 12D3KooWQt6ndYjevTTtgVFwKUeZYaU5aFtnogrLKgjvgZiRBT3m which is cropped in the UI as 123D...BT3m
  16. confirm on machine1 you see an entry for abootstrap node under the Notes column; this Peer ID comes from the list in the Settings of IPFS, found from clicking My Node onbrave://ipfs-internals. In my screenshots, it's QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ represented as QmaC...uvuJ.
machine1 - brave://settings/ipfs/peers machine1 - My Node machine1 - Peers bootstrap node from Settings
Screen Shot 2021-06-24 at 1 11 39 PM Screen Shot 2021-06-24 at 2 19 41 PM Screen Shot 2021-06-24 at 1 09 56 PM Screen Shot 2021-06-24 at 3 00 47 PM
machine2 - My Node machine2 - Peers
windows-node-status windows-peers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants