mirror of
https://github.com/status-im/status-go.git
synced 2025-01-11 23:25:29 +00:00
0babdad17b
* chore: upgrade go-waku to v0.5 * chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219) * feat: add wakuv2 test (#3218)
41 lines
634 B
Go
41 lines
634 B
Go
// Package pbio reads and writes varint-prefix protobufs, using Google's Protobuf package.
|
|
package pbio
|
|
|
|
import (
|
|
"io"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
type Writer interface {
|
|
WriteMsg(proto.Message) error
|
|
}
|
|
|
|
type WriteCloser interface {
|
|
Writer
|
|
io.Closer
|
|
}
|
|
|
|
type Reader interface {
|
|
ReadMsg(msg proto.Message) error
|
|
}
|
|
|
|
type ReadCloser interface {
|
|
Reader
|
|
io.Closer
|
|
}
|
|
|
|
func getSize(v interface{}) (int, bool) {
|
|
if sz, ok := v.(interface {
|
|
Size() (n int)
|
|
}); ok {
|
|
return sz.Size(), true
|
|
} else if sz, ok := v.(interface {
|
|
ProtoSize() (n int)
|
|
}); ok {
|
|
return sz.ProtoSize(), true
|
|
} else {
|
|
return 0, false
|
|
}
|
|
}
|