Skip to content

Commit 56058c1

Browse files
Merge pull request #3569 from ipfs/feat/libp2p-agent-vers
set the agent version based on version string
2 parents 87f8bfd + 7c0149d commit 56058c1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

core/core.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
discovery "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/discovery"
4545
p2pbhost "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/host/basic"
4646
rhost "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/host/routed"
47+
identify "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/protocol/identify"
4748
ping "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/protocol/ping"
4849
ds "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore"
4950
goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
@@ -86,6 +87,10 @@ const (
8687
onlineMode
8788
)
8889

90+
func init() {
91+
identify.ClientVersion = "go-ipfs/" + config.CurrentVersionNumber + "/" + config.CurrentCommit
92+
}
93+
8994
// IpfsNode is IPFS Core module. It represents an IPFS instance.
9095
type IpfsNode struct {
9196

test/sharness/t0020-init.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ test_expect_success "Welcome readme doesn't exists" '
117117
test_must_fail ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme
118118
'
119119

120+
test_expect_success "ipfs id agent string contains correct version" '
121+
ipfs id -f "<aver>" | grep $(ipfs version -n)
122+
'
123+
120124
test_expect_success "clean up ipfs dir" '
121125
rm -rf "$IPFS_PATH"
122126
'

0 commit comments

Comments
 (0)