kubo/core
Cory Schwartz a43e506d7f
fix: multibase in pubsub http rpc (#8183)
* multibase encoding on pubsub
* emit multibase for json clients
* refactor(pubsub): base64url for all URL args

This makes it easier to reason about.
Also added better helptext to each command explaining how the binary
data is encoded on the wire, and how to process it in userland.

* refactor: remove ndpayload and lenpayload

Those output formats are undocumented and seem to be only used in tests.
This change removes their implementation and replaces it with error
message to use JSON instead.

I also refactored tests to test the --enc=json response format instead
of imaginary one, making tests more useful as they also act as
regression tests for HTTP RPC.

* test(pubsub): go-ipfs-api

Testing against compatible version from
https://github.com/ipfs/go-ipfs-api/pull/255

* refactor: safeTextListEncoder

Making it clear what it does and why

* refactor(pubsub): unify peerids

This ensures `ipfs pubsub sub` returns the same peerids in the `From`
field as `ipfs pubsub peers`.

libp2p already uses base encoding, no need to double wrap or use custom
multibase.

* test(pubsub): go-ipfs-http-client

* refactor(pubsub): make pub command read from a file

We want to send payload in the body as multipart so users can use
existing tools like curl for publishing arbitrary bytes to a topic.

StringArg was created for "one message per line" use case, and if data
has `\n` or `\r\n` byte sequences, it will cause payload to be split. It
is not possible to undo this, because mentioned sequences are lost, so
we are not able to tell if it was `\n` or `\r\n`

We already avoid this problem in `block put` and `dht put` by reading
payload via FileArg which does not mangle binary data and send it as-is.
It feel like `pubsub pub` should be using it in the first place anyway,
so this commit replaces StringArg with FileArg.

This also closes https://github.com/ipfs/go-ipfs/issues/8454
and makes rpc in go-ipfs easier to code against.

* test(pubsub): publishing with line breaks

Making sure we don't see regressions in the future.
Ref. https://github.com/ipfs/go-ipfs/issues/7939

* chore: disable pubsub interop for now

See
344f692d8c

* test: t0322-pubsub-http-rpc.sh

- Adds HTTP RPC regression test that ensures topic is encoded as URL-safe
  multibase.
- Moves pubsub tests to live in unique range ./t032x

* fix(ci):  js-ipfs with  fixed pubsub wire format

uses js-ipfs from https://github.com/ipfs/js-ipfs/pull/3922 
until js-ipfs release can ship with dependency on go-ipfs 0.11.0-rc1

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2021-11-29 23:06:54 +01:00
..
bootstrap fix(tracing): remove event tracing 2020-01-28 21:31:12 -08:00
commands fix: multibase in pubsub http rpc (#8183) 2021-11-29 23:06:54 +01:00
coreapi feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
coredag gx: unrewrite 2019-03-05 18:33:56 +01:00
corehttp feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
corerepo feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
coreunix feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
mock feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
node feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
.gitignore ignore testdb 2014-07-05 15:04:04 -07:00
builder.go fix: get rid of shutdown errors 2020-03-29 20:48:43 -07:00
core_test.go quic: remove experimental status and add it to the default config 2020-05-22 04:54:19 +02:00
core.go update go-libp2p to v0.15.0-rc.1 2021-08-19 18:05:04 +02:00