@cryptotaxi247 / kubo / commits / 853ed0be5

chore: fix deprecation warnings

Steven Allen committed Sep 26, 2019 at 15:38 UTC 853ed0be5d317ae72086a646dbf0d5116107fb28
7 files changed +12 -10
core/commands/id.go
+2 -1
@@ -8,6 +8,7 @@ import (
8 "io"
9 "strings"
10
11 + version "github.com/ipfs/go-ipfs"
12 core "github.com/ipfs/go-ipfs/core"
13 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
14
@@ -189,6 +190,6 @@ func printSelf(node *core.IpfsNode) (interface{}, error) {
190 }
191 }
192 info.ProtocolVersion = identify.LibP2PVersion
192 - info.AgentVersion = identify.ClientVersion
193 + info.AgentVersion = version.UserAgent
194 return info, nil
195 }
core/core.go
-7
@@ -12,10 +12,8 @@ package core
12 import (
13 "context"
14 "io"
15 - "path"
15
16 "github.com/ipfs/go-filestore"
18 - version "github.com/ipfs/go-ipfs"
17 "github.com/ipfs/go-ipfs/core/bootstrap"
18 "github.com/ipfs/go-ipfs/core/node"
19 "github.com/ipfs/go-ipfs/core/node/libp2p"
@@ -49,15 +47,10 @@ import (
47 record "github.com/libp2p/go-libp2p-record"
48 "github.com/libp2p/go-libp2p/p2p/discovery"
49 p2pbhost "github.com/libp2p/go-libp2p/p2p/host/basic"
52 - "github.com/libp2p/go-libp2p/p2p/protocol/identify"
50 )
51
52 var log = logging.Logger("core")
53
57 -func init() {
58 - identify.ClientVersion = path.Join("go-ipfs", version.CurrentVersionNumber, version.CurrentCommit)
59 -}
60 -
54 // IpfsNode is IPFS Core module. It represents an IPFS instance.
55 type IpfsNode struct {
56
core/corehttp/gateway.go
+1 -1
@@ -104,7 +104,7 @@ func VersionOption() ServeOption {
104 return func(_ *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
105 mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
106 fmt.Fprintf(w, "Commit: %s\n", version.CurrentCommit)
107 - fmt.Fprintf(w, "Client Version: %s\n", id.ClientVersion)
107 + fmt.Fprintf(w, "Client Version: %s\n", version.UserAgent)
108 fmt.Fprintf(w, "Protocol Version: %s\n", id.LibP2PVersion)
109 })
110 return mux, nil
core/corehttp/gateway_test.go
+1 -1
@@ -608,7 +608,7 @@ func TestVersion(t *testing.T) {
608 t.Fatalf("response doesn't contain commit:\n%s", s)
609 }
610
611 - if !strings.Contains(s, "Client Version: "+id.ClientVersion) {
611 + if !strings.Contains(s, "Client Version: "+version.UserAgent) {
612 t.Fatalf("response doesn't contain client version:\n%s", s)
613 }
614
core/node/groups.go
+1
@@ -23,6 +23,7 @@ import (
23 )
24
25 var BaseLibP2P = fx.Options(
26 + fx.Provide(libp2p.UserAgent),
27 fx.Provide(libp2p.PNet),
28 fx.Provide(libp2p.ConnectionManager),
29 fx.Provide(libp2p.DefaultTransports),
core/node/libp2p/libp2p.go
+4
@@ -3,6 +3,8 @@ package libp2p
3 import (
4 "time"
5
6 + version "github.com/ipfs/go-ipfs"
7 +
8 logging "github.com/ipfs/go-log"
9 "github.com/libp2p/go-libp2p"
10 "github.com/libp2p/go-libp2p-connmgr"
@@ -22,6 +24,8 @@ type Libp2pOpts struct {
24
25 // Misc options
26
27 +var UserAgent = simpleOpt(libp2p.UserAgent(version.UserAgent))
28 +
29 func ConnectionManager(low, high int, grace time.Duration) func() (opts Libp2pOpts, err error) {
30 return func() (opts Libp2pOpts, err error) {
31 cm := connmgr.NewConnManager(low, high, grace)
version.go
+3
@@ -7,3 +7,6 @@ var CurrentCommit string
7 const CurrentVersionNumber = "0.5.0-dev"
8
9 const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
10 +
11 +// UserAgent is the libp2p user agent used by go-ipfs.
12 +var UserAgent = ApiVersion + CurrentCommit