packages/ipfs-cluster: bump dependencies and switch to Go 1.19
This commit is contained in:
parent
ed3265a311
commit
1754841832
86 changed files with 505 additions and 732 deletions
|
@ -1,49 +0,0 @@
|
|||
FROM golang:1.18-buster AS builder
|
||||
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
||||
|
||||
# This dockerfile builds cluster and runs it along with go-ipfs.
|
||||
# It re-uses the latest go-ipfs:release container.
|
||||
|
||||
# This builder just builds the cluster binaries
|
||||
ENV GOPATH /go
|
||||
ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster
|
||||
ENV GO111MODULE on
|
||||
ENV GOPROXY https://proxy.golang.org
|
||||
|
||||
COPY --chown=1000:users go.* $SRC_PATH/
|
||||
WORKDIR $SRC_PATH
|
||||
RUN go mod download
|
||||
|
||||
COPY --chown=1000:users . $SRC_PATH
|
||||
RUN make install
|
||||
|
||||
#------------------------------------------------------
|
||||
FROM ipfs/go-ipfs:release
|
||||
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
||||
|
||||
# This is the container which just puts the previously
|
||||
# built binaries on the go-ipfs-container.
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster
|
||||
ENV IPFS_CLUSTER_PATH /data/ipfs-cluster
|
||||
ENV IPFS_CLUSTER_CONSENSUS crdt
|
||||
ENV IPFS_CLUSTER_DATASTORE leveldb
|
||||
|
||||
EXPOSE 9094
|
||||
EXPOSE 9095
|
||||
EXPOSE 9096
|
||||
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-service /usr/local/bin/ipfs-cluster-service
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-ctl /usr/local/bin/ipfs-cluster-ctl
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-follow /usr/local/bin/ipfs-cluster-follow
|
||||
COPY --from=builder $SRC_PATH/docker/start-daemons.sh /usr/local/bin/start-daemons.sh
|
||||
|
||||
RUN mkdir -p $IPFS_CLUSTER_PATH && \
|
||||
chown 1000:100 $IPFS_CLUSTER_PATH
|
||||
|
||||
VOLUME $IPFS_CLUSTER_PATH
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start-daemons.sh"]
|
||||
|
||||
# Defaults for ipfs-cluster-service go here
|
||||
CMD ["daemon"]
|
|
@ -1,68 +0,0 @@
|
|||
FROM golang:1.18-buster AS builder
|
||||
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
||||
|
||||
# This build state just builds the cluster binaries
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster
|
||||
ENV GO111MODULE on
|
||||
ENV GOPROXY https://proxy.golang.org
|
||||
|
||||
RUN cd /tmp && \
|
||||
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && \
|
||||
chmod +x jq-linux64
|
||||
|
||||
COPY --chown=1000:users go.* $SRC_PATH/
|
||||
WORKDIR $SRC_PATH
|
||||
RUN go mod download
|
||||
|
||||
COPY --chown=1000:users . $SRC_PATH
|
||||
RUN make install
|
||||
|
||||
#------------------------------------------------------
|
||||
FROM ipfs/go-ipfs:master
|
||||
MAINTAINER Hector Sanjuan <hector@protocol.ai>
|
||||
|
||||
# This is the container which just puts the previously
|
||||
# built binaries on the go-ipfs-container.
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster
|
||||
ENV IPFS_CLUSTER_PATH /data/ipfs-cluster
|
||||
ENV IPFS_CLUSTER_CONSENSUS crdt
|
||||
ENV IPFS_CLUSTER_DATASTORE leveldb
|
||||
ENV IPFS_CLUSTER_RESTAPI_HTTPLISTENMULTIADDRESS /ip4/0.0.0.0/tcp/9094
|
||||
ENV IPFS_CLUSTER_IPFSPROXY_LISTENMULTIADDRESS /ip4/0.0.0.0/tcp/9095
|
||||
|
||||
EXPOSE 9094
|
||||
EXPOSE 9095
|
||||
EXPOSE 9096
|
||||
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-service /usr/local/bin/ipfs-cluster-service
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-ctl /usr/local/bin/ipfs-cluster-ctl
|
||||
COPY --from=builder $GOPATH/bin/ipfs-cluster-follow /usr/local/bin/ipfs-cluster-follow
|
||||
COPY --from=builder $SRC_PATH/docker/test-entrypoint.sh /usr/local/bin/test-entrypoint.sh
|
||||
COPY --from=builder $SRC_PATH/docker/random-stopper.sh /usr/local/bin/random-stopper.sh
|
||||
COPY --from=builder $SRC_PATH/docker/random-killer.sh /usr/local/bin/random-killer.sh
|
||||
COPY --from=builder $SRC_PATH/docker/wait-killer-stopper.sh /usr/local/bin/wait-killer-stopper.sh
|
||||
COPY --from=builder $SRC_PATH/docker/cluster-restart.sh /usr/local/bin/cluster-restart.sh
|
||||
|
||||
# Add jq
|
||||
COPY --from=builder /tmp/jq-linux64 /usr/local/bin/jq
|
||||
|
||||
# Add bash
|
||||
COPY --from=builder /bin/bash /bin/bash
|
||||
COPY --from=builder /lib/*-linux-gnu*/libtinfo.so* /lib64/
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir -p $IPFS_CLUSTER_PATH && \
|
||||
chown 1000:100 $IPFS_CLUSTER_PATH
|
||||
|
||||
USER ipfs
|
||||
|
||||
VOLUME $IPFS_CLUSTER_PATH
|
||||
ENTRYPOINT ["/usr/local/bin/test-entrypoint.sh"]
|
||||
|
||||
# Defaults would go here
|
||||
CMD ["daemon"]
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/adder"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
func TestAdd(t *testing.T) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs/go-unixfs"
|
||||
"github.com/ipld/go-car"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
"github.com/ipld/go-car"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
balanced "github.com/ipfs/go-unixfs/importer/balanced"
|
||||
ihelper "github.com/ipfs/go-unixfs/importer/helpers"
|
||||
trickle "github.com/ipfs/go-unixfs/importer/trickle"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
var log = logging.Logger("coreunix")
|
||||
|
|
|
@ -81,7 +81,7 @@ func makeDAGSimple(ctx context.Context, dagObj map[string]cid.Cid) (ipld.Node, e
|
|||
// recursively pinned to track the shard
|
||||
func makeDAG(ctx context.Context, dagObj map[string]cid.Cid) ([]ipld.Node, error) {
|
||||
// FIXME: We have a 4MB limit on the block size enforced by bitswap:
|
||||
// https://github.com/libp2p/go-libp2p-core/blob/master/network/network.go#L23
|
||||
// https://github.com/libp2p/go-libp2p/core/blob/master/network/network.go#L23
|
||||
|
||||
// No indirect node
|
||||
if len(dagObj) <= MaxLinks {
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
cid "github.com/ipfs/go-cid"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
cid "github.com/ipfs/go-cid"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
api "github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
api "github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
func makeMetric(name, value string, weight int64, peer peer.ID, partitionable bool) api.Metric {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// DefaultShardSize is the shard size for params objects created with DefaultParams().
|
||||
|
|
|
@ -33,8 +33,8 @@ import (
|
|||
logging "github.com/ipfs/go-log/v2"
|
||||
gopath "github.com/ipfs/go-path"
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
gostream "github.com/libp2p/go-libp2p-gostream"
|
||||
p2phttp "github.com/libp2p/go-libp2p-http"
|
||||
|
|
|
@ -11,10 +11,9 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
ipfsconfig "github.com/ipfs/go-ipfs-config"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
crypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
|
@ -110,18 +109,18 @@ type Config struct {
|
|||
}
|
||||
|
||||
type jsonConfig struct {
|
||||
HTTPListenMultiaddress ipfsconfig.Strings `json:"http_listen_multiaddress"`
|
||||
SSLCertFile string `json:"ssl_cert_file,omitempty"`
|
||||
SSLKeyFile string `json:"ssl_key_file,omitempty"`
|
||||
ReadTimeout string `json:"read_timeout"`
|
||||
ReadHeaderTimeout string `json:"read_header_timeout"`
|
||||
WriteTimeout string `json:"write_timeout"`
|
||||
IdleTimeout string `json:"idle_timeout"`
|
||||
MaxHeaderBytes int `json:"max_header_bytes"`
|
||||
HTTPListenMultiaddress config.Strings `json:"http_listen_multiaddress"`
|
||||
SSLCertFile string `json:"ssl_cert_file,omitempty"`
|
||||
SSLKeyFile string `json:"ssl_key_file,omitempty"`
|
||||
ReadTimeout string `json:"read_timeout"`
|
||||
ReadHeaderTimeout string `json:"read_header_timeout"`
|
||||
WriteTimeout string `json:"write_timeout"`
|
||||
IdleTimeout string `json:"idle_timeout"`
|
||||
MaxHeaderBytes int `json:"max_header_bytes"`
|
||||
|
||||
Libp2pListenMultiaddress ipfsconfig.Strings `json:"libp2p_listen_multiaddress,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
PrivateKey string `json:"private_key,omitempty" hidden:"true"`
|
||||
Libp2pListenMultiaddress config.Strings `json:"libp2p_listen_multiaddress,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
PrivateKey string `json:"private_key,omitempty" hidden:"true"`
|
||||
|
||||
BasicAuthCredentials map[string]string `json:"basic_auth_credentials" hidden:"true"`
|
||||
HTTPLogFile string `json:"http_log_file"`
|
||||
|
@ -404,7 +403,7 @@ func (cfg *Config) toJSONConfig() (jcfg *jsonConfig, err error) {
|
|||
}
|
||||
|
||||
if cfg.ID != "" {
|
||||
jcfg.ID = peer.Encode(cfg.ID)
|
||||
jcfg.ID = cfg.ID.String()
|
||||
}
|
||||
if cfg.PrivateKey != nil {
|
||||
pkeyBytes, err := crypto.MarshalPrivateKey(cfg.PrivateKey)
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
types "github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
crypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
|
|
@ -9,17 +9,16 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/libp2p/go-libp2p"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
p2phttp "github.com/libp2p/go-libp2p-http"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -38,7 +37,7 @@ func ProcessResp(t *testing.T, httpResp *http.Response, err error, resp interfac
|
|||
if err != nil {
|
||||
t.Fatal("error making request: ", err)
|
||||
}
|
||||
body, err := ioutil.ReadAll(httpResp.Body)
|
||||
body, err := io.ReadAll(httpResp.Body)
|
||||
defer httpResp.Body.Close()
|
||||
if err != nil {
|
||||
t.Fatal("error reading body: ", err)
|
||||
|
@ -140,7 +139,7 @@ func HTTPURL(a API) string {
|
|||
|
||||
// P2pURL returns the libp2p endpoint of the API.
|
||||
func P2pURL(a API) string {
|
||||
return fmt.Sprintf("libp2p://%s", peer.Encode(a.Host().ID()))
|
||||
return fmt.Sprintf("libp2p://%s", a.Host().ID().String())
|
||||
}
|
||||
|
||||
// HttpsURL returns the HTTPS endpoint of the API
|
||||
|
@ -160,7 +159,7 @@ func HTTPClient(t *testing.T, h host.Host, isHTTPS bool) *http.Client {
|
|||
tr := &http.Transport{}
|
||||
if isHTTPS {
|
||||
certpool := x509.NewCertPool()
|
||||
cert, err := ioutil.ReadFile(SSLCertFile)
|
||||
cert, err := os.ReadFile(SSLCertFile)
|
||||
if err != nil {
|
||||
t.Fatal("error reading cert for https client: ", err)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
ipfsconfig "github.com/ipfs/go-ipfs-config"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
|
@ -98,9 +97,9 @@ type Config struct {
|
|||
}
|
||||
|
||||
type jsonConfig struct {
|
||||
ListenMultiaddress ipfsconfig.Strings `json:"listen_multiaddress"`
|
||||
NodeMultiaddress string `json:"node_multiaddress"`
|
||||
NodeHTTPS bool `json:"node_https,omitempty"`
|
||||
ListenMultiaddress config.Strings `json:"listen_multiaddress"`
|
||||
NodeMultiaddress string `json:"node_multiaddress"`
|
||||
NodeHTTPS bool `json:"node_https,omitempty"`
|
||||
|
||||
LogFile string `json:"log_file"`
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
cmd "github.com/ipfs/go-ipfs-cmds"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
path "github.com/ipfs/go-path"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -65,7 +64,7 @@ func TestIPFSProxyVersion(t *testing.T) {
|
|||
t.Fatal("should forward requests to ipfs host: ", err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
if res.StatusCode != http.StatusOK {
|
||||
t.Error("the request should have succeeded")
|
||||
t.Fatal(string(resBytes))
|
||||
|
@ -170,7 +169,7 @@ func TestIPFSProxyPin(t *testing.T) {
|
|||
t.Errorf("statusCode: got = %v, want %v", res.StatusCode, tt.args.statusCode)
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
|
||||
switch tt.wantErr {
|
||||
case false:
|
||||
|
@ -283,7 +282,7 @@ func TestIPFSProxyUnpin(t *testing.T) {
|
|||
t.Errorf("statusCode: got = %v, want %v", res.StatusCode, tt.args.statusCode)
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
|
||||
switch tt.wantErr {
|
||||
case false:
|
||||
|
@ -352,7 +351,7 @@ func TestIPFSProxyPinUpdate(t *testing.T) {
|
|||
defer res.Body.Close()
|
||||
|
||||
var resp ipfsPinOpResp
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
err = json.Unmarshal(resBytes, &resp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -378,7 +377,7 @@ func TestIPFSProxyPinUpdate(t *testing.T) {
|
|||
t.Fatal("request should error")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
var respErr cmd.Error
|
||||
err = json.Unmarshal(resBytes, &respErr)
|
||||
if err != nil {
|
||||
|
@ -404,7 +403,7 @@ func TestIPFSProxyPinUpdate(t *testing.T) {
|
|||
t.Fatal("request should error")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
var respErr cmd.Error
|
||||
err = json.Unmarshal(resBytes, &respErr)
|
||||
if err != nil {
|
||||
|
@ -433,7 +432,7 @@ func TestIPFSProxyPinLs(t *testing.T) {
|
|||
t.Error("the request should have succeeded")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
var resp ipfsPinLsResp
|
||||
err = json.Unmarshal(resBytes, &resp)
|
||||
if err != nil {
|
||||
|
@ -456,7 +455,7 @@ func TestIPFSProxyPinLs(t *testing.T) {
|
|||
t.Error("the request should have succeeded")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
var resp ipfsPinLsResp
|
||||
err = json.Unmarshal(resBytes, &resp)
|
||||
if err != nil {
|
||||
|
@ -479,7 +478,7 @@ func TestIPFSProxyPinLs(t *testing.T) {
|
|||
t.Error("the request should have succeeded")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res2.Body)
|
||||
resBytes, _ := io.ReadAll(res2.Body)
|
||||
var resp ipfsPinLsResp
|
||||
err = json.Unmarshal(resBytes, &resp)
|
||||
if err != nil {
|
||||
|
@ -518,7 +517,7 @@ func TestProxyRepoStat(t *testing.T) {
|
|||
t.Error("request should have succeeded")
|
||||
}
|
||||
|
||||
resBytes, _ := ioutil.ReadAll(res.Body)
|
||||
resBytes, _ := io.ReadAll(res.Body)
|
||||
var stat api.IPFSRepoStat
|
||||
err = json.Unmarshal(resBytes, &stat)
|
||||
if err != nil {
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"go.uber.org/multierr"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ import (
|
|||
shell "github.com/ipfs/go-ipfs-api"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
pnet "github.com/libp2p/go-libp2p-core/pnet"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
pnet "github.com/libp2p/go-libp2p/core/pnet"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
|
|
|
@ -10,8 +10,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
pnet "github.com/libp2p/go-libp2p-core/pnet"
|
||||
pnet "github.com/libp2p/go-libp2p/core/pnet"
|
||||
tcp "github.com/libp2p/go-libp2p/p2p/transport/tcp"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
@ -60,7 +59,7 @@ func apiMAddr(a *rest.API) ma.Multiaddr {
|
|||
}
|
||||
|
||||
func peerMAddr(a *rest.API) ma.Multiaddr {
|
||||
ipfsAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s", peer.Encode(a.Host().ID())))
|
||||
ipfsAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s", a.Host().ID().String()))
|
||||
for _, a := range a.Host().Addrs() {
|
||||
if _, err := a.ValueForProtocol(ma.P_IP4); err == nil {
|
||||
return a.Encapsulate(ipfsAddr)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
shell "github.com/ipfs/go-ipfs-api"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// loadBalancingClient is a client to interact with IPFS Cluster APIs
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
gopath "github.com/ipfs/go-path"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
@ -62,8 +62,7 @@ func (c *defaultClient) PeerAdd(ctx context.Context, pid peer.ID) (api.ID, error
|
|||
ctx, span := trace.StartSpan(ctx, "client/PeerAdd")
|
||||
defer span.End()
|
||||
|
||||
pidStr := peer.Encode(pid)
|
||||
body := peerAddBody{pidStr}
|
||||
body := peerAddBody{pid.String()}
|
||||
|
||||
var buf bytes.Buffer
|
||||
enc := json.NewEncoder(&buf)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
rest "github.com/ipfs-cluster/ipfs-cluster/api/rest"
|
||||
test "github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
|
@ -510,7 +510,7 @@ func TestAlerts(t *testing.T) {
|
|||
if len(alerts) != 1 {
|
||||
t.Fatal("expected 1 alert")
|
||||
}
|
||||
pID2 := peer.Encode(test.PeerID2)
|
||||
pID2 := test.PeerID2.String()
|
||||
if alerts[0].Peer != test.PeerID2 {
|
||||
t.Errorf("expected an alert from %s", pID2)
|
||||
}
|
||||
|
@ -596,19 +596,19 @@ func (wait *waitService) Status(ctx context.Context, in types.Cid, out *types.Gl
|
|||
*out = types.GlobalPinInfo{
|
||||
Cid: in,
|
||||
PeerMap: map[string]types.PinInfoShort{
|
||||
peer.Encode(test.PeerID1): {
|
||||
test.PeerID1.String(): {
|
||||
Status: types.TrackerStatusPinned,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID2): {
|
||||
test.PeerID2.String(): {
|
||||
Status: types.TrackerStatusPinned,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID3): {
|
||||
test.PeerID3.String(): {
|
||||
Status: types.TrackerStatusPinning,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID3): {
|
||||
test.PeerID3.String(): {
|
||||
Status: types.TrackerStatusRemote,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
|
@ -618,19 +618,19 @@ func (wait *waitService) Status(ctx context.Context, in types.Cid, out *types.Gl
|
|||
*out = types.GlobalPinInfo{
|
||||
Cid: in,
|
||||
PeerMap: map[string]types.PinInfoShort{
|
||||
peer.Encode(test.PeerID1): {
|
||||
test.PeerID1.String(): {
|
||||
Status: types.TrackerStatusPinning,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID2): {
|
||||
test.PeerID2.String(): {
|
||||
Status: types.TrackerStatusPinned,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID3): {
|
||||
test.PeerID3.String(): {
|
||||
Status: types.TrackerStatusPinning,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID3): {
|
||||
test.PeerID3.String(): {
|
||||
Status: types.TrackerStatusRemote,
|
||||
TS: wait.pinStart,
|
||||
},
|
||||
|
@ -668,11 +668,11 @@ func (wait *waitServiceUnpin) Status(ctx context.Context, in types.Cid, out *typ
|
|||
*out = types.GlobalPinInfo{
|
||||
Cid: in,
|
||||
PeerMap: map[string]types.PinInfoShort{
|
||||
peer.Encode(test.PeerID1): {
|
||||
test.PeerID1.String(): {
|
||||
Status: types.TrackerStatusUnpinned,
|
||||
TS: wait.unpinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID2): {
|
||||
test.PeerID2.String(): {
|
||||
Status: types.TrackerStatusUnpinned,
|
||||
TS: wait.unpinStart,
|
||||
},
|
||||
|
@ -682,11 +682,11 @@ func (wait *waitServiceUnpin) Status(ctx context.Context, in types.Cid, out *typ
|
|||
*out = types.GlobalPinInfo{
|
||||
Cid: in,
|
||||
PeerMap: map[string]types.PinInfoShort{
|
||||
peer.Encode(test.PeerID1): {
|
||||
test.PeerID1.String(): {
|
||||
Status: types.TrackerStatusUnpinning,
|
||||
TS: wait.unpinStart,
|
||||
},
|
||||
peer.Encode(test.PeerID2): {
|
||||
test.PeerID2.String(): {
|
||||
Status: types.TrackerStatusUnpinning,
|
||||
TS: wait.unpinStart,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
@ -89,7 +88,7 @@ func (c *defaultClient) doRequest(
|
|||
return c.client.Do(r)
|
||||
}
|
||||
func (c *defaultClient) handleResponse(resp *http.Response, obj interface{}) error {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"time"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
p2phttp "github.com/libp2p/go-libp2p-http"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
noise "github.com/libp2p/go-libp2p/p2p/security/noise"
|
||||
libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls"
|
||||
tcp "github.com/libp2p/go-libp2p/p2p/transport/tcp"
|
||||
|
@ -89,7 +89,7 @@ func (c *defaultClient) enableLibp2p() error {
|
|||
c.transport.RegisterProtocol("libp2p", p2phttp.NewTransport(h))
|
||||
c.net = "libp2p"
|
||||
c.p2p = h
|
||||
c.hostname = peer.Encode(pinfo.ID)
|
||||
c.hostname = pinfo.ID.String()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api/common"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
"github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
mux "github.com/gorilla/mux"
|
||||
)
|
||||
|
@ -850,7 +850,7 @@ func (api *API) repoGCHandler(w http.ResponseWriter, r *http.Request) {
|
|||
func repoGCToGlobal(r types.RepoGC) types.GlobalRepoGC {
|
||||
return types.GlobalRepoGC{
|
||||
PeerMap: map[string]types.RepoGC{
|
||||
peer.Encode(r.Peer): r,
|
||||
r.Peer.String(): r,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package rest
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -14,7 +14,7 @@ import (
|
|||
clustertest "github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
|
@ -247,7 +247,7 @@ func TestAPIAddFileEndpoint_StreamChannelsFalse(t *testing.T) {
|
|||
tf := func(t *testing.T, url test.URLFunc) {
|
||||
body, closer := sth.GetTreeMultiReader(t)
|
||||
defer closer.Close()
|
||||
fullBody, err := ioutil.ReadAll(body)
|
||||
fullBody, err := io.ReadAll(body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -301,10 +301,10 @@ func TestConnectGraphEndpoint(t *testing.T) {
|
|||
// test a few link values
|
||||
pid1 := clustertest.PeerID1
|
||||
pid4 := clustertest.PeerID4
|
||||
if _, ok := cg.ClustertoIPFS[peer.Encode(pid1)]; !ok {
|
||||
if _, ok := cg.ClustertoIPFS[pid1.String()]; !ok {
|
||||
t.Fatal("missing cluster peer 1 from cluster to peer links map")
|
||||
}
|
||||
if cg.ClustertoIPFS[peer.Encode(pid1)] != pid4 {
|
||||
if cg.ClustertoIPFS[pid1.String()] != pid4 {
|
||||
t.Error("unexpected ipfs peer mapped to cluster peer 1 in graph")
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ func TestAPIStatusAllEndpoint(t *testing.T) {
|
|||
// mockPinTracker returns 3 items for Cluster.StatusAll
|
||||
if len(resp) != 3 ||
|
||||
!resp[0].Cid.Equals(clustertest.Cid1) ||
|
||||
resp[1].PeerMap[peer.Encode(clustertest.PeerID1)].Status.String() != "pinning" {
|
||||
resp[1].PeerMap[clustertest.PeerID1.String()].Status.String() != "pinning" {
|
||||
t.Errorf("unexpected statusAll resp")
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ func TestAPIStatusEndpoint(t *testing.T) {
|
|||
if !resp.Cid.Equals(clustertest.Cid1) {
|
||||
t.Error("expected the same cid")
|
||||
}
|
||||
info, ok := resp.PeerMap[peer.Encode(clustertest.PeerID1)]
|
||||
info, ok := resp.PeerMap[clustertest.PeerID1.String()]
|
||||
if !ok {
|
||||
t.Fatal("expected info for clustertest.PeerID1")
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ func TestAPIStatusEndpoint(t *testing.T) {
|
|||
if !resp2.Cid.Equals(clustertest.Cid1) {
|
||||
t.Error("expected the same cid")
|
||||
}
|
||||
info, ok = resp2.PeerMap[peer.Encode(clustertest.PeerID2)]
|
||||
info, ok = resp2.PeerMap[clustertest.PeerID2.String()]
|
||||
if !ok {
|
||||
t.Fatal("expected info for clustertest.PeerID2")
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ func TestAPIRecoverEndpoint(t *testing.T) {
|
|||
if !resp.Cid.Equals(clustertest.Cid1) {
|
||||
t.Error("expected the same cid")
|
||||
}
|
||||
info, ok := resp.PeerMap[peer.Encode(clustertest.PeerID1)]
|
||||
info, ok := resp.PeerMap[clustertest.PeerID1.String()]
|
||||
if !ok {
|
||||
t.Fatal("expected info for clustertest.PeerID1")
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
protocol "github.com/libp2p/go-libp2p-core/protocol"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
protocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||
multiaddr "github.com/multiformats/go-multiaddr"
|
||||
|
||||
// needed to parse /ws multiaddresses
|
||||
|
@ -385,7 +385,7 @@ func (gpi *GlobalPinInfo) Add(pi PinInfo) {
|
|||
gpi.PeerMap = make(map[string]PinInfoShort)
|
||||
}
|
||||
|
||||
gpi.PeerMap[peer.Encode(pi.Peer)] = pi.PinInfoShort
|
||||
gpi.PeerMap[pi.Peer.String()] = pi.PinInfoShort
|
||||
}
|
||||
|
||||
// Defined returns if the object is not empty.
|
||||
|
@ -576,17 +576,19 @@ type IPFSID struct {
|
|||
// A sharded Pin would look like:
|
||||
//
|
||||
// [ Meta ] (not pinned on IPFS, only present in cluster state)
|
||||
// |
|
||||
// v
|
||||
//
|
||||
// |
|
||||
// v
|
||||
//
|
||||
// [ Cluster DAG ] (pinned everywhere in "direct")
|
||||
// | .. |
|
||||
// v v
|
||||
//
|
||||
// | .. |
|
||||
// v v
|
||||
//
|
||||
// [Shard1] .. [ShardN] (allocated to peers and pinned with max-depth=1
|
||||
// | | .. | | | .. |
|
||||
// v v .. v v v .. v
|
||||
// [][]..[] [][]..[] Blocks (indirectly pinned on ipfs, not tracked in cluster)
|
||||
//
|
||||
//
|
||||
type PinType uint64
|
||||
|
||||
// PinType values. See PinType documentation for further explanation.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
multiaddr "github.com/multiformats/go-multiaddr"
|
||||
|
||||
"github.com/ugorji/go/codec"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// PeersToStrings Encodes a list of peers.
|
||||
|
@ -9,7 +9,7 @@ func PeersToStrings(peers []peer.ID) []string {
|
|||
strs := make([]string, len(peers))
|
||||
for i, p := range peers {
|
||||
if p != "" {
|
||||
strs[i] = peer.Encode(p)
|
||||
strs[i] = p.String()
|
||||
}
|
||||
}
|
||||
return strs
|
||||
|
|
|
@ -21,11 +21,11 @@ import (
|
|||
"go.uber.org/multierr"
|
||||
|
||||
ds "github.com/ipfs/go-datastore"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
mdns "github.com/libp2p/go-libp2p/p2p/discovery/mdns"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
|
@ -1131,7 +1131,7 @@ func (c *Cluster) distances(ctx context.Context, exclude peer.ID) (*distanceChec
|
|||
// StateSync performs maintenance tasks on the global state that require
|
||||
// looping through all the items. It is triggered automatically on
|
||||
// StateSyncInterval. Currently it:
|
||||
// * Sends unpin for expired items for which this peer is "closest"
|
||||
// - Sends unpin for expired items for which this peer is "closest"
|
||||
// (skipped for follower peers)
|
||||
func (c *Cluster) StateSync(ctx context.Context) error {
|
||||
_, span := trace.StartSpan(ctx, "cluster/StateSync")
|
||||
|
@ -2262,7 +2262,7 @@ func (c *Cluster) RepoGC(ctx context.Context) (api.GlobalRepoGC, error) {
|
|||
&repoGC,
|
||||
)
|
||||
if err == nil {
|
||||
globalRepoGC.PeerMap[peer.Encode(member)] = repoGC
|
||||
globalRepoGC.PeerMap[member.String()] = repoGC
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -2275,7 +2275,7 @@ func (c *Cluster) RepoGC(ctx context.Context) (api.GlobalRepoGC, error) {
|
|||
|
||||
pv := pingValueFromMetric(c.monitor.LatestForPeer(c.ctx, pingMetricName, member))
|
||||
|
||||
globalRepoGC.PeerMap[peer.Encode(member)] = api.RepoGC{
|
||||
globalRepoGC.PeerMap[member.String()] = api.RepoGC{
|
||||
Peer: member,
|
||||
Peername: pv.Peername,
|
||||
Keys: []api.IPFSRepoGC{},
|
||||
|
|
|
@ -13,8 +13,7 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/config"
|
||||
|
||||
ipfsconfig "github.com/ipfs/go-ipfs-config"
|
||||
pnet "github.com/libp2p/go-libp2p-core/pnet"
|
||||
pnet "github.com/libp2p/go-libp2p/core/pnet"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
|
@ -175,7 +174,7 @@ type configJSON struct {
|
|||
PrivateKey string `json:"private_key,omitempty" hidden:"true"`
|
||||
Secret string `json:"secret" hidden:"true"`
|
||||
LeaveOnShutdown bool `json:"leave_on_shutdown"`
|
||||
ListenMultiaddress ipfsconfig.Strings `json:"listen_multiaddress"`
|
||||
ListenMultiaddress config.Strings `json:"listen_multiaddress"`
|
||||
EnableRelayHop bool `json:"enable_relay_hop"`
|
||||
ConnectionManager *connMgrConfigJSON `json:"connection_manager"`
|
||||
DialPeerTimeout string `json:"dial_peer_timeout"`
|
||||
|
@ -503,11 +502,11 @@ func (cfg *Config) toConfigJSON() (jcfg *configJSON, err error) {
|
|||
jcfg.ReplicationFactorMin = cfg.ReplicationFactorMin
|
||||
jcfg.ReplicationFactorMax = cfg.ReplicationFactorMax
|
||||
jcfg.LeaveOnShutdown = cfg.LeaveOnShutdown
|
||||
var listenAddrs ipfsconfig.Strings
|
||||
var listenAddrs config.Strings
|
||||
for _, addr := range cfg.ListenAddr {
|
||||
listenAddrs = append(listenAddrs, addr.String())
|
||||
}
|
||||
jcfg.ListenMultiaddress = ipfsconfig.Strings(listenAddrs)
|
||||
jcfg.ListenMultiaddress = config.Strings(listenAddrs)
|
||||
jcfg.EnableRelayHop = cfg.EnableRelayHop
|
||||
jcfg.ConnectionManager = &connMgrConfigJSON{
|
||||
HighWater: cfg.ConnMgr.HighWater,
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
ipfsconfig "github.com/ipfs/go-ipfs-config"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/config"
|
||||
)
|
||||
|
||||
var ccfgTestJSON = []byte(`
|
||||
|
@ -134,7 +134,7 @@ func TestLoadJSON(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("bad listen multiaddress", func(t *testing.T) {
|
||||
_, err := loadJSON2(t, func(j *configJSON) { j.ListenMultiaddress = ipfsconfig.Strings{"abc"} })
|
||||
_, err := loadJSON2(t, func(j *configJSON) { j.ListenMultiaddress = config.Strings{"abc"} })
|
||||
if err == nil {
|
||||
t.Error("expected error parsing listen_multiaddress")
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/version"
|
||||
|
||||
gopath "github.com/ipfs/go-path"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ import (
|
|||
namespace "github.com/ipfs/go-datastore/namespace"
|
||||
ipns "github.com/ipfs/go-ipns"
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
network "github.com/libp2p/go-libp2p-core/network"
|
||||
corepnet "github.com/libp2p/go-libp2p-core/pnet"
|
||||
routing "github.com/libp2p/go-libp2p-core/routing"
|
||||
crypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
network "github.com/libp2p/go-libp2p/core/network"
|
||||
corepnet "github.com/libp2p/go-libp2p/core/pnet"
|
||||
routing "github.com/libp2p/go-libp2p/core/routing"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
|
|
|
@ -11,8 +11,6 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
)
|
||||
|
||||
|
@ -270,7 +268,7 @@ func textFormatPrintMetric(obj api.Metric) {
|
|||
v = humanize.Bytes(uint64(obj.Weight))
|
||||
}
|
||||
|
||||
fmt.Printf("%s | %s: %s | Expires in: %s\n", peer.Encode(obj.Peer), obj.Name, v, humanize.Time(time.Unix(0, obj.Expire)))
|
||||
fmt.Printf("%s | %s: %s | Expires in: %s\n", obj.Peer, obj.Name, v, humanize.Time(time.Unix(0, obj.Expire)))
|
||||
}
|
||||
|
||||
func textFormatPrintAlert(obj api.Alert) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"sort"
|
||||
|
||||
dot "github.com/kishansagathiya/go-dot"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
)
|
||||
|
@ -45,8 +45,7 @@ func makeDot(cg api.ConnectGraph, w io.Writer, allIpfs bool) error {
|
|||
for k, v := range cg.IPFSLinks {
|
||||
ipfsEdges[k] = make([]peer.ID, 0)
|
||||
for _, id := range v {
|
||||
strPid := peer.Encode(id)
|
||||
|
||||
strPid := id.String()
|
||||
if _, ok := cg.IPFSLinks[strPid]; ok || allIpfs {
|
||||
ipfsEdges[k] = append(ipfsEdges[k], id)
|
||||
}
|
||||
|
@ -63,7 +62,7 @@ func makeDot(cg api.ConnectGraph, w io.Writer, allIpfs bool) error {
|
|||
dW := dotWriter{
|
||||
w: w,
|
||||
dotGraph: dot.NewGraph("cluster"),
|
||||
self: peer.Encode(cg.ClusterID),
|
||||
self: cg.ClusterID.String(),
|
||||
trustMap: cg.ClusterTrustLinks,
|
||||
idToPeername: cg.IDtoPeername,
|
||||
ipfsEdges: ipfsEdges,
|
||||
|
@ -205,7 +204,7 @@ func (dW *dotWriter) print() error {
|
|||
v := dW.clusterEdges[k]
|
||||
for _, id := range v {
|
||||
toNode := dW.clusterNodes[k]
|
||||
fromNode := dW.clusterNodes[peer.Encode(id)]
|
||||
fromNode := dW.clusterNodes[id.String()]
|
||||
dW.dotGraph.AddEdge(toNode, fromNode, true, "")
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +226,7 @@ func (dW *dotWriter) print() error {
|
|||
continue
|
||||
}
|
||||
|
||||
fromNode, ok = dW.ipfsNodes[peer.Encode(ipfsID)]
|
||||
fromNode, ok = dW.ipfsNodes[ipfsID.String()]
|
||||
if !ok {
|
||||
logger.Error("expected a node at this id")
|
||||
continue
|
||||
|
@ -242,7 +241,7 @@ func (dW *dotWriter) print() error {
|
|||
v := dW.ipfsEdges[k]
|
||||
toNode := dW.ipfsNodes[k]
|
||||
for _, id := range v {
|
||||
idStr := peer.Encode(id)
|
||||
idStr := id.String()
|
||||
fromNode, ok := dW.ipfsNodes[idStr]
|
||||
if !ok {
|
||||
logger.Error("expected a node here")
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
func verifyOutput(t *testing.T, outStr string, trueStr string) {
|
||||
|
@ -83,37 +83,37 @@ func TestSimpleIpfsGraphs(t *testing.T) {
|
|||
cg := api.ConnectGraph{
|
||||
ClusterID: pid1,
|
||||
ClusterLinks: map[string][]peer.ID{
|
||||
peer.Encode(pid1): {
|
||||
pid1.String(): {
|
||||
pid2,
|
||||
pid3,
|
||||
},
|
||||
peer.Encode(pid2): {
|
||||
pid2.String(): {
|
||||
pid1,
|
||||
pid3,
|
||||
},
|
||||
peer.Encode(pid3): {
|
||||
pid3.String(): {
|
||||
pid1,
|
||||
pid2,
|
||||
},
|
||||
},
|
||||
IPFSLinks: map[string][]peer.ID{
|
||||
peer.Encode(pid4): {
|
||||
pid4.String(): {
|
||||
pid5,
|
||||
pid6,
|
||||
},
|
||||
peer.Encode(pid5): {
|
||||
pid5.String(): {
|
||||
pid4,
|
||||
pid6,
|
||||
},
|
||||
peer.Encode(pid6): {
|
||||
pid6.String(): {
|
||||
pid4,
|
||||
pid5,
|
||||
},
|
||||
},
|
||||
ClustertoIPFS: map[string]peer.ID{
|
||||
peer.Encode(pid1): pid4,
|
||||
peer.Encode(pid2): pid5,
|
||||
peer.Encode(pid3): pid6,
|
||||
pid1.String(): pid4,
|
||||
pid2.String(): pid5,
|
||||
pid3.String(): pid6,
|
||||
},
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
|
@ -181,35 +181,35 @@ func TestIpfsAllGraphs(t *testing.T) {
|
|||
cg := api.ConnectGraph{
|
||||
ClusterID: pid1,
|
||||
ClusterLinks: map[string][]peer.ID{
|
||||
peer.Encode(pid1): {
|
||||
pid1.String(): {
|
||||
pid2,
|
||||
pid3,
|
||||
},
|
||||
peer.Encode(pid2): {
|
||||
pid2.String(): {
|
||||
pid1,
|
||||
pid3,
|
||||
},
|
||||
peer.Encode(pid3): {
|
||||
pid3.String(): {
|
||||
pid1,
|
||||
pid2,
|
||||
},
|
||||
},
|
||||
IPFSLinks: map[string][]peer.ID{
|
||||
peer.Encode(pid4): {
|
||||
pid4.String(): {
|
||||
pid5,
|
||||
pid6,
|
||||
pid7,
|
||||
pid8,
|
||||
pid9,
|
||||
},
|
||||
peer.Encode(pid5): {
|
||||
pid5.String(): {
|
||||
pid4,
|
||||
pid6,
|
||||
pid7,
|
||||
pid8,
|
||||
pid9,
|
||||
},
|
||||
peer.Encode(pid6): {
|
||||
pid6.String(): {
|
||||
pid4,
|
||||
pid5,
|
||||
pid7,
|
||||
|
@ -218,9 +218,9 @@ func TestIpfsAllGraphs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
ClustertoIPFS: map[string]peer.ID{
|
||||
peer.Encode(pid1): pid4,
|
||||
peer.Encode(pid2): pid5,
|
||||
peer.Encode(pid3): pid6,
|
||||
pid1.String(): pid4,
|
||||
pid2.String(): pid5,
|
||||
pid3.String(): pid6,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api/rest/client"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
uuid "github.com/google/uuid"
|
||||
|
|
|
@ -24,8 +24,8 @@ import (
|
|||
"go.opencensus.io/tag"
|
||||
|
||||
ds "github.com/ipfs/go-datastore"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/cmdutils"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/pstoremgr"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/version"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
semver "github.com/blang/semver"
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/ipfs/go-datastore"
|
||||
ipfscluster "github.com/ipfs-cluster/ipfs-cluster"
|
||||
ipfshttp "github.com/ipfs-cluster/ipfs-cluster/ipfsconn/ipfshttp"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
"github.com/pkg/errors"
|
||||
|
|
|
@ -8,8 +8,9 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -347,7 +348,7 @@ func (cfg *Manager) Validate() error {
|
|||
func (cfg *Manager) LoadJSONFromFile(path string) error {
|
||||
cfg.path = path
|
||||
|
||||
file, err := ioutil.ReadFile(path)
|
||||
file, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
logger.Error("error reading the configuration file: ", err)
|
||||
return err
|
||||
|
@ -365,7 +366,7 @@ func (cfg *Manager) LoadJSONFromHTTPSource(url string) error {
|
|||
return fmt.Errorf("%w: %s", errFetchingSource, url)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -489,7 +490,7 @@ func (cfg *Manager) SaveJSON(path string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(cfg.path, bs, 0600)
|
||||
return os.WriteFile(cfg.path, bs, 0600)
|
||||
}
|
||||
|
||||
// ToJSON provides a JSON representation of the configuration by
|
||||
|
@ -612,7 +613,7 @@ func (cfg *Manager) IsLoadedFromJSON(t SectionType, name string) bool {
|
|||
// GetClusterConfig extracts cluster config from the configuration file
|
||||
// and returns bytes of it
|
||||
func GetClusterConfig(configPath string) ([]byte, error) {
|
||||
file, err := ioutil.ReadFile(configPath)
|
||||
file, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
logger.Error("error reading the configuration file: ", err)
|
||||
return nil, err
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
crypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
)
|
||||
|
@ -77,7 +77,7 @@ func (ident *Identity) SaveJSON(path string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(path, bs, 0600)
|
||||
return os.WriteFile(path, bs, 0600)
|
||||
}
|
||||
|
||||
// ToJSON generates a human-friendly version of Identity.
|
||||
|
@ -164,7 +164,7 @@ func (ident *Identity) Validate() error {
|
|||
// LoadJSONFromFile reads an Identity file from disk and parses
|
||||
// it and return Identity.
|
||||
func (ident *Identity) LoadJSONFromFile(path string) error {
|
||||
file, err := ioutil.ReadFile(path)
|
||||
file, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
logger.Error("error reading the configuration file: ", err)
|
||||
return err
|
||||
|
|
|
@ -182,3 +182,39 @@ func DisplayJSON(cfg interface{}) ([]byte, error) {
|
|||
}
|
||||
return DefaultJSONMarshal(data)
|
||||
}
|
||||
|
||||
// Strings is a helper type that (un)marshals a single string to/from a single
|
||||
// JSON string and a slice of strings to/from a JSON array of strings.
|
||||
type Strings []string
|
||||
|
||||
// UnmarshalJSON conforms to the json.Unmarshaler interface.
|
||||
func (o *Strings) UnmarshalJSON(data []byte) error {
|
||||
if data[0] == '[' {
|
||||
return json.Unmarshal(data, (*[]string)(o))
|
||||
}
|
||||
var value string
|
||||
if err := json.Unmarshal(data, &value); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(value) == 0 {
|
||||
*o = []string{}
|
||||
} else {
|
||||
*o = []string{value}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON conforms to the json.Marshaler interface.
|
||||
func (o Strings) MarshalJSON() ([]byte, error) {
|
||||
switch len(o) {
|
||||
case 0:
|
||||
return json.Marshal(nil)
|
||||
case 1:
|
||||
return json.Marshal(o[0])
|
||||
default:
|
||||
return json.Marshal([]string(o))
|
||||
}
|
||||
}
|
||||
|
||||
var _ json.Unmarshaler = (*Strings)(nil)
|
||||
var _ json.Marshaler = (*Strings)(nil)
|
||||
|
|
|
@ -3,7 +3,7 @@ package ipfscluster
|
|||
import (
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ func (c *Cluster) ConnectGraph() (api.ConnectGraph, error) {
|
|||
|
||||
for _, member := range members {
|
||||
// one of the entries is for itself, but that shouldn't hurt
|
||||
cg.ClusterTrustLinks[peer.Encode(member)] = c.consensus.IsTrustedPeer(ctx, member)
|
||||
cg.ClusterTrustLinks[member.String()] = c.consensus.IsTrustedPeer(ctx, member)
|
||||
}
|
||||
|
||||
peers := make([][]api.ID, len(members))
|
||||
|
@ -61,7 +61,7 @@ func (c *Cluster) ConnectGraph() (api.ConnectGraph, error) {
|
|||
}
|
||||
|
||||
for i, err := range errs {
|
||||
p := peer.Encode(members[i])
|
||||
p := members[i].String()
|
||||
cg.ClusterLinks[p] = make([]peer.ID, 0)
|
||||
if err != nil { // Only setting cluster connections when no error occurs
|
||||
logger.Debugf("RPC error reaching cluster peer %s: %s", p, err.Error())
|
||||
|
@ -89,7 +89,7 @@ func (c *Cluster) recordClusterLinks(cg *api.ConnectGraph, p string, peers []api
|
|||
logger.Debugf("Peer %s errored connecting to its peer %s", p, id.ID.Pretty())
|
||||
continue
|
||||
}
|
||||
if peer.Encode(id.ID) == p {
|
||||
if id.ID.String() == p {
|
||||
selfConnection = true
|
||||
pID = id
|
||||
} else {
|
||||
|
@ -106,8 +106,8 @@ func (c *Cluster) recordIPFSLinks(cg *api.ConnectGraph, pID api.ID) {
|
|||
return
|
||||
}
|
||||
|
||||
pid := peer.Encode(pID.ID)
|
||||
ipfsPid := peer.Encode(ipfsID)
|
||||
pid := pID.ID.String()
|
||||
ipfsPid := ipfsID.String()
|
||||
|
||||
if _, ok := cg.IPFSLinks[pid]; ok {
|
||||
logger.Warnf("ipfs id: %s already recorded, one ipfs daemon in use by multiple cluster peers", ipfsID.Pretty())
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/config"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
)
|
||||
|
|
|
@ -21,10 +21,10 @@ import (
|
|||
crdt "github.com/ipfs/go-ds-crdt"
|
||||
dshelp "github.com/ipfs/go-ipfs-ds-help"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
"github.com/libp2p/go-libp2p-core/routing"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
"github.com/libp2p/go-libp2p/core/routing"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
multihash "github.com/multiformats/go-multihash"
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
ipns "github.com/ipfs/go-ipns"
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
|
|
|
@ -3,14 +3,14 @@ package raft
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/config"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
hraft "github.com/hashicorp/raft"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
|
@ -288,7 +288,7 @@ func (cfg *Config) Default() error {
|
|||
cfg.RaftConfig.LocalID = "will_be_set_automatically"
|
||||
|
||||
// Set up logging
|
||||
cfg.RaftConfig.LogOutput = ioutil.Discard
|
||||
cfg.RaftConfig.LogOutput = io.Discard
|
||||
cfg.RaftConfig.Logger = &hcLogToLogger{}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ import (
|
|||
ds "github.com/ipfs/go-datastore"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
consensus "github.com/libp2p/go-libp2p-consensus"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
libp2praft "github.com/libp2p/go-libp2p-raft"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"go.opencensus.io/tag"
|
||||
"go.opencensus.io/trace"
|
||||
|
@ -410,7 +410,7 @@ func (cc *Consensus) AddPeer(ctx context.Context, pid peer.ID) error {
|
|||
}
|
||||
// Being here means we are the leader and can commit
|
||||
cc.shutdownLock.RLock() // do not shutdown while committing
|
||||
finalErr = cc.raft.AddPeer(ctx, peer.Encode(pid))
|
||||
finalErr = cc.raft.AddPeer(ctx, pid.String())
|
||||
|
||||
cc.shutdownLock.RUnlock()
|
||||
if finalErr != nil {
|
||||
|
@ -441,7 +441,7 @@ func (cc *Consensus) RmPeer(ctx context.Context, pid peer.ID) error {
|
|||
}
|
||||
// Being here means we are the leader and can commit
|
||||
cc.shutdownLock.RLock() // do not shutdown while committing
|
||||
finalErr = cc.raft.RemovePeer(ctx, peer.Encode(pid))
|
||||
finalErr = cc.raft.RemovePeer(ctx, pid.String())
|
||||
cc.shutdownLock.RUnlock()
|
||||
if finalErr != nil {
|
||||
time.Sleep(cc.config.CommitRetryDelay)
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
)
|
||||
|
||||
func cleanRaft(idn int) {
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/state"
|
||||
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
p2praft "github.com/libp2p/go-libp2p-raft"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
hraft "github.com/hashicorp/raft"
|
||||
raftboltdb "github.com/hashicorp/raft-boltdb"
|
||||
|
@ -74,7 +74,7 @@ func newRaftWrapper(
|
|||
raftW.host = host
|
||||
raftW.staging = staging
|
||||
// Set correct LocalID
|
||||
cfg.RaftConfig.LocalID = hraft.ServerID(peer.Encode(host.ID()))
|
||||
cfg.RaftConfig.LocalID = hraft.ServerID(host.ID().String())
|
||||
|
||||
df := cfg.GetDataFolder()
|
||||
err := makeDataFolder(df)
|
||||
|
@ -231,7 +231,7 @@ func makeServerConf(peers []peer.ID) hraft.Configuration {
|
|||
|
||||
// Servers are peers + self. We avoid duplicate entries below
|
||||
for _, pid := range peers {
|
||||
p := peer.Encode(pid)
|
||||
p := pid.String()
|
||||
_, ok := sm[p]
|
||||
if !ok { // avoid dups
|
||||
sm[p] = struct{}{}
|
||||
|
@ -273,7 +273,7 @@ func (rw *raftWrapper) WaitForVoter(ctx context.Context) error {
|
|||
|
||||
logger.Debug("waiting until we are promoted to a voter")
|
||||
|
||||
pid := hraft.ServerID(peer.Encode(rw.host.ID()))
|
||||
pid := hraft.ServerID(rw.host.ID().String())
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
|
|
@ -2,7 +2,7 @@ module github.com/ipfs-cluster/ipfs-cluster
|
|||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/jaeger v0.2.1
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.1
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.2
|
||||
github.com/blang/semver v3.5.1+incompatible
|
||||
github.com/coreos/go-systemd/v22 v22.3.2
|
||||
github.com/dgraph-io/badger v1.6.2
|
||||
|
@ -11,87 +11,81 @@ require (
|
|||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/hashicorp/go-hclog v1.2.1
|
||||
github.com/hashicorp/go-hclog v1.3.0
|
||||
github.com/hashicorp/raft v1.1.1
|
||||
github.com/hashicorp/raft-boltdb v0.0.0-20190605210249-ef2e128ed477
|
||||
github.com/hsanjuan/ipfs-lite v1.4.1
|
||||
github.com/hsanjuan/ipfs-lite v1.4.2
|
||||
github.com/imdario/mergo v0.3.13
|
||||
github.com/ipfs/go-block-format v0.0.3
|
||||
github.com/ipfs/go-cid v0.2.0
|
||||
github.com/ipfs/go-datastore v0.5.1
|
||||
github.com/ipfs/go-cid v0.3.2
|
||||
github.com/ipfs/go-datastore v0.6.0
|
||||
github.com/ipfs/go-ds-badger v0.3.0
|
||||
github.com/ipfs/go-ds-crdt v0.3.6
|
||||
github.com/ipfs/go-ds-crdt v0.3.7
|
||||
github.com/ipfs/go-ds-leveldb v0.5.0
|
||||
github.com/ipfs/go-fs-lock v0.0.7
|
||||
github.com/ipfs/go-ipfs-api v0.3.0
|
||||
github.com/ipfs/go-ipfs-chunker v0.0.5
|
||||
github.com/ipfs/go-ipfs-cmds v0.6.0
|
||||
github.com/ipfs/go-ipfs-config v0.19.0
|
||||
github.com/ipfs/go-ipfs-ds-help v1.1.0
|
||||
github.com/ipfs/go-ipfs-files v0.1.1
|
||||
github.com/ipfs/go-ipfs-pinner v0.2.1
|
||||
github.com/ipfs/go-ipfs-posinfo v0.0.1
|
||||
github.com/ipfs/go-ipld-cbor v0.0.6
|
||||
github.com/ipfs/go-ipld-format v0.4.0
|
||||
github.com/ipfs/go-ipns v0.1.2
|
||||
github.com/ipfs/go-ipns v0.2.0
|
||||
github.com/ipfs/go-log/v2 v2.5.1
|
||||
github.com/ipfs/go-merkledag v0.6.0
|
||||
github.com/ipfs/go-merkledag v0.7.0
|
||||
github.com/ipfs/go-mfs v0.1.3-0.20210507195338-96fbfa122164
|
||||
github.com/ipfs/go-path v0.3.0
|
||||
github.com/ipfs/go-unixfs v0.4.0
|
||||
github.com/ipld/go-car v0.4.0
|
||||
github.com/ipld/go-car v0.5.0
|
||||
github.com/kelseyhightower/envconfig v1.4.0
|
||||
github.com/kishansagathiya/go-dot v0.1.0
|
||||
github.com/lanzafame/go-libp2p-ocgorpc v0.1.1
|
||||
github.com/libp2p/go-libp2p v0.20.1
|
||||
github.com/libp2p/go-libp2p v0.22.0
|
||||
github.com/libp2p/go-libp2p-consensus v0.0.1
|
||||
github.com/libp2p/go-libp2p-core v0.16.1
|
||||
github.com/libp2p/go-libp2p-gorpc v0.4.0
|
||||
github.com/libp2p/go-libp2p-gostream v0.4.0
|
||||
github.com/libp2p/go-libp2p-http v0.3.0
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.16.0
|
||||
github.com/libp2p/go-libp2p-peerstore v0.6.0
|
||||
github.com/libp2p/go-libp2p-pubsub v0.7.0
|
||||
github.com/libp2p/go-libp2p-raft v0.1.8
|
||||
github.com/libp2p/go-libp2p-record v0.1.3
|
||||
github.com/libp2p/go-libp2p-gorpc v0.5.0
|
||||
github.com/libp2p/go-libp2p-gostream v0.5.0
|
||||
github.com/libp2p/go-libp2p-http v0.4.0
|
||||
github.com/libp2p/go-libp2p-kad-dht v0.18.0
|
||||
github.com/libp2p/go-libp2p-pubsub v0.8.0
|
||||
github.com/libp2p/go-libp2p-raft v0.2.0
|
||||
github.com/libp2p/go-libp2p-record v0.2.0
|
||||
github.com/multiformats/go-multiaddr v0.6.0
|
||||
github.com/multiformats/go-multiaddr-dns v0.3.1
|
||||
github.com/multiformats/go-multicodec v0.5.0
|
||||
github.com/multiformats/go-multihash v0.2.0
|
||||
github.com/multiformats/go-multicodec v0.6.0
|
||||
github.com/multiformats/go-multihash v0.2.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.12.2
|
||||
github.com/prometheus/client_golang v1.13.0
|
||||
github.com/rs/cors v1.8.2
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
|
||||
github.com/ugorji/go/codec v1.2.7
|
||||
github.com/urfave/cli v1.22.9
|
||||
github.com/urfave/cli/v2 v2.10.2
|
||||
github.com/urfave/cli v1.22.10
|
||||
github.com/urfave/cli/v2 v2.14.1
|
||||
go.opencensus.io v0.23.0
|
||||
go.uber.org/multierr v1.8.0
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
|
||||
google.golang.org/protobuf v1.28.0
|
||||
google.golang.org/protobuf v1.28.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
|
||||
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
|
||||
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect
|
||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/boltdb/bolt v1.3.1 // indirect
|
||||
github.com/btcsuite/btcd v0.22.1 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/cespare/xxhash v1.1.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cheekybits/genny v1.0.0 // indirect
|
||||
github.com/containerd/cgroups v1.0.3 // indirect
|
||||
github.com/containerd/cgroups v1.0.4 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
|
||||
github.com/cskr/pubsub v1.0.2 // indirect
|
||||
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
|
||||
github.com/dgraph-io/ristretto v0.0.2 // indirect
|
||||
github.com/docker/go-units v0.4.0 // indirect
|
||||
github.com/elastic/gosigar v0.14.2 // indirect
|
||||
|
@ -99,9 +93,11 @@ require (
|
|||
github.com/felixge/httpsnoop v1.0.1 // indirect
|
||||
github.com/flynn/noise v1.0.0 // indirect
|
||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/go-kit/log v0.2.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
|
@ -118,14 +114,14 @@ require (
|
|||
github.com/huin/goupnp v1.0.3 // indirect
|
||||
github.com/ipfs/bbloom v0.0.4 // indirect
|
||||
github.com/ipfs/go-bitfield v1.0.0 // indirect
|
||||
github.com/ipfs/go-bitswap v0.7.0 // indirect
|
||||
github.com/ipfs/go-blockservice v0.3.0 // indirect
|
||||
github.com/ipfs/go-bitswap v0.10.0 // indirect
|
||||
github.com/ipfs/go-blockservice v0.4.0 // indirect
|
||||
github.com/ipfs/go-cidutil v0.1.0 // indirect
|
||||
github.com/ipfs/go-fetcher v1.6.1 // indirect
|
||||
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
|
||||
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
|
||||
github.com/ipfs/go-ipfs-exchange-interface v0.1.0 // indirect
|
||||
github.com/ipfs/go-ipfs-exchange-offline v0.2.0 // indirect
|
||||
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
|
||||
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 // indirect
|
||||
github.com/ipfs/go-ipfs-pq v0.0.2 // indirect
|
||||
github.com/ipfs/go-ipfs-provider v0.7.1 // indirect
|
||||
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
|
||||
|
@ -134,42 +130,39 @@ require (
|
|||
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
|
||||
github.com/ipfs/go-peertaskqueue v0.7.0 // indirect
|
||||
github.com/ipfs/go-verifcid v0.0.1 // indirect
|
||||
github.com/ipfs/interface-go-ipfs-core v0.7.0 // indirect
|
||||
github.com/ipld/go-codec-dagpb v1.3.2 // indirect
|
||||
github.com/ipld/go-ipld-prime v0.16.0 // indirect
|
||||
github.com/ipld/go-codec-dagpb v1.5.0 // indirect
|
||||
github.com/ipld/go-ipld-prime v0.18.0 // indirect
|
||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
||||
github.com/klauspost/compress v1.15.1 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
|
||||
github.com/koron/go-ssdp v0.0.2 // indirect
|
||||
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
|
||||
github.com/koron/go-ssdp v0.0.3 // indirect
|
||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
||||
github.com/libp2p/go-cidranger v1.1.0 // indirect
|
||||
github.com/libp2p/go-eventbus v0.2.1 // indirect
|
||||
github.com/libp2p/go-flow-metrics v0.0.3 // indirect
|
||||
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||
github.com/libp2p/go-libp2p-connmgr v0.3.2-0.20220117144143-6ab8f6c9e796 // indirect
|
||||
github.com/libp2p/go-libp2p-discovery v0.6.0 // indirect
|
||||
github.com/libp2p/go-libp2p-core v0.20.0 // indirect
|
||||
github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect
|
||||
github.com/libp2p/go-libp2p-loggables v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p-resource-manager v0.3.0 // indirect
|
||||
github.com/libp2p/go-libp2p-routing-helpers v0.2.3 // indirect
|
||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||
github.com/libp2p/go-openssl v0.0.7 // indirect
|
||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||
github.com/libp2p/go-reuseport v0.2.0 // indirect
|
||||
github.com/libp2p/go-yamux/v3 v3.1.2 // indirect
|
||||
github.com/libp2p/zeroconf/v2 v2.1.1 // indirect
|
||||
github.com/lucas-clemente/quic-go v0.27.1 // indirect
|
||||
github.com/libp2p/zeroconf/v2 v2.2.0 // indirect
|
||||
github.com/lucas-clemente/quic-go v0.28.1 // indirect
|
||||
github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect
|
||||
github.com/marten-seemann/qtls-go1-17 v0.1.1 // indirect
|
||||
github.com/marten-seemann/qtls-go1-18 v0.1.1 // indirect
|
||||
github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect
|
||||
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
|
||||
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
|
||||
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/miekg/dns v1.1.48 // indirect
|
||||
github.com/miekg/dns v1.1.50 // indirect
|
||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
|
||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||
|
@ -178,8 +171,8 @@ require (
|
|||
github.com/multiformats/go-base32 v0.0.4 // indirect
|
||||
github.com/multiformats/go-base36 v0.1.0 // indirect
|
||||
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
|
||||
github.com/multiformats/go-multibase v0.0.3 // indirect
|
||||
github.com/multiformats/go-multistream v0.3.1 // indirect
|
||||
github.com/multiformats/go-multibase v0.1.1 // indirect
|
||||
github.com/multiformats/go-multistream v0.3.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.6 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
|
@ -188,11 +181,10 @@ require (
|
|||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.33.0 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/raulk/clock v1.1.0 // indirect
|
||||
github.com/raulk/go-watchdog v1.2.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.22.7 // indirect
|
||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
|
@ -200,18 +192,19 @@ require (
|
|||
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
|
||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
|
||||
github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c // indirect
|
||||
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
go.opentelemetry.io/otel v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/zap v1.22.0 // indirect
|
||||
go4.org v0.0.0-20200411211856-f5505b9728dd // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
|
||||
golang.org/x/net v0.0.0-20220517181318-183a9ca12b87 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect
|
||||
golang.org/x/tools v0.1.10 // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
|
||||
google.golang.org/api v0.45.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210510173355-fb37daa5cd7a // indirect
|
||||
|
@ -221,4 +214,4 @@ require (
|
|||
lukechampine.com/blake3 v1.1.7 // indirect
|
||||
)
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/state"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -34,13 +34,13 @@ import (
|
|||
|
||||
ds "github.com/ipfs/go-datastore"
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
crypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
routedhost "github.com/libp2p/go-libp2p/p2p/host/routed"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
@ -484,16 +484,16 @@ func runF(t *testing.T, clusters []*Cluster, f func(*testing.T, *Cluster)) {
|
|||
wg.Wait()
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// ////////////////////////////////////
|
||||
// Delay and wait functions
|
||||
//
|
||||
// Delays are used in tests to wait for certain events to happen:
|
||||
// * ttlDelay() waits for metrics to arrive. If you pin something
|
||||
// - ttlDelay() waits for metrics to arrive. If you pin something
|
||||
// and your next operation depends on updated metrics, you need to wait
|
||||
// * pinDelay() accounts for the time necessary to pin something and for the new
|
||||
// - pinDelay() accounts for the time necessary to pin something and for the new
|
||||
// log entry to be visible in all cluster peers
|
||||
// * delay just sleeps a second or two.
|
||||
// * waitForLeader functions make sure there is a raft leader, for example,
|
||||
// - delay just sleeps a second or two.
|
||||
// - waitForLeader functions make sure there is a raft leader, for example,
|
||||
// after killing the leader.
|
||||
//
|
||||
// The values for delays are a result of testing and adjusting so tests pass
|
||||
|
@ -915,7 +915,7 @@ func TestClustersStatusAll(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
pid := peer.Encode(c.host.ID())
|
||||
pid := c.host.ID().String()
|
||||
if info[pid].Status != api.TrackerStatusPinned {
|
||||
t.Error("the hash should have been pinned")
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ func TestClustersStatusAllWithErrors(t *testing.T) {
|
|||
t.Error("bad number of peers in status")
|
||||
}
|
||||
|
||||
pid := peer.Encode(clusters[1].id)
|
||||
pid := clusters[1].id.String()
|
||||
errst := stts.PeerMap[pid]
|
||||
|
||||
if errst.Status != api.TrackerStatusClusterError {
|
||||
|
@ -1109,7 +1109,7 @@ func TestClustersRecover(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
pinfo, ok := ginfo.PeerMap[peer.Encode(clusters[j].host.ID())]
|
||||
pinfo, ok := ginfo.PeerMap[clusters[j].host.ID().String()]
|
||||
if !ok {
|
||||
t.Fatal("should have info for this host")
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ func TestClustersRecover(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, c := range clusters {
|
||||
inf, ok := ginfo.PeerMap[peer.Encode(c.host.ID())]
|
||||
inf, ok := ginfo.PeerMap[c.host.ID().String()]
|
||||
if !ok {
|
||||
t.Fatal("GlobalPinInfo should not be empty for this host")
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ func TestClustersRecover(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, c := range clusters {
|
||||
inf, ok := ginfo.PeerMap[peer.Encode(c.host.ID())]
|
||||
inf, ok := ginfo.PeerMap[c.host.ID().String()]
|
||||
if !ok {
|
||||
t.Fatal("GlobalPinInfo should have this cluster")
|
||||
}
|
||||
|
@ -1845,7 +1845,7 @@ func TestClustersRebalanceOnPeerDown(t *testing.T) {
|
|||
|
||||
// kill the local pinner
|
||||
for _, c := range clusters {
|
||||
clid := peer.Encode(c.id)
|
||||
clid := c.id.String()
|
||||
if clid == localPinner {
|
||||
c.Shutdown(ctx)
|
||||
} else if clid == remotePinner {
|
||||
|
@ -1882,7 +1882,7 @@ func validateClusterGraph(t *testing.T, graph api.ConnectGraph, clusterIDs map[s
|
|||
// Make lookup index for peers connected to id1
|
||||
peerIndex := make(map[string]struct{})
|
||||
for _, p := range peers {
|
||||
peerIndex[peer.Encode(p)] = struct{}{}
|
||||
peerIndex[p.String()] = struct{}{}
|
||||
}
|
||||
for id2 := range clusterIDs {
|
||||
if _, ok := peerIndex[id2]; id1 != id2 && !ok {
|
||||
|
@ -1909,7 +1909,7 @@ func validateClusterGraph(t *testing.T, graph api.ConnectGraph, clusterIDs map[s
|
|||
if len(graph.IPFSLinks) != 1 {
|
||||
t.Error("Expected exactly one ipfs peer for all cluster nodes, the mocked peer")
|
||||
}
|
||||
links, ok := graph.IPFSLinks[peer.Encode(test.PeerID1)]
|
||||
links, ok := graph.IPFSLinks[test.PeerID1.String()]
|
||||
if !ok {
|
||||
t.Error("Expected the mocked ipfs peer to be a node in the graph")
|
||||
} else {
|
||||
|
@ -1951,7 +1951,7 @@ func TestClustersGraphConnected(t *testing.T) {
|
|||
|
||||
clusterIDs := make(map[string]struct{})
|
||||
for _, c := range clusters {
|
||||
id := peer.Encode(c.ID(ctx).ID)
|
||||
id := c.ID(ctx).ID.String()
|
||||
clusterIDs[id] = struct{}{}
|
||||
}
|
||||
validateClusterGraph(t, graph, clusterIDs, nClusters)
|
||||
|
@ -2000,7 +2000,7 @@ func TestClustersGraphUnhealthy(t *testing.T) {
|
|||
if i == discon1 || i == discon2 {
|
||||
continue
|
||||
}
|
||||
id := peer.Encode(c.ID(ctx).ID)
|
||||
id := c.ID(ctx).ID.String()
|
||||
clusterIDs[id] = struct{}{}
|
||||
}
|
||||
peerNum := nClusters
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
@ -26,8 +25,8 @@ import (
|
|||
ipfspinner "github.com/ipfs/go-ipfs-pinner"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
gopath "github.com/ipfs/go-path"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
|
@ -672,7 +671,7 @@ func checkResponse(path string, res *http.Response) ([]byte, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
body, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err == nil {
|
||||
var ipfsErr ipfsError
|
||||
|
@ -701,7 +700,7 @@ func (ipfs *Connector) postCtx(ctx context.Context, path string, contentType str
|
|||
}
|
||||
defer rdr.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(rdr)
|
||||
body, err := io.ReadAll(rdr)
|
||||
if err != nil {
|
||||
logger.Errorf("error reading response body: %s", err)
|
||||
return nil, err
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// AlertChannelCap specifies how much buffer the alerts channel has.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
func TestChecker_CheckPeers(t *testing.T) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// PeerMetrics maps a peer IDs to a metrics window.
|
||||
|
|
|
@ -3,7 +3,7 @@ package metrics
|
|||
import (
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// PeersetFilter removes all metrics not belonging to the given
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/monitor/metrics"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
gocodec "github.com/ugorji/go/codec"
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/config"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
|
@ -79,7 +79,7 @@ func peerManagerClusters(t *testing.T) ([]*Cluster, []*test.IpfsMock, host.Host)
|
|||
func clusterAddr(c *Cluster) ma.Multiaddr {
|
||||
for _, a := range c.host.Addrs() {
|
||||
if _, err := a.ValueForProtocol(ma.P_IP4); err == nil {
|
||||
p := peer.Encode(c.id)
|
||||
p := c.id.String()
|
||||
cAddr, _ := ma.NewMultiaddr(fmt.Sprintf("%s/p2p/%s", a, p))
|
||||
return cAddr
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/observations"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
|
||||
"go.opencensus.io/stats"
|
||||
"go.opencensus.io/trace"
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/state/dsstate"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/state"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
|
||||
"go.opencensus.io/trace"
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/state/dsstate"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
{
|
||||
projectShells.ipfs-cluster = {
|
||||
tools = [
|
||||
pkgs.go_1_18
|
||||
pkgs.go_1_19
|
||||
pkgs.gnumake
|
||||
pkgs.gcc
|
||||
];
|
||||
env.GOPATH.eval = "$REPO_DATA_DIR/go";
|
||||
};
|
||||
packages.ipfs-cluster = with pkgs; buildGo118Module {
|
||||
packages.ipfs-cluster = with pkgs; buildGo119Module {
|
||||
pname = "ipfs-cluster";
|
||||
version = "1.0.2";
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
]);
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-/fy46kF9XN0nrkmgPjFCxHGsqbxabTKFNGKUIoDBDjI=";
|
||||
vendorSha256 = "sha256-zc0p7CQP+cTl9+q8rm6SzXFIHe0278R1sgytye2U1tM=";
|
||||
|
||||
doCheck = false;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ import (
|
|||
"time"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
net "github.com/libp2p/go-libp2p-core/network"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
pstoreutil "github.com/libp2p/go-libp2p-peerstore"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
net "github.com/libp2p/go-libp2p/core/network"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
peerstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||||
pstoreutil "github.com/libp2p/go-libp2p/p2p/host/peerstore"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/test"
|
||||
|
||||
libp2p "github.com/libp2p/go-libp2p"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
)
|
||||
|
||||
|
@ -28,7 +28,7 @@ func clean(pm *Manager) {
|
|||
}
|
||||
|
||||
func testAddr(loc string, pid peer.ID) ma.Multiaddr {
|
||||
m, _ := ma.NewMultiaddr(loc + "/p2p/" + peer.Encode(pid))
|
||||
m, _ := ma.NewMultiaddr(loc + "/p2p/" + pid.String())
|
||||
return m
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/state"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/version"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
|
||||
ocgorpc "github.com/lanzafame/go-libp2p-ocgorpc"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
"github.com/ipfs-cluster/ipfs-cluster/datastore/inmem"
|
||||
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
var testCid1, _ = api.DecodeCid("QmP63DkAFEnDYNjDYBpyNDfttu1fvUw99x1brscPzpqmmq")
|
||||
|
|
|
@ -2,7 +2,7 @@ package test
|
|||
|
||||
import (
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
// Common variables used all around tests.
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -395,7 +394,7 @@ func (m *IpfsMock) handler(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Set("X-Stream-Error", err.Error())
|
||||
return
|
||||
}
|
||||
data, err := ioutil.ReadAll(part)
|
||||
data, err := io.ReadAll(part)
|
||||
if err != nil {
|
||||
w.Header().Set("X-Stream-Error", err.Error())
|
||||
return
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
"github.com/ipfs-cluster/ipfs-cluster/state"
|
||||
|
||||
gopath "github.com/ipfs/go-path"
|
||||
host "github.com/libp2p/go-libp2p-core/host"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
rpc "github.com/libp2p/go-libp2p-gorpc"
|
||||
host "github.com/libp2p/go-libp2p/core/host"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -226,19 +226,19 @@ func (mock *mockCluster) ConnectGraph(ctx context.Context, in struct{}, out *api
|
|||
*out = api.ConnectGraph{
|
||||
ClusterID: PeerID1,
|
||||
IPFSLinks: map[string][]peer.ID{
|
||||
peer.Encode(PeerID4): {PeerID5, PeerID6},
|
||||
peer.Encode(PeerID5): {PeerID4, PeerID6},
|
||||
peer.Encode(PeerID6): {PeerID4, PeerID5},
|
||||
PeerID4.String(): {PeerID5, PeerID6},
|
||||
PeerID5.String(): {PeerID4, PeerID6},
|
||||
PeerID6.String(): {PeerID4, PeerID5},
|
||||
},
|
||||
ClusterLinks: map[string][]peer.ID{
|
||||
peer.Encode(PeerID1): {PeerID2, PeerID3},
|
||||
peer.Encode(PeerID2): {PeerID1, PeerID3},
|
||||
peer.Encode(PeerID3): {PeerID1, PeerID2},
|
||||
PeerID1.String(): {PeerID2, PeerID3},
|
||||
PeerID2.String(): {PeerID1, PeerID3},
|
||||
PeerID3.String(): {PeerID1, PeerID2},
|
||||
},
|
||||
ClustertoIPFS: map[string]peer.ID{
|
||||
peer.Encode(PeerID1): PeerID4,
|
||||
peer.Encode(PeerID2): PeerID5,
|
||||
peer.Encode(PeerID3): PeerID6,
|
||||
PeerID1.String(): PeerID4,
|
||||
PeerID2.String(): PeerID5,
|
||||
PeerID3.String(): PeerID6,
|
||||
},
|
||||
}
|
||||
return nil
|
||||
|
@ -248,7 +248,7 @@ func (mock *mockCluster) StatusAll(ctx context.Context, in <-chan api.TrackerSta
|
|||
defer close(out)
|
||||
filter := <-in
|
||||
|
||||
pid := peer.Encode(PeerID1)
|
||||
pid := PeerID1.String()
|
||||
gPinInfos := []api.GlobalPinInfo{
|
||||
{
|
||||
Cid: Cid1,
|
||||
|
@ -323,7 +323,7 @@ func (mock *mockCluster) Status(ctx context.Context, in api.Cid, out *api.Global
|
|||
},
|
||||
|
||||
PeerMap: map[string]api.PinInfoShort{
|
||||
peer.Encode(PeerID1): {
|
||||
PeerID1.String(): {
|
||||
PeerName: PeerName3,
|
||||
IPFS: PeerID3,
|
||||
IPFSAddresses: []api.Multiaddr{ma},
|
||||
|
@ -371,7 +371,7 @@ func (mock *mockCluster) RepoGC(ctx context.Context, in struct{}, out *api.Globa
|
|||
_ = mock.RepoGCLocal(ctx, struct{}{}, &localrepoGC)
|
||||
*out = api.GlobalRepoGC{
|
||||
PeerMap: map[string]api.RepoGC{
|
||||
peer.Encode(PeerID1): localrepoGC,
|
||||
PeerID1.String(): localrepoGC,
|
||||
},
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
blake2b "golang.org/x/crypto/blake2b"
|
||||
|
||||
"github.com/ipfs-cluster/ipfs-cluster/api"
|
||||
peer "github.com/libp2p/go-libp2p-core/peer"
|
||||
peer "github.com/libp2p/go-libp2p/core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
madns "github.com/multiformats/go-multiaddr-dns"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package version
|
|||
|
||||
import (
|
||||
semver "github.com/blang/semver"
|
||||
protocol "github.com/libp2p/go-libp2p-core/protocol"
|
||||
protocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||
)
|
||||
|
||||
// Version is the current cluster version.
|
||||
|
|
Loading…
Reference in a new issue