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

ipfs swarm peers --enc=json --identify #9578

Closed
lidel opened this issue Jan 23, 2023 · 1 comment
Closed

ipfs swarm peers --enc=json --identify #9578

lidel opened this issue Jan 23, 2023 · 1 comment
Labels
exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up topic/bandwidth reduction Topic bandwidth reduction topic/commands Topic commands topic/webui Topic webui

Comments

@lidel
Copy link
Member

lidel commented Jan 23, 2023

Peers screen in ipfs-webui could show the agent versions, and all supported protocols, but it is too expensive to do ipfs.id call for each peer – especially in browser.

We already have ipfs swarm peers --enc=json --streams opt-in flag which fills Streams field in JSON response for each peer, example:

{
      "Addr": "/ip4/97.70.169.114/udp/4001/quic",
      "Peer": "12D3KooWDqzNdf6Ctcm8Xp89x7MWcdSbCFwnXeNfNXHhBjpr9jx9",
      "Latency": "",
      "Muxer": "",
      "Direction": 0,
      "Streams": [
        {
          "Protocol": "/ipfs/kad/1.0.0"
        }
      ]
    }

Streams info is used for "Open Streams" column on the peers screen, but it only shows active streams, not all supported protocols and versions:

Screenshot 2023-01-23 at 19-11-17 Peers IPFS

Proposed improvement

Support passing --identify which adds Identify values, could be the same struct as one returned by ipfs id (result of libp2p's identify protocol):

{
      "Addr": "/ip4/95.208.80.171/udp/4001/quic",
      "Peer": "12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
      "Latency": "",
      "Muxer": "",
      "Direction": 0,
      "Streams": [
        {
          "Protocol": "/ipfs/kad/1.0.0"
        }
      ],
      "Identify": {
        "ID": "12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
        "PublicKey": "CAESILgL3TiUmYeBy46Uzp0XZxwP4fcFVTIoX6ncvEr+hKSU",
        "Addresses": [
          "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip4/172.17.0.2/tcp/4001/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip4/172.17.0.2/udp/4001/quic/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip4/95.208.80.171/tcp/4001/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip4/95.208.80.171/udp/4001/quic/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip6/::1/tcp/4001/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq",
          "/ip6/::1/udp/4001/quic/p2p/12D3KooWNCogGjemMiMjZmDxyVcrjP3KW7VFdSPTTGousXEhczuq"
        ],
        "AgentVersion": "go-ipfs/0.8.0/ad14c3932e",
        "ProtocolVersion": "ipfs/0.1.0",
        "Protocols": [
          "/ipfs/bitswap",
          "/ipfs/bitswap/1.0.0",
          "/ipfs/bitswap/1.1.0",
          "/ipfs/bitswap/1.2.0",
          "/ipfs/id/1.0.0",
          "/ipfs/id/push/1.0.0",
          "/ipfs/ping/1.0.0",
          "/libp2p/circuit/relay/0.1.0",
          "/p2p/id/delta/1.0.0",
          "/x/"
        ]
      }
    }

If we had ipfs swarm peers --enc=json --identify then we could unblock ipfs/ipfs-webui#2086 and show it on the Peers screen, and see which nodes is JS-IPFs, Iroh, Kubo, which one is docker/brave/desktop etc

Unsure if we are caching identify results, if not, we should start doing so, removing the need for executing identify protocol lookup for every peer every time ipfs swarm peers --enc=json --identify is called.

If anyone has bandwidth to do this, feel free to pick it up, and @lidel me for review.

@lidel lidel added help wanted Seeking public contribution on this issue topic/commands Topic commands topic/bandwidth reduction Topic bandwidth reduction exp/novice Someone with a little familiarity can pick up topic/webui Topic webui P2 Medium: Good to have, but can wait until someone steps up good first issue Good issue for new contributors labels Jan 23, 2023
@arthurgavazza
Copy link
Contributor

@lidel can I pick this up? any tips on where to start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up topic/bandwidth reduction Topic bandwidth reduction topic/commands Topic commands topic/webui Topic webui
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants