From f387cb64c6d8d9f3f8f7c74a260827f13000a5cf Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 2 Mar 2019 19:05:53 +0100 Subject: [PATCH 01/43] Install docker in travis License: MIT Signed-off-by: Jakub Sztandera --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4cfe98c24..9fbb54855 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,22 @@ language: go go: - 1.11.x +services: + - docker + env: global: - GOTFLAGS="-race" + - IPFS_PATH=/tmp/ipfs matrix: - BUILD_DEPTYPE=gx - BUILD_DEPTYPE=gomod +before_install: + - docker pull ipfs/go-ipfs:master + - mkdir /tmp/ipfs && chmod 0777 /tmp/ipfs + - docker run -d -v /tmp/ipfs:/data/ipfs -p 8080:8080 -p 4001:4001 -p 5001:5001 ipfs/go-ipfs:master --enable-pubsub-experiment + # disable travis install install: From 49cab9ae885ef716569242ad88c75484f12f5b0d Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 2 Mar 2019 19:11:07 +0100 Subject: [PATCH 02/43] Add gx test dep License: MIT Signed-off-by: Jakub Sztandera --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9fbb54855..3621487fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ install: - true script: + - go get -d -t github.com/cheekybits/is/... # remove with gx - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) From 8d0ddc0473069b49850b2486477c4a83e2752343 Mon Sep 17 00:00:00 2001 From: optman Date: Thu, 4 Apr 2019 15:03:59 +0800 Subject: [PATCH 03/43] http api support cancel with context --- request.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/request.go b/request.go index a87d8a3e6..741056f47 100644 --- a/request.go +++ b/request.go @@ -16,6 +16,7 @@ import ( ) type Request struct { + Ctx context.Context ApiBase string Command string Args []string @@ -34,6 +35,7 @@ func NewRequest(ctx context.Context, url, command string, args ...string) *Reque "stream-channels": "true", } return &Request{ + Ctx: ctx, ApiBase: url + "/api/v0", Command: command, Args: args, @@ -108,11 +110,13 @@ func (e *Error) Error() string { func (r *Request) Send(c *http.Client) (*Response, error) { url := r.getURL() - req, err := http.NewRequest("POST", url, r.Body) + req0, err := http.NewRequest("POST", url, r.Body) if err != nil { return nil, err } + req := req0.WithContext(r.Ctx) + // Add any headers that were supplied via the RequestBuilder. for k, v := range r.Headers { req.Header.Add(k, v) From 4ecd1faf656fc2374811801a9253a7311fd6b919 Mon Sep 17 00:00:00 2001 From: optman Date: Thu, 4 Apr 2019 15:15:35 +0800 Subject: [PATCH 04/43] remove req0 --- request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request.go b/request.go index 741056f47..7d3a72fd0 100644 --- a/request.go +++ b/request.go @@ -110,12 +110,12 @@ func (e *Error) Error() string { func (r *Request) Send(c *http.Client) (*Response, error) { url := r.getURL() - req0, err := http.NewRequest("POST", url, r.Body) + req, err := http.NewRequest("POST", url, r.Body) if err != nil { return nil, err } - req := req0.WithContext(r.Ctx) + req = req.WithContext(r.Ctx) // Add any headers that were supplied via the RequestBuilder. for k, v := range r.Headers { From 73743d6ef1f350e83ca75e9d9df4948f6800ebf4 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 12 Apr 2019 17:42:59 -0700 Subject: [PATCH 05/43] options: add hash function selection for dagput --- options/dag.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/options/dag.go b/options/dag.go index a7ecfce2c..6181f5a06 100644 --- a/options/dag.go +++ b/options/dag.go @@ -5,6 +5,7 @@ type DagPutSettings struct { InputEnc string Kind string Pin string + Hash string } // DagPutOption is a single DagPut option. @@ -16,6 +17,7 @@ func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) { InputEnc: "json", Kind: "cbor", Pin: "false", + Hash: "sha2-256", } for _, opt := range opts { @@ -57,3 +59,11 @@ func (dagOpts) Kind(kind string) DagPutOption { return nil } } + +// Hash is an option for Dag.Put which specifies the hash function to use +func (dagOpts) Hash(hash string) DagPutOption { + return func(opts *DagPutSettings) error { + opts.Hash = hash + return nil + } +} From 3362d235405c99434142eeb352ace10e8b8b17de Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 13 Apr 2019 19:14:27 -0700 Subject: [PATCH 06/43] dag: properly pass hash option --- dag.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dag.go b/dag.go index edfcbacdb..cf5886f07 100644 --- a/dag.go +++ b/dag.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/ipfs/go-ipfs-api/options" - "github.com/ipfs/go-ipfs-files" + files "github.com/ipfs/go-ipfs-files" ) func (s *Shell) DagGet(ref string, out interface{}) error { @@ -52,6 +52,7 @@ func (s *Shell) DagPutWithOpts(data interface{}, opts ...options.DagPutOption) ( Option("input-enc", cfg.InputEnc). Option("format", cfg.Kind). Option("pin", cfg.Pin). + Option("hash", cfg.Hash). Body(fileReader). Exec(context.Background(), &out) } From 68293568edf304cd97a649ccdd4e4f9f1065572f Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 19 Apr 2019 12:47:50 -0700 Subject: [PATCH 07/43] fix: use filepath when handling OS paths fixes https://github.com/ipfs/go-ipfs-files/issues/16 --- add.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add.go b/add.go index b4416292e..811d7bc2c 100644 --- a/add.go +++ b/add.go @@ -4,9 +4,9 @@ import ( "context" "encoding/json" "errors" + "filepath" "io" "os" - "path" "github.com/ipfs/go-ipfs-files" ) @@ -90,7 +90,7 @@ func (s *Shell) AddDir(dir string) (string, error) { if err != nil { return "", err } - slf := files.NewSliceDirectory([]files.DirEntry{files.FileEntry(path.Base(dir), sf)}) + slf := files.NewSliceDirectory([]files.DirEntry{files.FileEntry(filepath.Base(dir), sf)}) reader := files.NewMultiFileReader(slf, true) resp, err := s.Request("add"). From e0d86c94049404aa35b5b2b332702df568f2efe0 Mon Sep 17 00:00:00 2001 From: Dominic Della Valle Date: Fri, 19 Apr 2019 13:06:29 -0700 Subject: [PATCH 08/43] fix import Co-Authored-By: Stebalien --- add.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add.go b/add.go index 811d7bc2c..c80cef21c 100644 --- a/add.go +++ b/add.go @@ -4,9 +4,9 @@ import ( "context" "encoding/json" "errors" - "filepath" "io" "os" + "path/filepath" "github.com/ipfs/go-ipfs-files" ) From c945d2e76bd7c4b60c8a118dbd84eeefe7fdb3c8 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 May 2019 19:57:06 -0700 Subject: [PATCH 09/43] add logging --- logger.go | 42 ++++++++++++++++++++++++++++++++++++++++++ logger_test.go | 20 ++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 logger.go create mode 100644 logger_test.go diff --git a/logger.go b/logger.go new file mode 100644 index 000000000..5234ddc74 --- /dev/null +++ b/logger.go @@ -0,0 +1,42 @@ +package shell + +import ( + "encoding/json" + "fmt" + "io" + "net/http" +) + +// Logger is used to handle incoming logs from the ipfs node +type Logger struct { + r io.ReadCloser +} + +// Next is used to retrieve the next event from the logging system +func (l Logger) Next() (map[string]interface{}, error) { + var out map[string]interface{} + if err := json.NewDecoder(l.r).Decode(&out); err != nil { + return nil, err + } + return out, nil +} + +// Close is used to close our reader +func (l Logger) Close() error { + return l.r.Close() +} + +// GetLogs is used to retrieve a parsable logger object +func (s *Shell) GetLogs() (Logger, error) { + logURL := fmt.Sprintf("http://%s/api/v0/log/tail", s.url) + req, err := http.NewRequest("GET", logURL, nil) + if err != nil { + return Logger{}, err + } + hc := &http.Client{} + resp, err := hc.Do(req) + if err != nil { + return Logger{}, err + } + return Logger{resp.Body}, nil +} diff --git a/logger_test.go b/logger_test.go new file mode 100644 index 000000000..cbd1114b5 --- /dev/null +++ b/logger_test.go @@ -0,0 +1,20 @@ +package shell + +import "testing" + +func Test_Logger(t *testing.T) { + sh := NewLocalShell() + logger, err := sh.GetLogs() + if err != nil { + t.Fatal(err) + } + defer func() { + if err := logger.Close(); err != nil { + t.Fatal(err) + } + }() + _, err = logger.Next() + if err != nil { + t.Fatal(err) + } +} From ad21c012cec3288eb65f51fac5a81809f3e64c2e Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 May 2019 20:03:00 -0700 Subject: [PATCH 10/43] logger: better url detection and test --- logger.go | 10 ++++++++-- logger_test.go | 9 ++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/logger.go b/logger.go index 5234ddc74..03ba82dbc 100644 --- a/logger.go +++ b/logger.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "strings" ) // Logger is used to handle incoming logs from the ipfs node @@ -28,8 +29,13 @@ func (l Logger) Close() error { // GetLogs is used to retrieve a parsable logger object func (s *Shell) GetLogs() (Logger, error) { - logURL := fmt.Sprintf("http://%s/api/v0/log/tail", s.url) - req, err := http.NewRequest("GET", logURL, nil) + var url string + if !strings.HasPrefix(s.url, "http://") { + url = fmt.Sprintf("http://%s/api/v0/log/tail", s.url) + } else { + url = s.url + } + req, err := http.NewRequest("GET", url, nil) if err != nil { return Logger{}, err } diff --git a/logger_test.go b/logger_test.go index cbd1114b5..f50db9890 100644 --- a/logger_test.go +++ b/logger_test.go @@ -1,6 +1,8 @@ package shell -import "testing" +import ( + "testing" +) func Test_Logger(t *testing.T) { sh := NewLocalShell() @@ -13,8 +15,9 @@ func Test_Logger(t *testing.T) { t.Fatal(err) } }() - _, err = logger.Next() - if err != nil { + if l, err := logger.Next(); err != nil { t.Fatal(err) + } else if l == nil { + t.Fatal("no logs found") } } From e2158869c3c90e20eeab98ebc9a05370fb39570a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 May 2019 20:03:46 -0700 Subject: [PATCH 11/43] logger: add https detection --- logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger.go b/logger.go index 03ba82dbc..d557e934b 100644 --- a/logger.go +++ b/logger.go @@ -30,7 +30,7 @@ func (l Logger) Close() error { // GetLogs is used to retrieve a parsable logger object func (s *Shell) GetLogs() (Logger, error) { var url string - if !strings.HasPrefix(s.url, "http://") { + if !strings.HasPrefix(s.url, "http://") || !strings.HasPrefix(s.url, "https://") { url = fmt.Sprintf("http://%s/api/v0/log/tail", s.url) } else { url = s.url From 10a237838da822eb5bba7d6a01319602dc7af4d6 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 May 2019 20:33:38 -0700 Subject: [PATCH 12/43] logger: fix shell connection --- logger_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger_test.go b/logger_test.go index f50db9890..f508401c6 100644 --- a/logger_test.go +++ b/logger_test.go @@ -5,7 +5,7 @@ import ( ) func Test_Logger(t *testing.T) { - sh := NewLocalShell() + sh := NewShell(shellUrl) logger, err := sh.GetLogs() if err != nil { t.Fatal(err) From 68f7f27c6e337a87353a61f933f529755a4c2693 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 3 May 2019 15:12:32 -0700 Subject: [PATCH 13/43] logger: add proper decoding on log streams --- logger.go | 40 +++++++++++++++++----------------------- logger_test.go | 5 ++++- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/logger.go b/logger.go index d557e934b..341757c0f 100644 --- a/logger.go +++ b/logger.go @@ -1,48 +1,42 @@ package shell import ( + "context" "encoding/json" - "fmt" "io" - "net/http" - "strings" ) // Logger is used to handle incoming logs from the ipfs node type Logger struct { - r io.ReadCloser + resp io.ReadCloser + dec *json.Decoder } // Next is used to retrieve the next event from the logging system func (l Logger) Next() (map[string]interface{}, error) { var out map[string]interface{} - if err := json.NewDecoder(l.r).Decode(&out); err != nil { - return nil, err - } - return out, nil + return out, l.dec.Decode(&out) } // Close is used to close our reader func (l Logger) Close() error { - return l.r.Close() + return l.resp.Close() } // GetLogs is used to retrieve a parsable logger object -func (s *Shell) GetLogs() (Logger, error) { - var url string - if !strings.HasPrefix(s.url, "http://") || !strings.HasPrefix(s.url, "https://") { - url = fmt.Sprintf("http://%s/api/v0/log/tail", s.url) - } else { - url = s.url - } - req, err := http.NewRequest("GET", url, nil) +func (s *Shell) GetLogs(ctx context.Context) (Logger, error) { + + resp, err := s.Request("log/tail").Send(ctx) if err != nil { - return Logger{}, err + return Logger{}, nil } - hc := &http.Client{} - resp, err := hc.Do(req) - if err != nil { - return Logger{}, err + if resp.Error != nil { + resp.Close() + return Logger{}, resp.Error } - return Logger{resp.Body}, nil + return newLogger(resp.Output), nil +} + +func newLogger(resp io.ReadCloser) Logger { + return Logger{resp, json.NewDecoder(resp)} } diff --git a/logger_test.go b/logger_test.go index f508401c6..d67d651fb 100644 --- a/logger_test.go +++ b/logger_test.go @@ -1,12 +1,15 @@ package shell import ( + "context" "testing" ) func Test_Logger(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() sh := NewShell(shellUrl) - logger, err := sh.GetLogs() + logger, err := sh.GetLogs(ctx) if err != nil { t.Fatal(err) } From db26c16f1ed030eff9b35539b0b087cab352e33d Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 3 May 2019 17:50:59 -0700 Subject: [PATCH 14/43] logger: change logger test name, bug fix with error return, misc fixes --- logger.go | 5 ++--- logger_test.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/logger.go b/logger.go index 341757c0f..bdb7e64bc 100644 --- a/logger.go +++ b/logger.go @@ -25,13 +25,12 @@ func (l Logger) Close() error { // GetLogs is used to retrieve a parsable logger object func (s *Shell) GetLogs(ctx context.Context) (Logger, error) { - resp, err := s.Request("log/tail").Send(ctx) if err != nil { - return Logger{}, nil + return Logger{}, err } if resp.Error != nil { - resp.Close() + resp.Output.Close() return Logger{}, resp.Error } return newLogger(resp.Output), nil diff --git a/logger_test.go b/logger_test.go index d67d651fb..28250efd1 100644 --- a/logger_test.go +++ b/logger_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func Test_Logger(t *testing.T) { +func TestLogger(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() sh := NewShell(shellUrl) From 6c04281b3cb0c20a7482d5672d91d006cc7151a1 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 22 May 2019 14:52:16 -0700 Subject: [PATCH 15/43] shell: enable multihash type selection when using shell.Add --- add.go | 10 +++++++++- shell_test.go | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/add.go b/add.go index c80cef21c..11ba36919 100644 --- a/add.go +++ b/add.go @@ -8,7 +8,7 @@ import ( "os" "path/filepath" - "github.com/ipfs/go-ipfs-files" + files "github.com/ipfs/go-ipfs-files" ) type object struct { @@ -45,6 +45,14 @@ func RawLeaves(enabled bool) AddOpts { } } +// Hash allows for selecting the multihash type +func Hash(hash string) AddOpts { + return func(rb *RequestBuilder) error { + rb.Option("hash", hash) + return nil + } +} + func (s *Shell) Add(r io.Reader, options ...AddOpts) (string, error) { fr := files.NewReaderFile(r) slf := files.NewSliceDirectory([]files.DirEntry{files.FileEntry("", fr)}) diff --git a/shell_test.go b/shell_test.go index 18b2c3c7c..87b1a966d 100644 --- a/shell_test.go +++ b/shell_test.go @@ -28,6 +28,9 @@ func TestAdd(t *testing.T) { mhash, err := s.Add(bytes.NewBufferString("Hello IPFS Shell tests")) is.Nil(err) is.Equal(mhash, "QmUfZ9rAdhV5ioBzXKdUTh2ZNsz9bzbkaLVyQ8uc8pj21F") + mhash, err = s.Add(bytes.NewBufferString("Hello IPFS Shell tests"), Hash("sha3-256")) + is.Nil(err) + is.Equal(mhash, "zb2wwqxjxosf8GKEZCwAWSFZ879XFNca3De5yAoh5b2axAffc") } func TestRedirect(t *testing.T) { From c173ec7394f3afd3a72374d5c85f471afe31ea77 Mon Sep 17 00:00:00 2001 From: postables Date: Wed, 22 May 2019 18:17:52 -0700 Subject: [PATCH 16/43] Fix Travis Builds (#184) fix tests and CI build. --- .travis.yml | 15 ++++++++------- shell_test.go | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3621487fb..dcf41797e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,24 +11,25 @@ services: env: global: + - GO111MODULE=on - GOTFLAGS="-race" - IPFS_PATH=/tmp/ipfs matrix: - - BUILD_DEPTYPE=gx - BUILD_DEPTYPE=gomod before_install: - docker pull ipfs/go-ipfs:master - mkdir /tmp/ipfs && chmod 0777 /tmp/ipfs - - docker run -d -v /tmp/ipfs:/data/ipfs -p 8080:8080 -p 4001:4001 -p 5001:5001 ipfs/go-ipfs:master --enable-pubsub-experiment - - -# disable travis install + - docker run -d -v /tmp/ipfs:/data/ipfs -p 8080:8080 -p 4001:4001 -p 5001:5001 ipfs/go-ipfs:master "daemon" "--enable-namesys-pubsub" + install: - - true + - go mod download + +before_script: + - go vet ./... script: - - go get -d -t github.com/cheekybits/is/... # remove with gx + - go get -d github.com/cheekybits/is/... # remove with gx - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) diff --git a/shell_test.go b/shell_test.go index 87b1a966d..b7d2de3bd 100644 --- a/shell_test.go +++ b/shell_test.go @@ -30,7 +30,7 @@ func TestAdd(t *testing.T) { is.Equal(mhash, "QmUfZ9rAdhV5ioBzXKdUTh2ZNsz9bzbkaLVyQ8uc8pj21F") mhash, err = s.Add(bytes.NewBufferString("Hello IPFS Shell tests"), Hash("sha3-256")) is.Nil(err) - is.Equal(mhash, "zb2wwqxjxosf8GKEZCwAWSFZ879XFNca3De5yAoh5b2axAffc") + is.Equal(mhash, "bafkrmidz7cuqruceo2hocadpdjppcsi7qw6dypz3jhsae2qda6sexdk6z4") } func TestRedirect(t *testing.T) { @@ -330,7 +330,7 @@ func TestDagPut(t *testing.T) { c, err := s.DagPut(`{"x": "abc","y":"def"}`, "json", "cbor") is.Nil(err) - is.Equal(c, "zdpuAt47YjE9XTgSxUBkiYCbmnktKajQNheQBGASHj3FfYf8M") + is.Equal(c, "bafyreidrm3r2k6vlxqp2fk47sboeycf7apddib47w7cyagrajtpaxxl2pi") } func TestDagPutWithOpts(t *testing.T) { @@ -339,7 +339,7 @@ func TestDagPutWithOpts(t *testing.T) { c, err := s.DagPutWithOpts(`{"x": "abc","y":"def"}`, options.Dag.Pin("true")) is.Nil(err) - is.Equal(c, "zdpuAt47YjE9XTgSxUBkiYCbmnktKajQNheQBGASHj3FfYf8M") + is.Equal(c, "bafyreidrm3r2k6vlxqp2fk47sboeycf7apddib47w7cyagrajtpaxxl2pi") } func TestStatsBW(t *testing.T) { From b959c9b6fdb10fe3665b4d5015eabf7ff7c9d9b9 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 4 Jun 2019 13:28:39 -0700 Subject: [PATCH 17/43] fix: add cid-version option to add (#186) fixes #185 --- add.go | 8 ++++++++ shell_test.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/add.go b/add.go index 11ba36919..ad0cedd0b 100644 --- a/add.go +++ b/add.go @@ -53,6 +53,14 @@ func Hash(hash string) AddOpts { } } +// CidVersion allows for selecting the CID version that ipfs should use. +func CidVersion(version int) AddOpts { + return func(rb *RequestBuilder) error { + rb.Option("cid-version", version) + return nil + } +} + func (s *Shell) Add(r io.Reader, options ...AddOpts) (string, error) { fr := files.NewReaderFile(r) slf := files.NewSliceDirectory([]files.DirEntry{files.FileEntry("", fr)}) diff --git a/shell_test.go b/shell_test.go index b7d2de3bd..502bb61b7 100644 --- a/shell_test.go +++ b/shell_test.go @@ -28,9 +28,14 @@ func TestAdd(t *testing.T) { mhash, err := s.Add(bytes.NewBufferString("Hello IPFS Shell tests")) is.Nil(err) is.Equal(mhash, "QmUfZ9rAdhV5ioBzXKdUTh2ZNsz9bzbkaLVyQ8uc8pj21F") + mhash, err = s.Add(bytes.NewBufferString("Hello IPFS Shell tests"), Hash("sha3-256")) is.Nil(err) is.Equal(mhash, "bafkrmidz7cuqruceo2hocadpdjppcsi7qw6dypz3jhsae2qda6sexdk6z4") + + mhash, err = s.Add(bytes.NewBufferString("Hello IPFS Shell tests"), CidVersion(1)) + is.Nil(err) + is.Equal(mhash, "bafkreia5cxdsptovvt7qykfcrg4xlpaerart45pfn5di4rbivunybstmii") } func TestRedirect(t *testing.T) { From db4c41dacc84553901964f7dc315851e2e05150e Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 4 Jun 2019 13:34:10 -0700 Subject: [PATCH 18/43] fix decoding json streams (#180) The decoder buffers internally. --- pubsub.go | 25 ++++++++----------------- shell.go | 6 +++++- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/pubsub.go b/pubsub.go index be6f4a0d2..f4862cc8b 100644 --- a/pubsub.go +++ b/pubsub.go @@ -2,6 +2,7 @@ package shell import ( "encoding/json" + "io" "github.com/libp2p/go-libp2p-peer" ) @@ -16,25 +17,19 @@ type Message struct { // PubSubSubscription allow you to receive pubsub records that where published on the network. type PubSubSubscription struct { - resp *Response + resp io.Closer + dec *json.Decoder } -func newPubSubSubscription(resp *Response) *PubSubSubscription { - sub := &PubSubSubscription{ +func newPubSubSubscription(resp io.ReadCloser) *PubSubSubscription { + return &PubSubSubscription{ resp: resp, + dec: json.NewDecoder(resp), } - - return sub } // Next waits for the next record and returns that. func (s *PubSubSubscription) Next() (*Message, error) { - if s.resp.Error != nil { - return nil, s.resp.Error - } - - d := json.NewDecoder(s.resp.Output) - var r struct { From []byte `json:"from,omitempty"` Data []byte `json:"data,omitempty"` @@ -42,7 +37,7 @@ func (s *PubSubSubscription) Next() (*Message, error) { TopicIDs []string `json:"topicIDs,omitempty"` } - err := d.Decode(&r) + err := s.dec.Decode(&r) if err != nil { return nil, err } @@ -61,9 +56,5 @@ func (s *PubSubSubscription) Next() (*Message, error) { // Cancel cancels the given subscription. func (s *PubSubSubscription) Cancel() error { - if s.resp.Output == nil { - return nil - } - - return s.resp.Output.Close() + return s.resp.Close() } diff --git a/shell.go b/shell.go index f0b24f878..325dc288f 100644 --- a/shell.go +++ b/shell.go @@ -437,7 +437,11 @@ func (s *Shell) PubSubSubscribe(topic string) (*PubSubSubscription, error) { if err != nil { return nil, err } - return newPubSubSubscription(resp), nil + if resp.Error != nil { + resp.Close() + return nil, resp.Error + } + return newPubSubSubscription(resp.Output), nil } func (s *Shell) PubSubPublish(topic, data string) (err error) { From a151d7e6ea407930825e3475126b705113c5c64d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 9 Jul 2019 21:10:09 -0700 Subject: [PATCH 19/43] ungxify (#188) --- Makefile | 8 ------- package.json | 66 ---------------------------------------------------- 2 files changed, 74 deletions(-) delete mode 100644 Makefile delete mode 100644 package.json diff --git a/Makefile b/Makefile deleted file mode 100644 index be18a034c..000000000 --- a/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: deps -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go -deps: gx - gx --verbose install --global - gx-go rewrite -.PHONY: all gx deps diff --git a/package.json b/package.json deleted file mode 100644 index f17b21ad2..000000000 --- a/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "author": "ipfs", - "bugs": { - "url": "https://github.com/ipfs/go-ipfs-api/issues" - }, - "gx": { - "dvcsimport": "github.com/ipfs/go-ipfs-api" - }, - "gxDependencies": [ - { - "author": "whyrusleeping", - "hash": "QmYVXrKrKHDC9FobgmcmshCDyWwdrfwfanNQN4oxJ9Fk3h", - "name": "go-libp2p-peer", - "version": "3.1.2" - }, - { - "author": "multiformats", - "hash": "QmTZBfrPJmjWsCvHEtX5FE6KimVJhsJg5sBbqEFYf4UZtL", - "name": "go-multiaddr", - "version": "1.4.1" - }, - { - "author": "multiformats", - "hash": "Qmc85NSvmSG4Frn9Vb2cBc1rMyULH6D3TNVEfCzSKoUpip", - "name": "go-multiaddr-net", - "version": "1.7.2" - }, - { - "author": "mitchellh", - "hash": "QmdcULN1WCzgoQmcCaUAmEhwcxHYsDrbZ2LvRJKCL8dMrK", - "name": "go-homedir", - "version": "1.0.0" - }, - { - "author": "whyrusleeping", - "hash": "QmNohiVssaPw3KVLZik59DBVGTSm2dGvYT9eoXt5DQ36Yz", - "name": "go-ipfs-util", - "version": "1.2.9" - }, - { - "author": "whyrusleeping", - "hash": "QmQine7gvHncNevKtG9QXxf3nXcwSj6aDDmMm52mHofEEp", - "name": "tar-utils", - "version": "0.0.3" - }, - { - "author": "whyrusleeping", - "hash": "QmSwVwKUWzdf3ppM3FbBbpuqHUNtUFJPQQdfvKmgZoz2gR", - "name": "go-libp2p-metrics", - "version": "2.1.14" - }, - { - "author": "magik6k", - "hash": "QmQmhotPUzVrMEWNK3x1R5jQ5ZHWyL7tVUrmRPjrBrvyCb", - "name": "go-ipfs-files", - "version": "2.0.6" - } - ], - "gxVersion": "0.7.0", - "language": "go", - "license": "MIT", - "name": "go-ipfs-api", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "1.4.8" -} - From 86ff2660f03ea1dbffb830599014ec8d3375252c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2019 23:02:31 +0000 Subject: [PATCH 20/43] Bump github.com/multiformats/go-multiaddr-net from 0.0.1 to 0.1.0 Bumps [github.com/multiformats/go-multiaddr-net](https://github.com/multiformats/go-multiaddr-net) from 0.0.1 to 0.1.0. - [Release notes](https://github.com/multiformats/go-multiaddr-net/releases) - [Commits](https://github.com/multiformats/go-multiaddr-net/compare/v0.0.1...v0.1.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 63043f15f..5872a08ef 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,6 @@ require ( github.com/libp2p/go-libp2p-peer v0.0.1 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.0.1 - github.com/multiformats/go-multiaddr-net v0.0.1 + github.com/multiformats/go-multiaddr-net v0.1.0 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index e2df844c4..533c07e51 100644 --- a/go.sum +++ b/go.sum @@ -50,10 +50,14 @@ github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.1.0 h1:fkISCUNDb3xIpCcI6BGlPsQE+ywcxzimOsUnHWnrE74= +github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= +github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0AJpzQBpq9fejx4= +github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= From 9c828409a3dbcf35973911cb3b9c9701fd8d799e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2019 23:03:47 +0000 Subject: [PATCH 21/43] Bump github.com/ipfs/go-ipfs-files from 0.0.1 to 0.0.4 Bumps [github.com/ipfs/go-ipfs-files](https://github.com/ipfs/go-ipfs-files) from 0.0.1 to 0.0.4. - [Release notes](https://github.com/ipfs/go-ipfs-files/releases) - [Commits](https://github.com/ipfs/go-ipfs-files/compare/v0.0.1...v0.0.4) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 63043f15f..791cf2ed3 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/ipfs/go-ipfs-api require ( github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 - github.com/ipfs/go-ipfs-files v0.0.1 + github.com/ipfs/go-ipfs-files v0.0.4 github.com/ipfs/go-ipfs-util v0.0.1 github.com/libp2p/go-libp2p-metrics v0.0.1 github.com/libp2p/go-libp2p-peer v0.0.1 diff --git a/go.sum b/go.sum index e2df844c4..1c6874b5b 100644 --- a/go.sum +++ b/go.sum @@ -23,6 +23,8 @@ github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmv github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ipfs/go-ipfs-files v0.0.1 h1:OroTsI58plHGX70HPLKy6LQhPR3HZJ5ip61fYlo6POM= github.com/ipfs/go-ipfs-files v0.0.1/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= +github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= +github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= From cf49c9bdc5a40fb050109ed0bddce0314d42b45c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2019 23:32:42 +0000 Subject: [PATCH 22/43] Bump github.com/multiformats/go-multiaddr from 0.0.1 to 0.1.1 Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.0.1 to 0.1.1. - [Release notes](https://github.com/multiformats/go-multiaddr/releases) - [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.0.1...v0.1.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 2daea8f72..602af4b15 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/libp2p/go-libp2p-metrics v0.0.1 github.com/libp2p/go-libp2p-peer v0.0.1 github.com/mitchellh/go-homedir v1.1.0 - github.com/multiformats/go-multiaddr v0.0.1 + github.com/multiformats/go-multiaddr v0.1.1 github.com/multiformats/go-multiaddr-net v0.1.0 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index b92c38ca9..73cacc18e 100644 --- a/go.sum +++ b/go.sum @@ -46,14 +46,20 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 h1:MHkK1uRtFbVqvAgvWxafZe54+5uBxLluGylDiKgdhwo= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= +github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.0 h1:fkISCUNDb3xIpCcI6BGlPsQE+ywcxzimOsUnHWnrE74= github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oPbOMeS0ZDnE= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= @@ -62,21 +68,32 @@ github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0 github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= +github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= +github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c h1:GGsyl0dZ2jJgVT+VvWBf/cNijrHRhkrTjkmp5wg7li0= github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c/go.mod h1:xxcJeBb7SIUl/Wzkz1eVKJE/CB34YNrqX2TQI6jY9zs= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 52fd81a27d3045c005e00fe62decdcca0819dce1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2019 23:39:56 +0000 Subject: [PATCH 23/43] Bump github.com/libp2p/go-libp2p-peer from 0.0.1 to 0.2.0 Bumps [github.com/libp2p/go-libp2p-peer](https://github.com/libp2p/go-libp2p-peer) from 0.0.1 to 0.2.0. - [Release notes](https://github.com/libp2p/go-libp2p-peer/releases) - [Commits](https://github.com/libp2p/go-libp2p-peer/compare/v0.0.1...v0.2.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 602af4b15..8ea7638d3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/ipfs/go-ipfs-files v0.0.4 github.com/ipfs/go-ipfs-util v0.0.1 github.com/libp2p/go-libp2p-metrics v0.0.1 - github.com/libp2p/go-libp2p-peer v0.0.1 + github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.1.1 github.com/multiformats/go-multiaddr-net v0.1.0 diff --git a/go.sum b/go.sum index 73cacc18e..34395d516 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,7 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495 h1:6IyqGr3fnd0tM3YxipK27TUskaOVUjU2nG45yzwcQKY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -21,12 +22,14 @@ github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfm github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-ipfs-files v0.0.1 h1:OroTsI58plHGX70HPLKy6LQhPR3HZJ5ip61fYlo6POM= github.com/ipfs/go-ipfs-files v0.0.1/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= +github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -34,12 +37,18 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= +github.com/libp2p/go-libp2p-core v0.0.1 h1:HSTZtFIq/W5Ue43Zw+uWZyy2Vl5WtF0zDjKN8/DT/1I= +github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= github.com/libp2p/go-libp2p-crypto v0.0.1 h1:JNQd8CmoGTohO/akqrH16ewsqZpci2CbgYH/LmYl8gw= github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE= +github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ= +github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= +github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= +github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= github.com/libp2p/go-libp2p-protocol v0.0.1 h1:+zkEmZ2yFDi5adpVE3t9dqh/N9TbpFWywowzeEzBbLM= github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= @@ -52,10 +61,13 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-multiaddr v0.0.1 h1:/QUV3VBMDI6pi6xfiw7lr6xhDWWvQKn9udPn68kLSdY= github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.0 h1:fkISCUNDb3xIpCcI6BGlPsQE+ywcxzimOsUnHWnrE74= github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oPbOMeS0ZDnE= @@ -66,6 +78,7 @@ github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0AJpzQBpq9fejx4= github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= +github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= @@ -73,6 +86,8 @@ github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c h1:GGsyl0dZ2jJgVT+VvWBf/cNijrHRhkrTjkmp5wg7li0= @@ -90,6 +105,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= From 90e5200b138a0682d729c1bdd2e9e4405f7792bc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2019 21:06:25 +0000 Subject: [PATCH 24/43] Bump github.com/multiformats/go-multiaddr-net from 0.1.0 to 0.1.1 Bumps [github.com/multiformats/go-multiaddr-net](https://github.com/multiformats/go-multiaddr-net) from 0.1.0 to 0.1.1. - [Release notes](https://github.com/multiformats/go-multiaddr-net/releases) - [Commits](https://github.com/multiformats/go-multiaddr-net/compare/v0.1.0...v0.1.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8ea7638d3..f823725d4 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,6 @@ require ( github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.1.1 - github.com/multiformats/go-multiaddr-net v0.1.0 + github.com/multiformats/go-multiaddr-net v0.1.1 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index 34395d516..41f630c55 100644 --- a/go.sum +++ b/go.sum @@ -78,6 +78,8 @@ github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0AJpzQBpq9fejx4= github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= +github.com/multiformats/go-multiaddr-net v0.1.1 h1:jFFKUuXTXv+3ARyHZi3XUqQO+YWMKgBdhEvuGRfnL6s= +github.com/multiformats/go-multiaddr-net v0.1.1/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= From 3b0cbc5799b2979325773fba8a14c51392f464f8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2019 11:17:46 +0000 Subject: [PATCH 25/43] Bump github.com/multiformats/go-multiaddr from 0.1.1 to 0.1.2 Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.1.1 to 0.1.2. - [Release notes](https://github.com/multiformats/go-multiaddr/releases) - [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.1.1...v0.1.2) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f823725d4..4f39b9745 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/libp2p/go-libp2p-metrics v0.0.1 github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/multiformats/go-multiaddr v0.1.1 + github.com/multiformats/go-multiaddr v0.1.2 github.com/multiformats/go-multiaddr-net v0.1.1 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index 41f630c55..80d451b6c 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/multiformats/go-multiaddr v0.1.0 h1:fkISCUNDb3xIpCcI6BGlPsQE+ywcxzimO github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oPbOMeS0ZDnE= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= +github.com/multiformats/go-multiaddr v0.1.2 h1:HWYHNSyyllbQopmVIF5K7JKJugiah+L9/kuZKHbmNdQ= +github.com/multiformats/go-multiaddr v0.1.2/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= @@ -85,6 +87,8 @@ github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPk github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-varint v0.0.1 h1:TR/0rdQtnNxuN2IhiB639xC3tWM4IUi7DkTBVTdGW/M= +github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= From a5698bb415e5d6c476f63ac3402eb6ca58647471 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2019 11:28:38 +0000 Subject: [PATCH 26/43] Bump github.com/multiformats/go-multiaddr from 0.1.2 to 0.2.0 Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.1.2 to 0.2.0. - [Release notes](https://github.com/multiformats/go-multiaddr/releases) - [Commits](https://github.com/multiformats/go-multiaddr/compare/v0.1.2...v0.2.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4f39b9745..87c72bab3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/libp2p/go-libp2p-metrics v0.0.1 github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/multiformats/go-multiaddr v0.1.2 + github.com/multiformats/go-multiaddr v0.2.0 github.com/multiformats/go-multiaddr-net v0.1.1 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index 80d451b6c..7856a9064 100644 --- a/go.sum +++ b/go.sum @@ -74,6 +74,8 @@ github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oP github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.1.2 h1:HWYHNSyyllbQopmVIF5K7JKJugiah+L9/kuZKHbmNdQ= github.com/multiformats/go-multiaddr v0.1.2/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= +github.com/multiformats/go-multiaddr v0.2.0 h1:lR52sFwcTCuQb6bTfnXF6zA2XfyYvyd+5a9qECv/J90= +github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr-dns v0.0.1 h1:jQt9c6tDSdQLIlBo4tXYx7QUHCPjxsB1zXcag/2S7zc= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-net v0.0.1 h1:76O59E3FavvHqNg7jvzWzsPSW5JSi/ek0E4eiDVbg9g= From ee24066a9b1487386607dbd724a25b0519c8ccd5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2019 11:44:02 +0000 Subject: [PATCH 27/43] Bump github.com/libp2p/go-libp2p-metrics from 0.0.1 to 0.1.0 Bumps [github.com/libp2p/go-libp2p-metrics](https://github.com/libp2p/go-libp2p-metrics) from 0.0.1 to 0.1.0. - [Release notes](https://github.com/libp2p/go-libp2p-metrics/releases) - [Commits](https://github.com/libp2p/go-libp2p-metrics/compare/v0.0.1...v0.1.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 87c72bab3..a09dc5150 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 github.com/ipfs/go-ipfs-files v0.0.4 github.com/ipfs/go-ipfs-util v0.0.1 - github.com/libp2p/go-libp2p-metrics v0.0.1 + github.com/libp2p/go-libp2p-metrics v0.1.0 github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.2.0 diff --git a/go.sum b/go.sum index 7856a9064..ea0742843 100644 --- a/go.sum +++ b/go.sum @@ -45,6 +45,8 @@ github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoA github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= github.com/libp2p/go-libp2p-metrics v0.0.1 h1:yumdPC/P2VzINdmcKZd0pciSUCpou+s0lwYCjBbzQZU= github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08= +github.com/libp2p/go-libp2p-metrics v0.1.0 h1:v7YMUTHNobFaQeqaMfJJMbnK3EPlZeb6/KFm4gE9dks= +github.com/libp2p/go-libp2p-metrics v0.1.0/go.mod h1:rpoJmXWFxnj7qs5sJ02sxSzrhaZvpqBn8GCG6Sx6E1k= github.com/libp2p/go-libp2p-peer v0.0.1 h1:0qwAOljzYewINrU+Kndoc+1jAL7vzY/oY2Go4DCGfyY= github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo= github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY= @@ -94,7 +96,9 @@ github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -104,6 +108,7 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b h1:+/WWzjwW6gidDJnMKWLKLX1gxn7irUTF1fLpQovfQ5M= golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 h1:1wopBVtVdWnn03fZelqdXTqk7U7zPQCb+T4rbU9ZEoU= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -114,6 +119,7 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10 h1:xQJI9OEiErEQ++DoXOHqEpzsGMrAv2Q2jyCpi7DmfpQ= golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= From e88f0b8ed98a96361df6b70c874936a5e0873154 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2019 12:01:18 +0000 Subject: [PATCH 28/43] Bump github.com/ipfs/go-ipfs-files from 0.0.4 to 0.0.6 Bumps [github.com/ipfs/go-ipfs-files](https://github.com/ipfs/go-ipfs-files) from 0.0.4 to 0.0.6. - [Release notes](https://github.com/ipfs/go-ipfs-files/releases) - [Commits](https://github.com/ipfs/go-ipfs-files/compare/v0.0.4...v0.0.6) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a09dc5150..c0cf6862c 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/ipfs/go-ipfs-api require ( github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 - github.com/ipfs/go-ipfs-files v0.0.4 + github.com/ipfs/go-ipfs-files v0.0.6 github.com/ipfs/go-ipfs-util v0.0.1 github.com/libp2p/go-libp2p-metrics v0.1.0 github.com/libp2p/go-libp2p-peer v0.2.0 diff --git a/go.sum b/go.sum index ea0742843..821c45d15 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,8 @@ github.com/ipfs/go-ipfs-files v0.0.1 h1:OroTsI58plHGX70HPLKy6LQhPR3HZJ5ip61fYlo6 github.com/ipfs/go-ipfs-files v0.0.1/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= github.com/ipfs/go-ipfs-files v0.0.4 h1:WzRCivcybUQch/Qh6v8LBRhKtRsjnwyiuOV09mK7mrE= github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4= +github.com/ipfs/go-ipfs-files v0.0.6 h1:sMRtPiSmDrTA2FEiFTtk1vWgO2Dkg7bxXKJ+s8/cDAc= +github.com/ipfs/go-ipfs-files v0.0.6/go.mod h1:lVYE6sgAdtZN5825beJjSAHibw7WOBNPDWz5LaJeukg= github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= From f57c374558deb9772abcaaed173297bf07c21911 Mon Sep 17 00:00:00 2001 From: Guilhem Fanton Date: Sat, 4 Jan 2020 16:44:42 +0100 Subject: [PATCH 29/43] feat(shell): Add uds support to shell Add Unix Domain Socket support to shell, in order to have something like `shell := NewShell("/unix//tmp/sock")` working --- shell.go | 28 ++++++++++++++++++++++------ shell_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/shell.go b/shell.go index 325dc288f..1776b5402 100644 --- a/shell.go +++ b/shell.go @@ -9,6 +9,8 @@ import ( "fmt" "io" "io/ioutil" + "net" + "net/http" gohttp "net/http" "os" "path" @@ -62,14 +64,28 @@ func NewLocalShell() *Shell { } func NewShell(url string) *Shell { - c := &gohttp.Client{ - Transport: &gohttp.Transport{ - Proxy: gohttp.ProxyFromEnvironment, - DisableKeepAlives: true, - }, + var client *http.Client + + tpt := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DisableKeepAlives: true, + } + + maddr, err := ma.NewMultiaddr(url) + if err != nil { + client = &http.Client{Transport: tpt} + return NewShellWithClient(url, client) + } + + if value, err := maddr.ValueForProtocol(ma.P_UNIX); err == nil { + url = "unix" + tpt.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { + return net.Dial("unix", value) + } } - return NewShellWithClient(url, c) + client = &http.Client{Transport: tpt} + return NewShellWithClient(url, client) } func NewShellWithClient(url string, c *gohttp.Client) *Shell { diff --git a/shell_test.go b/shell_test.go index 502bb61b7..59297ef0b 100644 --- a/shell_test.go +++ b/shell_test.go @@ -1,12 +1,18 @@ package shell import ( + "bufio" "bytes" "context" "crypto/md5" "fmt" "io" + "io/ioutil" "math/rand" + "net" + "net/http" + "os" + "path/filepath" "sort" "strings" "testing" @@ -361,6 +367,45 @@ func TestSwarmPeers(t *testing.T) { is.Nil(err) } +// TestNewShellWithUnixSocket only check that http client is well configured to +// perform http request on unix socket address +func TestNewShellWithUnixSocket(t *testing.T) { + is := is.New(t) + + // setup uds temporary dir + path, err := ioutil.TempDir("", "uds-test") + is.Nil(err) + + defer os.RemoveAll(path) + + // listen on sock path + sockpath := filepath.Join(path, "sock") + lsock, err := net.Listen("unix", sockpath) + is.Nil(err) + + defer lsock.Close() + + // handle simple `hello` route + mux := http.NewServeMux() + mux.HandleFunc("/api/v0/hello", func(w http.ResponseWriter, _ *http.Request) { + fmt.Fprint(w, "Hello World\n") + }) + + go http.Serve(lsock, mux) + + // create shell with "/unix/" multiaddr + shell := NewShell("/unix/" + sockpath) + res, err := shell.Request("hello").Send(context.Background()) + is.Nil(err) + + defer res.Output.Close() + + // read hello world from body + str, err := bufio.NewReader(res.Output).ReadString('\n') + is.Nil(err) + is.Equal(str, "Hello World\n") +} + const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" const ( letterIdxBits = 6 // 6 bits to represent a letter index From 89dc426bbecf674fbd482fec2afb5472d2fda96d Mon Sep 17 00:00:00 2001 From: Guilhem Fanton Date: Mon, 6 Jan 2020 19:31:05 +0100 Subject: [PATCH 30/43] fix(shell): Move UDS check into `NewShellWithClient` --- shell.go | 54 ++++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/shell.go b/shell.go index 1776b5402..55bb299a1 100644 --- a/shell.go +++ b/shell.go @@ -10,7 +10,6 @@ import ( "io" "io/ioutil" "net" - "net/http" gohttp "net/http" "os" "path" @@ -64,40 +63,35 @@ func NewLocalShell() *Shell { } func NewShell(url string) *Shell { - var client *http.Client - - tpt := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DisableKeepAlives: true, - } - - maddr, err := ma.NewMultiaddr(url) - if err != nil { - client = &http.Client{Transport: tpt} - return NewShellWithClient(url, client) - } - - if value, err := maddr.ValueForProtocol(ma.P_UNIX); err == nil { - url = "unix" - tpt.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { - return net.Dial("unix", value) + c := &gohttp.Client{ + Transport: &gohttp.Transport{ + Proxy: gohttp.ProxyFromEnvironment, + DisableKeepAlives: true, + }, + } + + return NewShellWithClient(url, c) +} + +func NewShellWithClient(url string, client *gohttp.Client) *Shell { + if maddr, err := ma.NewMultiaddr(url); err == nil { + if network, host, err := manet.DialArgs(maddr); err == nil { + if network == "unix" { + url = network + if tpt, ok := client.Transport.(*gohttp.Transport); ok && tpt != nil && tpt.DialContext == nil { + tpt.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { + return net.Dial("unix", host) + } + } + } else { + url = host + } } } - client = &http.Client{Transport: tpt} - return NewShellWithClient(url, client) -} - -func NewShellWithClient(url string, c *gohttp.Client) *Shell { - if a, err := ma.NewMultiaddr(url); err == nil { - _, host, err := manet.DialArgs(a) - if err == nil { - url = host - } - } var sh Shell sh.url = url - sh.httpcli = *c + sh.httpcli = *client // We don't support redirects. sh.httpcli.CheckRedirect = func(_ *gohttp.Request, _ []*gohttp.Request) error { return fmt.Errorf("unexpected redirect") From 89ab090291e546eaa343ce50662cd709a2086fb6 Mon Sep 17 00:00:00 2001 From: Guilhem Fanton Date: Mon, 6 Jan 2020 23:08:17 +0100 Subject: [PATCH 31/43] fix(shell): Clone (or create) transport if needed in case of Unix Socket --- shell.go | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/shell.go b/shell.go index 55bb299a1..12b6f2d70 100644 --- a/shell.go +++ b/shell.go @@ -74,28 +74,50 @@ func NewShell(url string) *Shell { } func NewShellWithClient(url string, client *gohttp.Client) *Shell { - if maddr, err := ma.NewMultiaddr(url); err == nil { - if network, host, err := manet.DialArgs(maddr); err == nil { - if network == "unix" { - url = network - if tpt, ok := client.Transport.(*gohttp.Transport); ok && tpt != nil && tpt.DialContext == nil { - tpt.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { - return net.Dial("unix", host) - } - } - } else { - url = host - } - } - } - var sh Shell + sh.url = url sh.httpcli = *client // We don't support redirects. sh.httpcli.CheckRedirect = func(_ *gohttp.Request, _ []*gohttp.Request) error { return fmt.Errorf("unexpected redirect") } + + maddr, err := ma.NewMultiaddr(url) + if err != nil { + return &sh + } + + network, host, err := manet.DialArgs(maddr) + if err != nil { + return &sh + } + + if network == "unix" { + sh.url = network + + var tptCopy *gohttp.Transport + if tpt, ok := sh.httpcli.Transport.(*gohttp.Transport); ok && tpt.DialContext == nil { + tptCopy = tpt.Clone() + } else if sh.httpcli.Transport == nil { + tptCopy = &gohttp.Transport{ + Proxy: gohttp.ProxyFromEnvironment, + DisableKeepAlives: true, + } + } else { + // custom Transport or custom Dialer, we are done here + return &sh + } + + tptCopy.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) { + return net.Dial("unix", host) + } + + sh.httpcli.Transport = tptCopy + } else { + sh.url = host + } + return &sh } From 235270b7594a542caedde122be001812d64f0a04 Mon Sep 17 00:00:00 2001 From: Guilhem Fanton Date: Tue, 7 Jan 2020 11:08:14 +0100 Subject: [PATCH 32/43] fix(ci): Bump minimum go version to go 1.13 We need to bump the minimum version of go to 1.13, so we can use `http.Transport.Clone` --- .travis.yml | 2 +- go.mod | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dcf41797e..62bc4703b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: language: go go: - - 1.11.x + - 1.13.x services: - docker diff --git a/go.mod b/go.mod index c0cf6862c..f70ef1739 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ +go 1.13 + module github.com/ipfs/go-ipfs-api require ( From 2bc980e7cd6a7c9f759263db0a73d8d0f8ded18f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2020 11:15:01 +0000 Subject: [PATCH 33/43] build(deps): bump github.com/multiformats/go-multiaddr-net Bumps [github.com/multiformats/go-multiaddr-net](https://github.com/multiformats/go-multiaddr-net) from 0.1.1 to 0.1.2. - [Release notes](https://github.com/multiformats/go-multiaddr-net/releases) - [Commits](https://github.com/multiformats/go-multiaddr-net/compare/v0.1.1...v0.1.2) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f70ef1739..4082e1844 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,6 @@ require ( github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.2.0 - github.com/multiformats/go-multiaddr-net v0.1.1 + github.com/multiformats/go-multiaddr-net v0.1.2 github.com/whyrusleeping/tar-utils v0.0.0-20180509141711-8c6c8ba81d5c ) diff --git a/go.sum b/go.sum index 821c45d15..88ec49863 100644 --- a/go.sum +++ b/go.sum @@ -88,6 +88,8 @@ github.com/multiformats/go-multiaddr-net v0.1.0 h1:ZepO8Ezwovd+7b5XPPDhQhayk1yt0 github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= github.com/multiformats/go-multiaddr-net v0.1.1 h1:jFFKUuXTXv+3ARyHZi3XUqQO+YWMKgBdhEvuGRfnL6s= github.com/multiformats/go-multiaddr-net v0.1.1/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= +github.com/multiformats/go-multiaddr-net v0.1.2 h1:P7zcBH9FRETdPkDrylcXVjQLQ2t1JQtNItZULWNWgeg= +github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= From b887ffac8d0c7a96066b8c097c2d56cfd09334eb Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Mon, 27 Apr 2020 11:21:00 +0200 Subject: [PATCH 34/43] Add standard issue template --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++++++ .github/ISSUE_TEMPLATE/open_an_issue.md | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/open_an_issue.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..4b86d7197 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Getting Help on IPFS + url: https://ipfs.io/help + about: All information about how and where to get help on IPFS. + - name: IPFS Official Forum + url: https://discuss.ipfs.io + about: Please post general questions, support requests, and discussions here. diff --git a/.github/ISSUE_TEMPLATE/open_an_issue.md b/.github/ISSUE_TEMPLATE/open_an_issue.md new file mode 100644 index 000000000..4fcbd00ac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/open_an_issue.md @@ -0,0 +1,19 @@ +--- +name: Open an issue +about: Only for actionable issues relevant to this repository. +title: '' +labels: need/triage +assignees: '' + +--- + From e25a99c36a5e8d6bd4299da6f646fa3e122addaf Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Mon, 4 May 2020 12:00:36 +0200 Subject: [PATCH 35/43] Add autocomment configuration --- .github/config.yml | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/config.yml diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 000000000..ed26646a0 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,68 @@ +# Configuration for welcome - https://github.com/behaviorbot/welcome + +# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome +# Comment to be posted to on first time issues +newIssueWelcomeComment: > + Thank you for submitting your first issue to this repository! A maintainer + will be here shortly to triage and review. + + In the meantime, please double-check that you have provided all the + necessary information to make this process easy! Any information that can + help save additional round trips is useful! We currently aim to give + initial feedback within **two business days**. If this does not happen, feel + free to leave a comment. + + Please keep an eye on how this issue will be labeled, as labels give an + overview of priorities, assignments and additional actions requested by the + maintainers: + + - "Priority" labels will show how urgent this is for the team. + - "Status" labels will show if this is ready to be worked on, blocked, or in progress. + - "Need" labels will indicate if additional input or analysis is required. + + Finally, remember to use https://discuss.ipfs.io if you just need general + support. + +# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome +# Comment to be posted to on PRs from first time contributors in your repository +newPRWelcomeComment: > + Thank you for submitting this PR! + + A maintainer will be here shortly to review it. + + We are super grateful, but we are also overloaded! Help us by making sure + that: + + * The context for this PR is clear, with relevant discussion, decisions + and stakeholders linked/mentioned. + + * Your contribution itself is clear (code comments, self-review for the + rest) and in its best form. Follow the [code contribution + guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md#code-contribution-guidelines) + if they apply. + + Getting other community members to do a review would be great help too on + complex PRs (you can ask in the chats/forums). If you are unsure about + something, just leave us a comment. + + Next steps: + + * A maintainer will triage and assign priority to this PR, commenting on + any missing things and potentially assigning a reviewer for high + priority items. + + * The PR gets reviews, discussed and approvals as needed. + + * The PR is merged by maintainers when it has been approved and comments addressed. + + We currently aim to provide initial feedback/triaging within **two business + days**. Please keep an eye on any labelling actions, as these will indicate + priorities and status of your contribution. + + We are very grateful for your contribution! + + +# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge +# Comment to be posted to on pull requests merged by a first time user +# Currently disabled +#firstPRMergeComment: "" From 0f69d97cba7e448c1b33c78085b4d144cf6db830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Fri, 12 Jul 2019 17:00:42 +0200 Subject: [PATCH 36/43] pin ls --stream support --- shell.go | 41 ++++++++++++++++++++++++++++++++++++++++- shell_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/shell.go b/shell.go index 12b6f2d70..bde800f29 100644 --- a/shell.go +++ b/shell.go @@ -228,7 +228,7 @@ type PinInfo struct { } // Pins returns a map of the pin hashes to their info (currently just the -// pin type, one of DirectPin, RecursivePin, or IndirectPin. A map is returned +// pin type, one of DirectPin, RecursivePin, or IndirectPin). A map is returned // instead of a slice because it is easier to do existence lookup by map key // than unordered array searching. The map is likely to be more useful to a // client than a flat list. @@ -237,6 +237,45 @@ func (s *Shell) Pins() (map[string]PinInfo, error) { return raw.Keys, s.Request("pin/ls").Exec(context.Background(), &raw) } +// PinStreamInfo is the output type for PinsStream +type PinStreamInfo struct { + Cid string + Type string +} + +// PinsStream is a streamed version of Pins. It returns a channel of the pins +// with their type, one of DirectPin, RecursivePin, or IndirectPin. +func (s *Shell) PinsStream() (<-chan PinStreamInfo, error) { + resp, err := s.Request("pin/ls"). + Option("stream", true). + Send(context.Background()) + if err != nil { + return nil, err + } + + if resp.Error != nil { + resp.Close() + return nil, resp.Error + } + + out := make(chan PinStreamInfo) + go func() { + defer resp.Close() + var pin PinStreamInfo + defer close(out) + dec := json.NewDecoder(resp.Output) + for { + err := dec.Decode(&pin) + if err != nil { + return + } + out <- pin + } + }() + + return out, nil +} + type PeerInfo struct { Addrs []string ID string diff --git a/shell_test.go b/shell_test.go index 59297ef0b..ca4e6710a 100644 --- a/shell_test.go +++ b/shell_test.go @@ -239,6 +239,54 @@ func TestPins(t *testing.T) { is.Equal(info.Type, RecursivePin) } +func TestPinsStream(t *testing.T) { + is := is.New(t) + s := NewShell(shellUrl) + + // Add a thing, which pins it by default + h, err := s.Add(bytes.NewBufferString("go-ipfs-api pins test 0C7023F8-1FEC-4155-A8E0-432A5853F46B")) + is.Nil(err) + + pinChan, err := s.PinsStream() + is.Nil(err) + + pins := accumulatePins(pinChan) + + _, ok := pins[h] + is.True(ok) + + err = s.Unpin(h) + is.Nil(err) + + pinChan, err = s.PinsStream() + is.Nil(err) + + pins = accumulatePins(pinChan) + + _, ok = pins[h] + is.False(ok) + + err = s.Pin(h) + is.Nil(err) + + pinChan, err = s.PinsStream() + is.Nil(err) + + pins = accumulatePins(pinChan) + + _type, ok := pins[h] + is.True(ok) + is.Equal(_type, RecursivePin) +} + +func accumulatePins(pinChan <-chan PinStreamInfo) map[string]string { + pins := make(map[string]string) + for pin := range pinChan { + pins[pin.Cid] = pin.Type + } + return pins +} + func TestPatch_rmLink(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) From f19a34abfce3d9e26f4c192acffd2bf1cef2f03c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 4 May 2020 17:39:39 -0700 Subject: [PATCH 37/43] fix: pass a context to PinsStream --- shell.go | 10 +++++++--- shell_test.go | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/shell.go b/shell.go index bde800f29..6b6a5dd37 100644 --- a/shell.go +++ b/shell.go @@ -245,10 +245,10 @@ type PinStreamInfo struct { // PinsStream is a streamed version of Pins. It returns a channel of the pins // with their type, one of DirectPin, RecursivePin, or IndirectPin. -func (s *Shell) PinsStream() (<-chan PinStreamInfo, error) { +func (s *Shell) PinsStream(ctx context.Context) (<-chan PinStreamInfo, error) { resp, err := s.Request("pin/ls"). Option("stream", true). - Send(context.Background()) + Send(ctx) if err != nil { return nil, err } @@ -269,7 +269,11 @@ func (s *Shell) PinsStream() (<-chan PinStreamInfo, error) { if err != nil { return } - out <- pin + select { + case out <- pin: + case <-ctx.Done(): + return + } } }() diff --git a/shell_test.go b/shell_test.go index ca4e6710a..15c7ee61d 100644 --- a/shell_test.go +++ b/shell_test.go @@ -247,7 +247,7 @@ func TestPinsStream(t *testing.T) { h, err := s.Add(bytes.NewBufferString("go-ipfs-api pins test 0C7023F8-1FEC-4155-A8E0-432A5853F46B")) is.Nil(err) - pinChan, err := s.PinsStream() + pinChan, err := s.PinsStream(context.Background()) is.Nil(err) pins := accumulatePins(pinChan) @@ -258,7 +258,7 @@ func TestPinsStream(t *testing.T) { err = s.Unpin(h) is.Nil(err) - pinChan, err = s.PinsStream() + pinChan, err = s.PinsStream(context.Background()) is.Nil(err) pins = accumulatePins(pinChan) @@ -269,7 +269,7 @@ func TestPinsStream(t *testing.T) { err = s.Pin(h) is.Nil(err) - pinChan, err = s.PinsStream() + pinChan, err = s.PinsStream(context.Background()) is.Nil(err) pins = accumulatePins(pinChan) From 9f98510a8062eb1bb5a154e07621b518b1a56c19 Mon Sep 17 00:00:00 2001 From: Bryan Stenson Date: Tue, 12 May 2020 20:10:25 +0000 Subject: [PATCH 38/43] update contributing link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89dbb4b58..4fd61f1a2 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Contributions are welcome! Please check out the [issues](https://github.com/ipfs ### Want to hack on IPFS? -[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) ## License From 1d3e2491f72bc44a1e6a59f4c559ddc92ba04a33 Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Fri, 15 May 2020 18:02:58 -0700 Subject: [PATCH 39/43] Fix dns4 panic by upgrading go-multiaddr-dns to v0.2.0 ref: https://github.com/multiformats/go-multiaddr/issues/114 --- go.mod | 1 + go.sum | 3 +++ 2 files changed, 4 insertions(+) diff --git a/go.mod b/go.mod index c51dee4aa..1d1888715 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.2.1 + github.com/multiformats/go-multiaddr-dns v0.2.0 // indirect github.com/multiformats/go-multiaddr-net v0.1.2 github.com/tron-us/go-btfs-common v0.3.7 github.com/tron-us/go-common/v2 v2.0.5 diff --git a/go.sum b/go.sum index 23e987993..3a742bb23 100644 --- a/go.sum +++ b/go.sum @@ -122,11 +122,14 @@ github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.2.1 h1:SgG/cw5vqyB5QQe5FPe2TqggU9WtrA9X4nZw7LlVqOI= github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= +github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= +github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= github.com/multiformats/go-multiaddr-net v0.1.2 h1:P7zcBH9FRETdPkDrylcXVjQLQ2t1JQtNItZULWNWgeg= github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= From 19ab9f2d6939a416b17d0dd0bbc4704b4f4954dd Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Fri, 15 May 2020 18:15:31 -0700 Subject: [PATCH 40/43] Fix test failures with ipfs -> btfs namescapes --- add.go | 6 +++--- ipns_test.go | 2 +- logger.go | 2 +- request.go | 10 +++++----- shell.go | 6 +++--- shell_test.go | 20 ++++++++++---------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/add.go b/add.go index 70a432138..118279c9c 100644 --- a/add.go +++ b/add.go @@ -67,7 +67,7 @@ func Hash(hash string) AddOpts { } } -// CidVersion allows for selecting the CID version that ipfs should use. +// CidVersion allows for selecting the CID version that btfs should use. func CidVersion(version int) AddOpts { return func(rb *RequestBuilder) error { rb.Option("cid-version", version) @@ -88,13 +88,13 @@ func (s *Shell) Add(r io.Reader, options ...AddOpts) (string, error) { return out.Hash, rb.Body(fileReader).Exec(context.Background(), &out) } -// AddNoPin adds a file to ipfs without pinning it +// AddNoPin adds a file to btfs without pinning it // Deprecated: Use Add() with option functions instead func (s *Shell) AddNoPin(r io.Reader) (string, error) { return s.Add(r, Pin(false)) } -// AddWithOpts adds a file to ipfs with some additional options +// AddWithOpts adds a file to btfs with some additional options // Deprecated: Use Add() with option functions instead func (s *Shell) AddWithOpts(r io.Reader, pin bool, rawLeaves bool) (string, error) { return s.Add(r, Pin(pin), RawLeaves(rawLeaves)) diff --git a/ipns_test.go b/ipns_test.go index 7137f1d8d..ca99828b5 100644 --- a/ipns_test.go +++ b/ipns_test.go @@ -6,7 +6,7 @@ import ( "time" ) -var examplesHashForIPNS = "/ipfs/Qmbu7x6gJbsKDcseQv66pSbUcAA3Au6f7MfTYVXwvBxN2K" +var examplesHashForIPNS = "/btfs/Qmbu7x6gJbsKDcseQv66pSbUcAA3Au6f7MfTYVXwvBxN2K" var testKey = "self" // feel free to change to whatever key you have locally func TestPublishDetailsWithKey(t *testing.T) { diff --git a/logger.go b/logger.go index bdb7e64bc..1bae96e8c 100644 --- a/logger.go +++ b/logger.go @@ -6,7 +6,7 @@ import ( "io" ) -// Logger is used to handle incoming logs from the ipfs node +// Logger is used to handle incoming logs from the btfs node type Logger struct { resp io.ReadCloser dec *json.Decoder diff --git a/request.go b/request.go index 54dd8310e..944ee0b3d 100644 --- a/request.go +++ b/request.go @@ -153,20 +153,20 @@ func (r *Request) Send(c *http.Client) (*Response, error) { case contentType == "text/plain": out, err := ioutil.ReadAll(resp.Body) if err != nil { - fmt.Fprintf(os.Stderr, "ipfs-shell: warning! response (%d) read error: %s\n", resp.StatusCode, err) + fmt.Fprintf(os.Stderr, "btfs-shell: warning! response (%d) read error: %s\n", resp.StatusCode, err) } e.Message = string(out) case contentType == "application/json": if err = json.NewDecoder(resp.Body).Decode(e); err != nil { - fmt.Fprintf(os.Stderr, "ipfs-shell: warning! response (%d) unmarshall error: %s\n", resp.StatusCode, err) + fmt.Fprintf(os.Stderr, "btfs-shell: warning! response (%d) unmarshall error: %s\n", resp.StatusCode, err) } default: - fmt.Fprintf(os.Stderr, "ipfs-shell: warning! unhandled response (%d) encoding: %s", resp.StatusCode, contentType) + fmt.Fprintf(os.Stderr, "btfs-shell: warning! unhandled response (%d) encoding: %s", resp.StatusCode, contentType) out, err := ioutil.ReadAll(resp.Body) if err != nil { - fmt.Fprintf(os.Stderr, "ipfs-shell: response (%d) read error: %s\n", resp.StatusCode, err) + fmt.Fprintf(os.Stderr, "btfs-shell: response (%d) read error: %s\n", resp.StatusCode, err) } - e.Message = fmt.Sprintf("unknown ipfs-shell error encoding: %q - %q", contentType, out) + e.Message = fmt.Sprintf("unknown btfs-shell error encoding: %q - %q", contentType, out) } nresp.Error = e nresp.Output = nil diff --git a/shell.go b/shell.go index 0756f8018..589712b6f 100644 --- a/shell.go +++ b/shell.go @@ -1,4 +1,4 @@ -// package shell implements a remote API interface for a running ipfs daemon +// package shell implements a remote API interface for a running btfs daemon package shell import ( @@ -407,10 +407,10 @@ func (s *Shell) ResolvePath(path string) (string, error) { return "", err } - return strings.TrimPrefix(out.Path, "/ipfs/"), nil + return strings.TrimPrefix(out.Path, "/btfs/"), nil } -// returns ipfs version and commit sha +// returns btfs version and commit sha func (s *Shell) Version() (string, string, error) { ver := struct { Version string diff --git a/shell_test.go b/shell_test.go index 78c9872e8..f422854ce 100644 --- a/shell_test.go +++ b/shell_test.go @@ -198,16 +198,16 @@ func TestLocalShell(t *testing.T) { s := NewLocalShell() is.NotNil(s) - mhash, err := s.Add(bytes.NewBufferString("Hello IPFS Shell tests")) + mhash, err := s.Add(bytes.NewBufferString("Hello BTFS Shell tests")) is.Nil(err) - is.Equal(mhash, "QmUfZ9rAdhV5ioBzXKdUTh2ZNsz9bzbkaLVyQ8uc8pj21F") + is.Equal(mhash, "QmWdmh44YvneQLiLWjmUBRJ34aVaQk4V39GS3kQTHoKx8C") } func TestCat(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) - rc, err := s.Cat(fmt.Sprintf("/ipfs/%s/readme", examplesHash)) + rc, err := s.Cat(fmt.Sprintf("/btfs/%s/readme", examplesHash)) is.Nil(err) md5 := md5.New() @@ -220,12 +220,12 @@ func TestList(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) - list, err := s.List(fmt.Sprintf("/ipfs/%s", examplesHash)) + list, err := s.List(fmt.Sprintf("/btfs/%s", examplesHash)) is.Nil(err) is.Equal(len(list), 7) - // TODO: document difference in size between 'ipfs ls' and 'ipfs file ls -v'. additional object encoding in data block? + // TODO: document difference in size between 'btfs ls' and 'btfs file ls -v'. additional object encoding in data block? expected := map[string]LsLink{ "about": {Type: TFile, Hash: "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V", Name: "about", Size: 1677}, "contact": {Type: TFile, Hash: "QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y", Name: "contact", Size: 189}, @@ -247,14 +247,14 @@ func TestFileList(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) - list, err := s.FileList(fmt.Sprintf("/ipfs/%s", examplesHash)) + list, err := s.FileList(fmt.Sprintf("/btfs/%s", examplesHash)) is.Nil(err) is.Equal(list.Type, "Directory") is.Equal(list.Size, 0) is.Equal(len(list.Links), 7) - // TODO: document difference in sice betwen 'ipfs ls' and 'ipfs file ls -v'. additional object encoding in data block? + // TODO: document difference in sice betwen 'btfs ls' and 'btfs file ls -v'. additional object encoding in data block? expected := map[string]UnixLsLink{ "about": {Type: "File", Hash: "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V", Name: "about", Size: 1677}, "contact": {Type: "File", Hash: "QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y", Name: "contact", Size: 189}, @@ -277,7 +277,7 @@ func TestPins(t *testing.T) { s := NewShell(shellUrl) // Add a thing, which pins it by default - h, err := s.Add(bytes.NewBufferString("go-ipfs-api pins test 9F3D1F30-D12A-4024-9477-8F0C8E4B3A63")) + h, err := s.Add(bytes.NewBufferString("go-btfs-api pins test 9F3D1F30-D12A-4024-9477-8F0C8E4B3A63")) is.Nil(err) pins, err := s.Pins() @@ -311,7 +311,7 @@ func TestPinsStream(t *testing.T) { s := NewShell(shellUrl) // Add a thing, which pins it by default - h, err := s.Add(bytes.NewBufferString("go-ipfs-api pins test 0C7023F8-1FEC-4155-A8E0-432A5853F46B")) + h, err := s.Add(bytes.NewBufferString("go-btfs-api pins test 0C7023F8-1FEC-4155-A8E0-432A5853F46B")) is.Nil(err) pinChan, err := s.PinsStream(context.Background()) @@ -384,7 +384,7 @@ func TestResolvePath(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) - childHash, err := s.ResolvePath(fmt.Sprintf("/ipfs/%s/about", examplesHash)) + childHash, err := s.ResolvePath(fmt.Sprintf("/btfs/%s/about", examplesHash)) is.Nil(err) is.Equal(childHash, "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V") } From 58b384ee19c4a3c84b1e288df8c48a65e80ae0d3 Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Fri, 15 May 2020 18:39:55 -0700 Subject: [PATCH 41/43] Fix unit socket test --- shell_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell_test.go b/shell_test.go index f422854ce..2b7e58e3b 100644 --- a/shell_test.go +++ b/shell_test.go @@ -502,7 +502,7 @@ func TestNewShellWithUnixSocket(t *testing.T) { // handle simple `hello` route mux := http.NewServeMux() - mux.HandleFunc("/api/v0/hello", func(w http.ResponseWriter, _ *http.Request) { + mux.HandleFunc(fmt.Sprintf("/api/%s/hello", API_VERSION), func(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "Hello World\n") }) @@ -512,6 +512,7 @@ func TestNewShellWithUnixSocket(t *testing.T) { shell := NewShell("/unix/" + sockpath) res, err := shell.Request("hello").Send(context.Background()) is.Nil(err) + is.Nil(res.Error) defer res.Output.Close() From 97ff0c62b578e12160baf1a36c668999bb84f40c Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Fri, 15 May 2020 19:02:36 -0700 Subject: [PATCH 42/43] Less verbose upload testing --- shell_test.go | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/shell_test.go b/shell_test.go index 2b7e58e3b..37ff1e2b6 100644 --- a/shell_test.go +++ b/shell_test.go @@ -587,6 +587,7 @@ func randBytes(is is.I, size int) []byte { is.Nil(err) return b } + func TestStorageUploadWithOnSign(t *testing.T) { is := is.New(t) err := utils.LoadApiConfig() @@ -603,21 +604,18 @@ func TestStorageUploadWithOnSign(t *testing.T) { var storage *Storage LOOP: for { + sleepMoment() storage, err = s.StorageUploadStatus(sessionId) is.Nil(err) switch storage.Status { case "complete": + fmt.Printf("Complete\n") break LOOP case "error": - fmt.Printf("%#v, %#v\n", storage.Status, storage.Message) - t.Fatal(fmt.Errorf("%s", storage.Message)) - default: - fmt.Printf("%#v continue \n", storage.Status) - sleepMoment() - continue + t.Fatal(fmt.Errorf("Failed: %s", storage.Message)) + break LOOP } } - fmt.Printf("Complete\n") } func TestStorageUploadWithOffSign(t *testing.T) { @@ -634,7 +632,6 @@ func TestStorageUploadWithOffSign(t *testing.T) { sessionId, err := s.StorageUploadOffSign(mhash, uts) is.Nil(err) - //var storage Storage LOOP: for { sleepMoment() @@ -642,9 +639,11 @@ LOOP: is.Nil(err) switch storage.Status { case "complete": + fmt.Printf("Complete\n") break LOOP case "error": - t.Fatal(fmt.Errorf("%s", storage.Message)) + t.Fatal(fmt.Errorf("Failed: %s", storage.Message)) + break LOOP case "init": ec, err := s.StorageUploadGetContractBatch(sessionId, uts, "escrow") is.Nil(err) @@ -660,7 +659,6 @@ LOOP: is.Nil(err) err = s.StorageUploadSignBatch(sessionId, gc, uts, "guard") is.Nil(err) - fmt.Printf("%#v\n", storage.Status) case "submit", "submit:check-balance-req-singed", "pay", "pay:payin-req-signed", "guard", "guard:file-meta-signed", "wait-upload": unsigned, err := s.StorageUploadGetUnsignedData(sessionId, uts, storage.Status) @@ -681,10 +679,6 @@ LOOP: default: } is.Nil(err) - fmt.Printf("%#v\n", storage.Status) - default: - fmt.Printf("%#v continue \n", storage.Status) } } - fmt.Printf("Complete\n") } From e9180330aca498b0a0080186ff059237dcc6e6eb Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Fri, 15 May 2020 21:14:01 -0700 Subject: [PATCH 43/43] Update go-btfs-config --- go.mod | 3 +-- go.sum | 11 ++--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 1d1888715..42262e103 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/TRON-US/go-btfs-api require ( - github.com/TRON-US/go-btfs-config v0.4.1 + github.com/TRON-US/go-btfs-config v0.6.0 github.com/TRON-US/go-btfs-files v0.2.0 github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 github.com/gogo/protobuf v1.3.1 @@ -11,7 +11,6 @@ require ( github.com/libp2p/go-libp2p-peer v0.2.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.2.1 - github.com/multiformats/go-multiaddr-dns v0.2.0 // indirect github.com/multiformats/go-multiaddr-net v0.1.2 github.com/tron-us/go-btfs-common v0.3.7 github.com/tron-us/go-common/v2 v2.0.5 diff --git a/go.sum b/go.sum index 3a742bb23..efa454e46 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/TRON-US/go-btfs-config v0.4.1 h1:Cj6DITP5Zd6TZvDUkmvKyaH/AKX4JSGtB57gKXZp70g= -github.com/TRON-US/go-btfs-config v0.4.1/go.mod h1:045+FmBpTIWNy34ISzjtPaEf6afBq6wVQtviNmAnF5g= +github.com/TRON-US/go-btfs-config v0.6.0 h1:KzBR+v3wdGD9je5fwI4lJrKTTtqwGhRihRulG6QY5Yo= +github.com/TRON-US/go-btfs-config v0.6.0/go.mod h1:82nKCMRhsgY0I8DCasIUpSr6ZP9iHLsZJSMUxytMpEw= github.com/TRON-US/go-btfs-files v0.2.0 h1:JZ+F0gX8iPmUf1OlrdOdsA8GMGxCHhwQ03jEWWEgVLE= github.com/TRON-US/go-btfs-files v0.2.0/go.mod h1:Qx+rTOIC0xl3ZkosGcEoB4hqExZmTONErPys8K5suEc= github.com/TRON-US/go-libp2p-core v0.5.0 h1:GNYu7vXRk6sXbJuOMw4qR2x9cvZ+bKffzB0yB8CFMuo= @@ -120,16 +120,9 @@ github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.2.1 h1:SgG/cw5vqyB5QQe5FPe2TqggU9WtrA9X4nZw7LlVqOI= github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= -github.com/multiformats/go-multiaddr-dns v0.0.2 h1:/Bbsgsy3R6e3jf2qBahzNHzww6usYaZ0NhNH3sqdFS8= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA= -github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= github.com/multiformats/go-multiaddr-net v0.1.2 h1:P7zcBH9FRETdPkDrylcXVjQLQ2t1JQtNItZULWNWgeg= github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y= github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA=