From ff36a73c36ae20eb6e5c83dd4ba97ed1ef2274fb Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 28 Jun 2023 09:18:21 -0700 Subject: [PATCH] remove ProtocolVersion from id command --- core/commands/id.go | 17 +++++------------ core/commands/swarm.go | 5 ----- docs/file-transfer.md | 3 +-- test/cli/swarm_test.go | 14 +++++--------- test/sharness/t0026-id.sh | 6 ------ 5 files changed, 11 insertions(+), 34 deletions(-) diff --git a/core/commands/id.go b/core/commands/id.go index ba40a699d7ce..3446fc267cd6 100644 --- a/core/commands/id.go +++ b/core/commands/id.go @@ -26,12 +26,11 @@ import ( const offlineIDErrorMessage = "'ipfs id' cannot query information on remote peers without a running daemon; if you only want to convert --peerid-base, pass --offline option" type IdOutput struct { // nolint - ID string - PublicKey string - Addresses []string - AgentVersion string - ProtocolVersion string - Protocols []protocol.ID + ID string + PublicKey string + Addresses []string + AgentVersion string + Protocols []protocol.ID } const ( @@ -126,7 +125,6 @@ EXAMPLE: output := format output = strings.Replace(output, "", out.ID, -1) output = strings.Replace(output, "", out.AgentVersion, -1) - output = strings.Replace(output, "", out.ProtocolVersion, -1) output = strings.Replace(output, "", out.PublicKey, -1) output = strings.Replace(output, "", strings.Join(out.Addresses, "\n"), -1) output = strings.Replace(output, "", strings.Join(protocol.ConvertToStrings(out.Protocols), "\n"), -1) @@ -178,11 +176,6 @@ func printPeer(keyEnc ke.KeyEncoder, ps pstore.Peerstore, p peer.ID) (interface{ info.Protocols = append(info.Protocols, protocols...) sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] }) - if v, err := ps.Get(p, "ProtocolVersion"); err == nil { - if vs, ok := v.(string); ok { - info.ProtocolVersion = vs - } - } if v, err := ps.Get(p, "AgentVersion"); err == nil { if vs, ok := v.(string); ok { info.AgentVersion = vs diff --git a/core/commands/swarm.go b/core/commands/swarm.go index c9259bef0e37..db8641a15129 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -490,11 +490,6 @@ func (ci *connInfo) identifyPeer(ps pstore.Peerstore, p peer.ID) (IdOutput, erro sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] }) } - if v, err := ps.Get(p, "ProtocolVersion"); err == nil { - if vs, ok := v.(string); ok { - info.ProtocolVersion = vs - } - } if v, err := ps.Get(p, "AgentVersion"); err == nil { if vs, ok := v.(string); ok { info.AgentVersion = vs diff --git a/docs/file-transfer.md b/docs/file-transfer.md index 8f38ca765311..7e3a54724025 100644 --- a/docs/file-transfer.md +++ b/docs/file-transfer.md @@ -50,8 +50,7 @@ addresses (like the example below), then your nodes are online. "/ip4/192.168.2.131/tcp/4001/p2p/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8", "/ip4/192.168.2.131/udp/4001/quic/p2p/QmTNwsFkLAed15kQEC1ZJWPfoNbBQnMFojfJKQ9sZj1dk8", ], - "AgentVersion": "go-ipfs/0.4.11-dev/", - "ProtocolVersion": "ipfs/0.1.0" + "AgentVersion": "go-ipfs/0.4.11-dev/" } ``` diff --git a/test/cli/swarm_test.go b/test/cli/swarm_test.go index d1a4b5c6ca32..920d310baa22 100644 --- a/test/cli/swarm_test.go +++ b/test/cli/swarm_test.go @@ -13,12 +13,11 @@ import ( // TODO: Migrate the rest of the sharness swarm test. func TestSwarm(t *testing.T) { type identifyType struct { - ID string - PublicKey string - Addresses []string - AgentVersion string - ProtocolVersion string - Protocols []string + ID string + PublicKey string + Addresses []string + AgentVersion string + Protocols []string } type peer struct { Identify identifyType @@ -53,7 +52,6 @@ func TestSwarm(t *testing.T) { actualPublicKey := output.Peers[0].Identify.PublicKey actualAgentVersion := output.Peers[0].Identify.AgentVersion actualAdresses := output.Peers[0].Identify.Addresses - actualProtocolVersion := output.Peers[0].Identify.ProtocolVersion actualProtocols := output.Peers[0].Identify.Protocols expectedID := otherNode.PeerID().String() @@ -62,7 +60,6 @@ func TestSwarm(t *testing.T) { assert.Equal(t, actualID, expectedID) assert.NotNil(t, actualPublicKey) assert.NotNil(t, actualAgentVersion) - assert.NotNil(t, actualProtocolVersion) assert.Len(t, actualAdresses, 1) assert.Equal(t, expectedAddresses[0], actualAdresses[0]) assert.Greater(t, len(actualProtocols), 0) @@ -89,7 +86,6 @@ func TestSwarm(t *testing.T) { assert.Equal(t, outputIdentify.ID, otherNodeIDOutput.ID) assert.Equal(t, outputIdentify.PublicKey, otherNodeIDOutput.PublicKey) assert.Equal(t, outputIdentify.AgentVersion, otherNodeIDOutput.AgentVersion) - assert.Equal(t, outputIdentify.ProtocolVersion, otherNodeIDOutput.ProtocolVersion) assert.ElementsMatch(t, outputIdentify.Addresses, otherNodeIDOutput.Addresses) assert.ElementsMatch(t, outputIdentify.Protocols, otherNodeIDOutput.Protocols) diff --git a/test/sharness/t0026-id.sh b/test/sharness/t0026-id.sh index 5d6d3db094a4..5ae5f500609b 100755 --- a/test/sharness/t0026-id.sh +++ b/test/sharness/t0026-id.sh @@ -32,12 +32,6 @@ test_expect_success "checking AgentVersion" ' test_cmp expected-agent-version actual-agent-version ' -test_expect_success "checking ProtocolVersion" ' - echo "ipfs/0.1.0" > expected-protocol-version && - ipfs id -f "\n" > actual-protocol-version && - test_cmp expected-protocol-version actual-protocol-version -' - test_expect_success "checking ID of self" ' ipfs config Identity.PeerID > expected-id && ipfs id -f "\n" > actual-id &&