status-go/vendor/github.com/libp2p/go-msgio
RichΛrd 40359f9c1b
go-waku integration (#2247)
* Adding wakunode module
* Adding wakuv2 fleet files
* Add waku fleets to update-fleet-config script
* Adding config items for waku v2
* Conditionally start waku v2 node depending on config
* Adapting common code to use go-waku
* Setting log level to info
* update dependencies
* update fleet config to use WakuNodes instead of BootNodes
* send and receive messages
* use hash returned when publishing a message
* add waku store protocol
* trigger signal after receiving store messages
* exclude linting rule SA1019 to check deprecated packages
2021-06-16 16:19:45 -04:00
..
protoio go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
.gxignore migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
.travis.yml go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
LICENSE Add rendezvous implementation for discovery interface 2018-07-25 15:10:57 +03:00
README.md migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
chan.go Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
codecov.yml migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
fuzz.go Add rendezvous implementation for discovery interface 2018-07-25 15:10:57 +03:00
go.mod go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
go.sum go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
limit.go Add rendezvous implementation for discovery interface 2018-07-25 15:10:57 +03:00
msgio.go Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
num.go Add rendezvous implementation for discovery interface 2018-07-25 15:10:57 +03:00
varint.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00

README.md

go-msgio - Message IO

codecov Travis CI Discourse posts

This is a simple package that helps read and write length-delimited slices. It's helpful for building wire protocols.

Usage

Reading

import "github.com/libp2p/go-msgio"
rdr := ... // some reader from a wire
mrdr := msgio.NewReader(rdr)

for {
  msg, err := mrdr.ReadMsg()
  if err != nil {
    return err
  }

  doSomething(msg)
}

Writing

import "github.com/libp2p/go-msgio"
wtr := genReader()
mwtr := msgio.NewWriter(wtr)

for {
  msg := genMessage()
  err := mwtr.WriteMsg(msg)
  if err != nil {
    return err
  }
}

Duplex

import "github.com/libp2p/go-msgio"
rw := genReadWriter()
mrw := msgio.NewReadWriter(rw)

for {
  msg, err := mrdr.ReadMsg()
  if err != nil {
    return err
  }

  // echo it back :)
  err = mwtr.WriteMsg(msg)
  if err != nil {
    return err
  }
}

Channels

import "github.com/libp2p/go-msgio"
rw := genReadWriter()
rch := msgio.NewReadChannel(rw)
wch := msgio.NewWriteChannel(rw)

for {
  msg, err := <-rch
  if err != nil {
    return err
  }

  // echo it back :)
  wch<- rw
}

The last gx published version of this module was: 0.0.6: QmcxL9MDzSU5Mj1GcWZD8CXkAFuJXjdbjotZ93o371bKSf