From 7c0149d048dd8267850d0e3fc615c700750407a6 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Fri, 6 Jan 2017 06:30:48 -0800 Subject: [PATCH] set the agent version based on version string License: MIT Signed-off-by: Jeromy --- core/core.go | 5 +++++ test/sharness/t0020-init.sh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/core/core.go b/core/core.go index 8a993bc0e6e..908b6dd45d6 100644 --- a/core/core.go +++ b/core/core.go @@ -44,6 +44,7 @@ import ( discovery "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/discovery" p2pbhost "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/host/basic" rhost "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/host/routed" + identify "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/protocol/identify" ping "gx/ipfs/QmQHmMFyhfp2ZXnbYWqAWhEideDCNDM6hzJwqCU29Y5zV2/go-libp2p/p2p/protocol/ping" ds "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore" goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess" @@ -86,6 +87,10 @@ const ( onlineMode ) +func init() { + identify.ClientVersion = "go-ipfs/" + config.CurrentVersionNumber + "/" + config.CurrentCommit +} + // IpfsNode is IPFS Core module. It represents an IPFS instance. type IpfsNode struct { diff --git a/test/sharness/t0020-init.sh b/test/sharness/t0020-init.sh index f5d68f591cb..d54af7d3c1e 100755 --- a/test/sharness/t0020-init.sh +++ b/test/sharness/t0020-init.sh @@ -117,6 +117,10 @@ test_expect_success "Welcome readme doesn't exists" ' test_must_fail ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme ' +test_expect_success "ipfs id agent string contains correct version" ' + ipfs id -f "" | grep $(ipfs version -n) +' + test_expect_success "clean up ipfs dir" ' rm -rf "$IPFS_PATH" '