mirror of https://github.com/status-im/go-waku.git
chore: switch to Google's Protobuf library
This commit is contained in:
parent
335f7b6771
commit
156db781f6
6
Makefile
6
Makefile
|
@ -85,11 +85,7 @@ _after-cc:
|
||||||
test-ci: _before-cc test _after-cc
|
test-ci: _before-cc test _after-cc
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
${GOBIN} generate ./waku/v2/protocol/pb/generate.go
|
${GOBIN} generate ./...
|
||||||
${GOBIN} generate ./waku/persistence/sqlite/migrations/sql
|
|
||||||
${GOBIN} generate ./waku/persistence/postgres/migrations/sql
|
|
||||||
${GOBIN} generate ./waku/v2/protocol/rln/contracts/generate.go
|
|
||||||
${GOBIN} generate ./waku/v2/protocol/rln/doc.go
|
|
||||||
|
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"database/sql"
|
|
||||||
"fmt"
|
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
_ "github.com/mattn/go-sqlite3" // Blank import to register the sqlite3 driver
|
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/persistence"
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
const secondsMonth = int64(30 * time.Hour * 24)
|
|
||||||
|
|
||||||
func genRandomBytes(size int) (blk []byte, err error) {
|
|
||||||
blk = make([]byte, size)
|
|
||||||
_, err = rand.Read(blk)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func genRandomTimestamp(t30daysAgo int64) int64 {
|
|
||||||
return rand.Int63n(secondsMonth) + t30daysAgo
|
|
||||||
}
|
|
||||||
|
|
||||||
func genRandomContentTopic(n int) string {
|
|
||||||
topics := []string{"topic1", "topic2", "topic3", "topic4", "topic5"}
|
|
||||||
i := n % 5
|
|
||||||
return protocol.NewContentTopic("test", 1, topics[i], "plaintext").String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func newdb(path string) (*sql.DB, error) {
|
|
||||||
db, err := sql.Open("sqlite3", path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return db, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func createTable(db *sql.DB) error {
|
|
||||||
sqlStmt := `
|
|
||||||
PRAGMA journal_mode=WAL;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS message (
|
|
||||||
id BLOB,
|
|
||||||
receiverTimestamp INTEGER NOT NULL,
|
|
||||||
senderTimestamp INTEGER NOT NULL,
|
|
||||||
contentTopic BLOB NOT NULL,
|
|
||||||
pubsubTopic BLOB NOT NULL,
|
|
||||||
payload BLOB,
|
|
||||||
version INTEGER NOT NULL DEFAULT 0,
|
|
||||||
CONSTRAINT messageIndex PRIMARY KEY (id, pubsubTopic)
|
|
||||||
) WITHOUT ROWID;
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS message_senderTimestamp ON message(senderTimestamp);
|
|
||||||
CREATE INDEX IF NOT EXISTS message_receiverTimestamp ON message(receiverTimestamp);
|
|
||||||
`
|
|
||||||
_, err := db.Exec(sqlStmt)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
Ns := []int{10_000, 100_000, 1_000_000}
|
|
||||||
|
|
||||||
for _, N := range Ns {
|
|
||||||
dbName := fmt.Sprintf("store%d.db", N)
|
|
||||||
fmt.Println("Inserting ", N, " records in ", dbName)
|
|
||||||
|
|
||||||
db, err := newdb(dbName)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer db.Close()
|
|
||||||
|
|
||||||
query := "INSERT INTO message (id, receiverTimestamp, senderTimestamp, contentTopic, pubsubTopic, payload, version) VALUES (?, ?, ?, ?, ?, ?, ?)"
|
|
||||||
|
|
||||||
err = createTable(db)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
trx, err := db.BeginTx(context.Background(), nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt, err := trx.Prepare(query)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t30daysAgo := time.Now().UnixNano() - secondsMonth
|
|
||||||
pubsubTopic := protocol.DefaultPubsubTopic().String()
|
|
||||||
for i := 1; i <= N; i++ {
|
|
||||||
|
|
||||||
if i%1000 == 0 && i > 1 && i < N {
|
|
||||||
err := trx.Commit()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
trx, err = db.BeginTx(context.Background(), nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
stmt, err = trx.Prepare(query)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if i%(N/10) == 0 && i > 1 {
|
|
||||||
fmt.Println(i, "...")
|
|
||||||
}
|
|
||||||
|
|
||||||
randPayload, err := genRandomBytes(100)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg := pb.WakuMessage{
|
|
||||||
Version: 0,
|
|
||||||
ContentTopic: genRandomContentTopic(i),
|
|
||||||
Timestamp: genRandomTimestamp(t30daysAgo),
|
|
||||||
Payload: randPayload,
|
|
||||||
}
|
|
||||||
|
|
||||||
envelope := protocol.NewEnvelope(&msg, msg.Timestamp, pubsubTopic)
|
|
||||||
dbKey := persistence.NewDBKey(uint64(msg.Timestamp), uint64(time.Now().UnixNano()), pubsubTopic, envelope.Index().Digest)
|
|
||||||
|
|
||||||
_, err = stmt.Exec(dbKey.Bytes(), msg.Timestamp, msg.Timestamp, msg.ContentTopic, pubsubTopic, msg.Payload, msg.Version)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = trx.Commit()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,8 +8,8 @@ replace github.com/ethereum/go-ethereum v1.10.25 => github.com/status-im/go-ethe
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ethereum/go-ethereum v1.10.25
|
github.com/ethereum/go-ethereum v1.10.25
|
||||||
github.com/ipfs/go-log/v2 v2.5.1
|
|
||||||
github.com/waku-org/go-waku v0.2.3-0.20221109195301-b2a5a68d28ba
|
github.com/waku-org/go-waku v0.2.3-0.20221109195301-b2a5a68d28ba
|
||||||
|
go.uber.org/zap v1.23.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -53,6 +53,7 @@ require (
|
||||||
github.com/huin/goupnp v1.0.3 // indirect
|
github.com/huin/goupnp v1.0.3 // indirect
|
||||||
github.com/ipfs/go-cid v0.3.2 // indirect
|
github.com/ipfs/go-cid v0.3.2 // indirect
|
||||||
github.com/ipfs/go-log v1.0.5 // indirect
|
github.com/ipfs/go-log v1.0.5 // indirect
|
||||||
|
github.com/ipfs/go-log/v2 v2.5.1 // indirect
|
||||||
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
|
||||||
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
|
||||||
github.com/karalabe/usb v0.0.2 // indirect
|
github.com/karalabe/usb v0.0.2 // indirect
|
||||||
|
@ -66,7 +67,7 @@ require (
|
||||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
||||||
github.com/libp2p/go-mplex v0.7.0 // indirect
|
github.com/libp2p/go-mplex v0.7.0 // indirect
|
||||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
github.com/libp2p/go-msgio v0.3.0 // indirect
|
||||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||||
|
@ -125,7 +126,6 @@ require (
|
||||||
go.opencensus.io v0.23.0 // indirect
|
go.opencensus.io v0.23.0 // indirect
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
go.uber.org/atomic v1.10.0 // indirect
|
||||||
go.uber.org/multierr v1.8.0 // indirect
|
go.uber.org/multierr v1.8.0 // indirect
|
||||||
go.uber.org/zap v1.23.0 // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||||
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
|
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||||
|
|
|
@ -443,8 +443,8 @@ github.com/libp2p/go-libp2p-pubsub v0.8.1/go.mod h1:e4kT+DYjzPUYGZeWk4I+oxCSYTXi
|
||||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||||
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
||||||
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
||||||
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
|
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||||
github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY=
|
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
|
||||||
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
||||||
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
||||||
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
||||||
|
|
|
@ -11,7 +11,6 @@ require (
|
||||||
github.com/charmbracelet/bubbletea v0.22.0
|
github.com/charmbracelet/bubbletea v0.22.0
|
||||||
github.com/charmbracelet/lipgloss v0.5.0
|
github.com/charmbracelet/lipgloss v0.5.0
|
||||||
github.com/ethereum/go-ethereum v1.10.25
|
github.com/ethereum/go-ethereum v1.10.25
|
||||||
github.com/golang/protobuf v1.5.2
|
|
||||||
github.com/ipfs/go-log/v2 v2.5.1
|
github.com/ipfs/go-log/v2 v2.5.1
|
||||||
github.com/libp2p/go-libp2p v0.23.2
|
github.com/libp2p/go-libp2p v0.23.2
|
||||||
github.com/muesli/reflow v0.3.0
|
github.com/muesli/reflow v0.3.0
|
||||||
|
@ -58,6 +57,7 @@ require (
|
||||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/gopacket v1.1.19 // indirect
|
github.com/google/gopacket v1.1.19 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
@ -80,7 +80,7 @@ require (
|
||||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
||||||
github.com/libp2p/go-mplex v0.7.0 // indirect
|
github.com/libp2p/go-mplex v0.7.0 // indirect
|
||||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
github.com/libp2p/go-msgio v0.3.0 // indirect
|
||||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||||
|
|
|
@ -459,8 +459,8 @@ github.com/libp2p/go-libp2p-pubsub v0.8.1/go.mod h1:e4kT+DYjzPUYGZeWk4I+oxCSYTXi
|
||||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||||
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
||||||
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
||||||
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
|
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||||
github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY=
|
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
|
||||||
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
||||||
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
||||||
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.14.0
|
// protoc v3.21.12
|
||||||
// source: chat2.proto
|
// source: chat2.proto
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
@ -21,10 +20,6 @@ const (
|
||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
type Chat2Message struct {
|
type Chat2Message struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mchat2.proto=./pb --go_out=. ./chat2.proto
|
|
@ -66,7 +66,7 @@ require (
|
||||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
github.com/libp2p/go-libp2p-pubsub v0.8.1 // indirect
|
||||||
github.com/libp2p/go-mplex v0.7.0 // indirect
|
github.com/libp2p/go-mplex v0.7.0 // indirect
|
||||||
github.com/libp2p/go-msgio v0.2.0 // indirect
|
github.com/libp2p/go-msgio v0.3.0 // indirect
|
||||||
github.com/libp2p/go-nat v0.1.0 // indirect
|
github.com/libp2p/go-nat v0.1.0 // indirect
|
||||||
github.com/libp2p/go-netroute v0.2.0 // indirect
|
github.com/libp2p/go-netroute v0.2.0 // indirect
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
github.com/libp2p/go-openssl v0.1.0 // indirect
|
||||||
|
|
|
@ -443,8 +443,8 @@ github.com/libp2p/go-libp2p-pubsub v0.8.1/go.mod h1:e4kT+DYjzPUYGZeWk4I+oxCSYTXi
|
||||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||||
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
||||||
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
||||||
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
|
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||||
github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY=
|
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
|
||||||
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
||||||
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
||||||
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "google.golang.org/protobuf/proto"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
12
go.mod
12
go.mod
|
@ -9,15 +9,14 @@ require (
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.2.1
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1
|
||||||
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d
|
github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d
|
||||||
github.com/ethereum/go-ethereum v1.10.25
|
github.com/ethereum/go-ethereum v1.10.25
|
||||||
github.com/gogo/protobuf v1.3.2
|
|
||||||
github.com/golang-migrate/migrate/v4 v4.15.2
|
github.com/golang-migrate/migrate/v4 v4.15.2
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/gorilla/rpc v1.2.0
|
github.com/gorilla/rpc v1.2.0
|
||||||
github.com/ipfs/go-ds-sql v0.3.0
|
github.com/ipfs/go-ds-sql v0.3.0
|
||||||
github.com/ipfs/go-log/v2 v2.5.1
|
github.com/ipfs/go-log/v2 v2.5.1
|
||||||
github.com/libp2p/go-libp2p v0.23.2
|
github.com/libp2p/go-libp2p v0.23.2
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.8.1
|
github.com/libp2p/go-libp2p-pubsub v0.8.1
|
||||||
github.com/libp2p/go-msgio v0.2.0
|
github.com/libp2p/go-msgio v0.3.0
|
||||||
github.com/mattn/go-sqlite3 v1.14.15
|
github.com/mattn/go-sqlite3 v1.14.15
|
||||||
github.com/multiformats/go-multiaddr v0.7.0
|
github.com/multiformats/go-multiaddr v0.7.0
|
||||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||||
|
@ -41,7 +40,10 @@ require (
|
||||||
github.com/waku-org/go-noise v0.0.4
|
github.com/waku-org/go-noise v0.0.4
|
||||||
)
|
)
|
||||||
|
|
||||||
require github.com/BurntSushi/toml v1.2.1 // indirect
|
require (
|
||||||
|
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||||
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
||||||
|
@ -162,7 +164,7 @@ require (
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
|
||||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||||
golang.org/x/tools v0.1.12 // indirect
|
golang.org/x/tools v0.1.12 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1
|
||||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1034,8 +1034,8 @@ github.com/libp2p/go-libp2p-pubsub v0.8.1/go.mod h1:e4kT+DYjzPUYGZeWk4I+oxCSYTXi
|
||||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||||
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
|
||||||
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
|
||||||
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
|
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||||
github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY=
|
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
|
||||||
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
||||||
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM=
|
||||||
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/multiformats/go-multiaddr"
|
"github.com/multiformats/go-multiaddr"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,12 +7,12 @@ import (
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FilterArgument struct {
|
type FilterArgument struct {
|
||||||
Topic string `json:"pubsubTopic,omitempty"`
|
Topic string `json:"pubsubTopic,omitempty"`
|
||||||
ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"`
|
ContentFilters []*pb.FilterRequest_ContentFilter `json:"contentFilters,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func toContentFilter(filterJSON string) (filter.ContentFilter, error) {
|
func toContentFilter(filterJSON string) (filter.ContentFilter, error) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
|
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
|
||||||
)
|
)
|
||||||
|
|
||||||
func lightpushPublish(msg pb.WakuMessage, pubsubTopic string, peerID string, ms int) (string, error) {
|
func lightpushPublish(msg *pb.WakuMessage, pubsubTopic string, peerID string, ms int) (string, error) {
|
||||||
if wakuNode == nil {
|
if wakuNode == nil {
|
||||||
return "", errWakuNodeNotReady
|
return "", errWakuNodeNotReady
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func lightpushPublish(msg pb.WakuMessage, pubsubTopic string, peerID string, ms
|
||||||
lpOptions = append(lpOptions, lightpush.WithAutomaticPeerSelection())
|
lpOptions = append(lpOptions, lightpush.WithAutomaticPeerSelection())
|
||||||
}
|
}
|
||||||
|
|
||||||
hash, err := wakuNode.Lightpush().PublishToTopic(ctx, &msg, pubsubTopic, lpOptions...)
|
hash, err := wakuNode.Lightpush().PublishToTopic(ctx, msg, pubsubTopic, lpOptions...)
|
||||||
return hexutil.Encode(hash), err
|
return hexutil.Encode(hash), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ func RelayEnoughPeers(topic string) string {
|
||||||
return PrepareJSONResponse(wakuNode.Relay().EnoughPeersToPublishToTopic(topicToCheck), nil)
|
return PrepareJSONResponse(wakuNode.Relay().EnoughPeersToPublishToTopic(topicToCheck), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func relayPublish(msg pb.WakuMessage, pubsubTopic string, ms int) (string, error) {
|
func relayPublish(msg *pb.WakuMessage, pubsubTopic string, ms int) (string, error) {
|
||||||
if wakuNode == nil {
|
if wakuNode == nil {
|
||||||
return "", errWakuNodeNotReady
|
return "", errWakuNodeNotReady
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ func relayPublish(msg pb.WakuMessage, pubsubTopic string, ms int) (string, error
|
||||||
ctx = context.Background()
|
ctx = context.Background()
|
||||||
}
|
}
|
||||||
|
|
||||||
hash, err := wakuNode.Relay().PublishToTopic(ctx, &msg, pubsubTopic)
|
hash, err := wakuNode.Relay().PublishToTopic(ctx, msg, pubsubTopic)
|
||||||
return hexutil.Encode(hash), err
|
return hexutil.Encode(hash), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ import (
|
||||||
"C"
|
"C"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
)
|
)
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
@ -21,15 +22,15 @@ type storePagingOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type storeMessagesArgs struct {
|
type storeMessagesArgs struct {
|
||||||
Topic string `json:"pubsubTopic,omitempty"`
|
Topic string `json:"pubsubTopic,omitempty"`
|
||||||
ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"`
|
ContentFilters []*pb.ContentFilter `json:"contentFilters,omitempty"`
|
||||||
StartTime int64 `json:"startTime,omitempty"`
|
StartTime int64 `json:"startTime,omitempty"`
|
||||||
EndTime int64 `json:"endTime,omitempty"`
|
EndTime int64 `json:"endTime,omitempty"`
|
||||||
PagingOptions storePagingOptions `json:"pagingOptions,omitempty"`
|
PagingOptions storePagingOptions `json:"pagingOptions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type storeMessagesReply struct {
|
type storeMessagesReply struct {
|
||||||
Messages []*pb.WakuMessage `json:"messages,omitempty"`
|
Messages []*wpb.WakuMessage `json:"messages,omitempty"`
|
||||||
PagingInfo storePagingOptions `json:"pagingInfo,omitempty"`
|
PagingInfo storePagingOptions `json:"pagingInfo,omitempty"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,14 @@ import (
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func wakuMessage(messageJSON string) (pb.WakuMessage, error) {
|
func wakuMessage(messageJSON string) (*pb.WakuMessage, error) {
|
||||||
var msg pb.WakuMessage
|
var msg *pb.WakuMessage
|
||||||
err := json.Unmarshal([]byte(messageJSON), &msg)
|
err := json.Unmarshal([]byte(messageJSON), &msg)
|
||||||
msg.Version = 0
|
msg.Version = 0
|
||||||
return msg, err
|
return msg, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func wakuMessageSymmetricEncoding(messageJSON string, symmetricKey string, optionalSigningKey string) (pb.WakuMessage, error) {
|
func wakuMessageSymmetricEncoding(messageJSON string, symmetricKey string, optionalSigningKey string) (*pb.WakuMessage, error) {
|
||||||
msg, err := wakuMessage(messageJSON)
|
msg, err := wakuMessage(messageJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return msg, err
|
return msg, err
|
||||||
|
@ -54,7 +54,7 @@ func wakuMessageSymmetricEncoding(messageJSON string, symmetricKey string, optio
|
||||||
return msg, err
|
return msg, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func wakuMessageAsymmetricEncoding(messageJSON string, publicKey string, optionalSigningKey string) (pb.WakuMessage, error) {
|
func wakuMessageAsymmetricEncoding(messageJSON string, publicKey string, optionalSigningKey string) (*pb.WakuMessage, error) {
|
||||||
msg, err := wakuMessage(messageJSON)
|
msg, err := wakuMessage(messageJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return msg, err
|
return msg, err
|
||||||
|
|
|
@ -88,7 +88,7 @@ func _1_messagesDownSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1672850685, 0)}
|
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ func _1_messagesUpSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 452, mode: os.FileMode(0664), modTime: time.Unix(1672853147, 0)}
|
info := bindataFileInfo{name: "1_messages.up.sql", size: 452, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe4, 0x17, 0xde, 0xd4, 0x55, 0x47, 0x7f, 0x61, 0xe6, 0xbd, 0x2e, 0x89, 0xb5, 0x7, 0xe1, 0x31, 0x1b, 0xd3, 0x20, 0x3d, 0x3e, 0x68, 0x54, 0xfe, 0xd3, 0x62, 0x51, 0x87, 0x5f, 0xbf, 0x57, 0x64}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe4, 0x17, 0xde, 0xd4, 0x55, 0x47, 0x7f, 0x61, 0xe6, 0xbd, 0x2e, 0x89, 0xb5, 0x7, 0xe1, 0x31, 0x1b, 0xd3, 0x20, 0x3d, 0x3e, 0x68, 0x54, 0xfe, 0xd3, 0x62, 0x51, 0x87, 0x5f, 0xbf, 0x57, 0x64}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func _2_messages_indexDownSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1672850685, 0)}
|
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ func _2_messages_indexUpSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1672850685, 0)}
|
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ func docGo() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1672850685, 0)}
|
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func _1_messagesDownSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1667483667, 0)}
|
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ func _1_messagesUpSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 464, mode: os.FileMode(0664), modTime: time.Unix(1667483667, 0)}
|
info := bindataFileInfo{name: "1_messages.up.sql", size: 464, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4, 0xd8, 0x47, 0x7b, 0xe, 0x47, 0x2a, 0x4b, 0x48, 0x36, 0x23, 0x93, 0x28, 0xb3, 0x1e, 0x5, 0x76, 0x64, 0x73, 0xb, 0x2b, 0x5b, 0x10, 0x62, 0x36, 0x21, 0x6f, 0xa3, 0x3c, 0xdd, 0xe2, 0xcf}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4, 0xd8, 0x47, 0x7b, 0xe, 0x47, 0x2a, 0x4b, 0x48, 0x36, 0x23, 0x93, 0x28, 0xb3, 0x1e, 0x5, 0x76, 0x64, 0x73, 0xb, 0x2b, 0x5b, 0x10, 0x62, 0x36, 0x21, 0x6f, 0xa3, 0x3c, 0xdd, 0xe2, 0xcf}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func _2_messages_indexDownSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1667483667, 0)}
|
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ func _2_messages_indexUpSql() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1667483667, 0)}
|
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ func docGo() (*asset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1667483667, 0)}
|
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -52,7 +53,7 @@ type StoredMessage struct {
|
||||||
ID []byte
|
ID []byte
|
||||||
PubsubTopic string
|
PubsubTopic string
|
||||||
ReceiverTime int64
|
ReceiverTime int64
|
||||||
Message *pb.WakuMessage
|
Message *wpb.WakuMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
// DBOption is an optional setting that can be used to configure the DBStore
|
// DBOption is an optional setting that can be used to configure the DBStore
|
||||||
|
@ -451,7 +452,7 @@ func (d *DBStore) GetStoredMessage(row *sql.Rows) (StoredMessage, error) {
|
||||||
return StoredMessage{}, err
|
return StoredMessage{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := new(pb.WakuMessage)
|
msg := new(wpb.WakuMessage)
|
||||||
msg.ContentTopic = contentTopic
|
msg.ContentTopic = contentTopic
|
||||||
msg.Payload = payload
|
msg.Payload = payload
|
||||||
msg.Timestamp = senderTimestamp
|
msg.Timestamp = senderTimestamp
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/gogo/protobuf/protoc-gen-gofast"
|
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,14 +3,15 @@ package protocol
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Envelope contains information about the pubsub topic of a WakuMessage
|
// Envelope contains information about the pubsub topic of a WakuMessage
|
||||||
// and a hash used to identify a message based on the bytes of a WakuMessage
|
// and a hash used to identify a message based on the bytes of a WakuMessage
|
||||||
// protobuffer
|
// protobuffer
|
||||||
type Envelope struct {
|
type Envelope struct {
|
||||||
msg *pb.WakuMessage
|
msg *wpb.WakuMessage
|
||||||
size int
|
size int
|
||||||
hash []byte
|
hash []byte
|
||||||
index *pb.Index
|
index *pb.Index
|
||||||
|
@ -19,7 +20,7 @@ type Envelope struct {
|
||||||
// NewEnvelope creates a new Envelope that contains a WakuMessage
|
// NewEnvelope creates a new Envelope that contains a WakuMessage
|
||||||
// It's used as a way to know to which Pubsub topic belongs a WakuMessage
|
// It's used as a way to know to which Pubsub topic belongs a WakuMessage
|
||||||
// as well as generating a hash based on the bytes that compose the message
|
// as well as generating a hash based on the bytes that compose the message
|
||||||
func NewEnvelope(msg *pb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope {
|
func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope {
|
||||||
messageHash, dataLen, _ := msg.Hash()
|
messageHash, dataLen, _ := msg.Hash()
|
||||||
hash := sha256.Sum256(append([]byte(msg.ContentTopic), msg.Payload...))
|
hash := sha256.Sum256(append([]byte(msg.ContentTopic), msg.Payload...))
|
||||||
return &Envelope{
|
return &Envelope{
|
||||||
|
@ -36,7 +37,7 @@ func NewEnvelope(msg *pb.WakuMessage, receiverTime int64, pubSubTopic string) *E
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message returns the WakuMessage associated to an Envelope
|
// Message returns the WakuMessage associated to an Envelope
|
||||||
func (e *Envelope) Message() *pb.WakuMessage {
|
func (e *Envelope) Message() *wpb.WakuMessage {
|
||||||
return e.msg
|
return e.msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Subscriber struct {
|
type Subscriber struct {
|
||||||
peer peer.ID
|
peer peer.ID
|
||||||
requestId string
|
requestId string
|
||||||
filter pb.FilterRequest // @TODO MAKE THIS A SEQUENCE AGAIN?
|
filter *pb.FilterRequest // @TODO MAKE THIS A SEQUENCE AGAIN?
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sub Subscriber) HasContentTopic(topic string) bool {
|
func (sub Subscriber) HasContentTopic(topic string) bool {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/libp2p/go-libp2p/core/test"
|
"github.com/libp2p/go-libp2p/core/test"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
const TOPIC = "/test/topic"
|
const TOPIC = "/test/topic"
|
||||||
|
@ -30,7 +30,7 @@ func TestAppend(t *testing.T) {
|
||||||
peerId := createPeerId(t)
|
peerId := createPeerId(t)
|
||||||
requestId := "request_1"
|
requestId := "request_1"
|
||||||
contentTopic := "topic1"
|
contentTopic := "topic1"
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
||||||
|
@ -46,7 +46,7 @@ func TestRemove(t *testing.T) {
|
||||||
peerId := createPeerId(t)
|
peerId := createPeerId(t)
|
||||||
requestId := "request_1"
|
requestId := "request_1"
|
||||||
contentTopic := "topic1"
|
contentTopic := "topic1"
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
||||||
|
@ -64,7 +64,7 @@ func TestRemovePartial(t *testing.T) {
|
||||||
requestId := "request_1"
|
requestId := "request_1"
|
||||||
topic1 := "topic1"
|
topic1 := "topic1"
|
||||||
topic2 := "topic2"
|
topic2 := "topic2"
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic1}, {ContentTopic: topic2}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic1}, {ContentTopic: topic2}},
|
||||||
|
@ -83,12 +83,12 @@ func TestRemoveDuplicateSubscriptions(t *testing.T) {
|
||||||
topic := "topic"
|
topic := "topic"
|
||||||
requestId1 := "request_1"
|
requestId1 := "request_1"
|
||||||
requestId2 := "request_2"
|
requestId2 := "request_2"
|
||||||
request1 := pb.FilterRequest{
|
request1 := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
||||||
}
|
}
|
||||||
request2 := pb.FilterRequest{
|
request2 := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
||||||
|
@ -108,12 +108,12 @@ func TestRemoveDuplicateSubscriptionsPartial(t *testing.T) {
|
||||||
topic := "topic"
|
topic := "topic"
|
||||||
requestId1 := "request_1"
|
requestId1 := "request_1"
|
||||||
requestId2 := "request_2"
|
requestId2 := "request_2"
|
||||||
request1 := pb.FilterRequest{
|
request1 := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
||||||
}
|
}
|
||||||
request2 := pb.FilterRequest{
|
request2 := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}},
|
||||||
|
@ -132,7 +132,7 @@ func TestRemoveBogus(t *testing.T) {
|
||||||
peerId := createPeerId(t)
|
peerId := createPeerId(t)
|
||||||
requestId := "request_1"
|
requestId := "request_1"
|
||||||
contentTopic := "topic1"
|
contentTopic := "topic1"
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: TOPIC,
|
Topic: TOPIC,
|
||||||
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}},
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I./../../pb/. -I. --go_opt=paths=source_relative --go_opt=Mwaku_filter.proto=github.com/waku-org/go-waku/waku/v2/protocol/filter/pb --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_filter.proto
|
|
@ -0,0 +1,381 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_filter.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
pb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type FilterRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Subscribe bool `protobuf:"varint,1,opt,name=subscribe,proto3" json:"subscribe,omitempty"`
|
||||||
|
Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
|
||||||
|
ContentFilters []*FilterRequest_ContentFilter `protobuf:"bytes,3,rep,name=contentFilters,proto3" json:"contentFilters,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest) Reset() {
|
||||||
|
*x = FilterRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*FilterRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *FilterRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*FilterRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest) GetSubscribe() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Subscribe
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest) GetTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Topic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest) GetContentFilters() []*FilterRequest_ContentFilter {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContentFilters
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type MessagePush struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Messages []*pb.WakuMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePush) Reset() {
|
||||||
|
*x = MessagePush{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePush) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*MessagePush) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *MessagePush) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use MessagePush.ProtoReflect.Descriptor instead.
|
||||||
|
func (*MessagePush) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePush) GetMessages() []*pb.WakuMessage {
|
||||||
|
if x != nil {
|
||||||
|
return x.Messages
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterRPC struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"`
|
||||||
|
Request *FilterRequest `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
|
||||||
|
Push *MessagePush `protobuf:"bytes,3,opt,name=push,proto3" json:"push,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRPC) Reset() {
|
||||||
|
*x = FilterRPC{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRPC) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*FilterRPC) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *FilterRPC) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterRPC.ProtoReflect.Descriptor instead.
|
||||||
|
func (*FilterRPC) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRPC) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRPC) GetRequest() *FilterRequest {
|
||||||
|
if x != nil {
|
||||||
|
return x.Request
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRPC) GetPush() *MessagePush {
|
||||||
|
if x != nil {
|
||||||
|
return x.Push
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterRequest_ContentFilter struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
ContentTopic string `protobuf:"bytes,1,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest_ContentFilter) Reset() {
|
||||||
|
*x = FilterRequest_ContentFilter{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest_ContentFilter) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*FilterRequest_ContentFilter) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *FilterRequest_ContentFilter) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterRequest_ContentFilter.ProtoReflect.Descriptor instead.
|
||||||
|
func (*FilterRequest_ContentFilter) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_proto_rawDescGZIP(), []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterRequest_ContentFilter) GetContentTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContentTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_filter_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_filter_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x11, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65,
|
||||||
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x01, 0x0a, 0x0d,
|
||||||
|
0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a,
|
||||||
|
0x09, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
|
||||||
|
0x52, 0x09, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,
|
||||||
|
0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69,
|
||||||
|
0x63, 0x12, 0x47, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74,
|
||||||
|
0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x46,
|
||||||
|
0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6e,
|
||||||
|
0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74,
|
||||||
|
0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x33, 0x0a, 0x0d, 0x43, 0x6f,
|
||||||
|
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x63,
|
||||||
|
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x22,
|
||||||
|
0x3a, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x2b,
|
||||||
|
0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||||
|
0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||||
|
0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x7b, 0x0a, 0x09, 0x46,
|
||||||
|
0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x50, 0x43, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75,
|
||||||
|
0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71,
|
||||||
|
0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
|
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6c,
|
||||||
|
0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75,
|
||||||
|
0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x75, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75,
|
||||||
|
0x73, 0x68, 0x52, 0x04, 0x70, 0x75, 0x73, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_filter_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_filter_proto_rawDescData = file_waku_filter_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_filter_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_filter_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_filter_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_filter_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_filter_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_filter_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
|
var file_waku_filter_proto_goTypes = []interface{}{
|
||||||
|
(*FilterRequest)(nil), // 0: pb.FilterRequest
|
||||||
|
(*MessagePush)(nil), // 1: pb.MessagePush
|
||||||
|
(*FilterRPC)(nil), // 2: pb.FilterRPC
|
||||||
|
(*FilterRequest_ContentFilter)(nil), // 3: pb.FilterRequest.ContentFilter
|
||||||
|
(*pb.WakuMessage)(nil), // 4: pb.WakuMessage
|
||||||
|
}
|
||||||
|
var file_waku_filter_proto_depIdxs = []int32{
|
||||||
|
3, // 0: pb.FilterRequest.contentFilters:type_name -> pb.FilterRequest.ContentFilter
|
||||||
|
4, // 1: pb.MessagePush.messages:type_name -> pb.WakuMessage
|
||||||
|
0, // 2: pb.FilterRPC.request:type_name -> pb.FilterRequest
|
||||||
|
1, // 3: pb.FilterRPC.push:type_name -> pb.MessagePush
|
||||||
|
4, // [4:4] is the sub-list for method output_type
|
||||||
|
4, // [4:4] is the sub-list for method input_type
|
||||||
|
4, // [4:4] is the sub-list for extension type_name
|
||||||
|
4, // [4:4] is the sub-list for extension extendee
|
||||||
|
0, // [0:4] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_filter_proto_init() }
|
||||||
|
func file_waku_filter_proto_init() {
|
||||||
|
if File_waku_filter_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_filter_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*FilterRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_filter_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*MessagePush); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_filter_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*FilterRPC); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_filter_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*FilterRequest_ContentFilter); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_filter_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 4,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_filter_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_filter_proto_depIdxs,
|
||||||
|
MessageInfos: file_waku_filter_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_filter_proto = out.File
|
||||||
|
file_waku_filter_proto_rawDesc = nil
|
||||||
|
file_waku_filter_proto_goTypes = nil
|
||||||
|
file_waku_filter_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -11,12 +11,13 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
v2 "github.com/waku-org/go-waku/waku/v2"
|
v2 "github.com/waku-org/go-waku/waku/v2"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"go.opencensus.io/stats"
|
"go.opencensus.io/stats"
|
||||||
|
@ -116,7 +117,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) {
|
||||||
|
|
||||||
filterRPCRequest := &pb.FilterRPC{}
|
filterRPCRequest := &pb.FilterRPC{}
|
||||||
|
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
|
|
||||||
err := reader.ReadMsg(filterRPCRequest)
|
err := reader.ReadMsg(filterRPCRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -139,7 +140,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) {
|
||||||
// We're on a full node.
|
// We're on a full node.
|
||||||
// This is a filter request coming from a light node.
|
// This is a filter request coming from a light node.
|
||||||
if filterRPCRequest.Request.Subscribe {
|
if filterRPCRequest.Request.Subscribe {
|
||||||
subscriber := Subscriber{peer: s.Conn().RemotePeer(), requestId: filterRPCRequest.RequestId, filter: *filterRPCRequest.Request}
|
subscriber := Subscriber{peer: s.Conn().RemotePeer(), requestId: filterRPCRequest.RequestId, filter: filterRPCRequest.Request}
|
||||||
if subscriber.filter.Topic == "" { // @TODO: review if empty topic is possible
|
if subscriber.filter.Topic == "" { // @TODO: review if empty topic is possible
|
||||||
subscriber.filter.Topic = relay.DefaultWakuTopic
|
subscriber.filter.Topic = relay.DefaultWakuTopic
|
||||||
}
|
}
|
||||||
|
@ -162,8 +163,8 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, msg *pb.WakuMessage) error {
|
func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, msg *wpb.WakuMessage) error {
|
||||||
pushRPC := &pb.FilterRPC{RequestId: subscriber.requestId, Push: &pb.MessagePush{Messages: []*pb.WakuMessage{msg}}}
|
pushRPC := &pb.FilterRPC{RequestId: subscriber.requestId, Push: &pb.MessagePush{Messages: []*wpb.WakuMessage{msg}}}
|
||||||
logger := wf.log.With(logging.HostID("peer", subscriber.peer))
|
logger := wf.log.With(logging.HostID("peer", subscriber.peer))
|
||||||
|
|
||||||
// We connect first so dns4 addresses are resolved (NewStream does not do it)
|
// We connect first so dns4 addresses are resolved (NewStream does not do it)
|
||||||
|
@ -184,7 +185,7 @@ func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, ms
|
||||||
}
|
}
|
||||||
|
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
writer := protoio.NewDelimitedWriter(conn)
|
writer := pbio.NewDelimitedWriter(conn)
|
||||||
err = writer.WriteMsg(pushRPC)
|
err = writer.WriteMsg(pushRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("pushing messages to peer", zap.Error(err))
|
logger.Error("pushing messages to peer", zap.Error(err))
|
||||||
|
@ -268,7 +269,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: true,
|
Subscribe: true,
|
||||||
Topic: filter.Topic,
|
Topic: filter.Topic,
|
||||||
ContentFilters: contentFilters,
|
ContentFilters: contentFilters,
|
||||||
|
@ -285,8 +286,8 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil
|
||||||
// This is the only successful path to subscription
|
// This is the only successful path to subscription
|
||||||
requestID := hex.EncodeToString(protocol.GenerateRequestId())
|
requestID := hex.EncodeToString(protocol.GenerateRequestId())
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(conn)
|
writer := pbio.NewDelimitedWriter(conn)
|
||||||
filterRPC := &pb.FilterRPC{RequestId: requestID, Request: &request}
|
filterRPC := &pb.FilterRPC{RequestId: requestID, Request: request}
|
||||||
wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC))
|
wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC))
|
||||||
err = writer.WriteMsg(filterRPC)
|
err = writer.WriteMsg(filterRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -324,14 +325,14 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt
|
||||||
contentFilters = append(contentFilters, &pb.FilterRequest_ContentFilter{ContentTopic: ct})
|
contentFilters = append(contentFilters, &pb.FilterRequest_ContentFilter{ContentTopic: ct})
|
||||||
}
|
}
|
||||||
|
|
||||||
request := pb.FilterRequest{
|
request := &pb.FilterRequest{
|
||||||
Subscribe: false,
|
Subscribe: false,
|
||||||
Topic: contentFilter.Topic,
|
Topic: contentFilter.Topic,
|
||||||
ContentFilters: contentFilters,
|
ContentFilters: contentFilters,
|
||||||
}
|
}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(conn)
|
writer := pbio.NewDelimitedWriter(conn)
|
||||||
filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: &request}
|
filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: request}
|
||||||
err = writer.WriteMsg(filterRPC)
|
err = writer.WriteMsg(filterRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -13,12 +13,13 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
v2 "github.com/waku-org/go-waku/waku/v2"
|
v2 "github.com/waku-org/go-waku/waku/v2"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filterv2/pb"
|
||||||
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"go.opencensus.io/tag"
|
"go.opencensus.io/tag"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -111,7 +112,7 @@ func (wf *WakuFilterLightnode) onRequest(ctx context.Context) func(s network.Str
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
logger := wf.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
logger := wf.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
||||||
|
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
|
|
||||||
messagePush := &pb.MessagePushV2{}
|
messagePush := &pb.MessagePushV2{}
|
||||||
err := reader.ReadMsg(messagePush)
|
err := reader.ReadMsg(messagePush)
|
||||||
|
@ -126,7 +127,7 @@ func (wf *WakuFilterLightnode) onRequest(ctx context.Context) func(s network.Str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wf *WakuFilterLightnode) notify(remotePeerID peer.ID, pubsubTopic string, msg *pb.WakuMessage) {
|
func (wf *WakuFilterLightnode) notify(remotePeerID peer.ID, pubsubTopic string, msg *wpb.WakuMessage) {
|
||||||
envelope := protocol.NewEnvelope(msg, wf.timesource.Now().UnixNano(), pubsubTopic)
|
envelope := protocol.NewEnvelope(msg, wf.timesource.Now().UnixNano(), pubsubTopic)
|
||||||
|
|
||||||
// Broadcasting message so it's stored
|
// Broadcasting message so it's stored
|
||||||
|
@ -149,8 +150,8 @@ func (wf *WakuFilterLightnode) request(ctx context.Context, params *FilterSubscr
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(conn)
|
writer := pbio.NewDelimitedWriter(conn)
|
||||||
reader := protoio.NewDelimitedReader(conn, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(conn, math.MaxInt32)
|
||||||
|
|
||||||
request := &pb.FilterSubscribeRequest{
|
request := &pb.FilterSubscribeRequest{
|
||||||
RequestId: hex.EncodeToString(params.requestId),
|
RequestId: hex.EncodeToString(params.requestId),
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I./../../pb/. -I. --go_opt=paths=source_relative --go_opt=Mwaku_filter_v2.proto=github.com/waku-org/go-waku/waku/v2/protocol/filterv2/pb --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_filter_v2.proto
|
|
@ -0,0 +1,407 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_filter_v2.proto
|
||||||
|
|
||||||
|
// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
pb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type FilterSubscribeRequest_FilterSubscribeType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
FilterSubscribeRequest_SUBSCRIBER_PING FilterSubscribeRequest_FilterSubscribeType = 0
|
||||||
|
FilterSubscribeRequest_SUBSCRIBE FilterSubscribeRequest_FilterSubscribeType = 1
|
||||||
|
FilterSubscribeRequest_UNSUBSCRIBE FilterSubscribeRequest_FilterSubscribeType = 2
|
||||||
|
FilterSubscribeRequest_UNSUBSCRIBE_ALL FilterSubscribeRequest_FilterSubscribeType = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for FilterSubscribeRequest_FilterSubscribeType.
|
||||||
|
var (
|
||||||
|
FilterSubscribeRequest_FilterSubscribeType_name = map[int32]string{
|
||||||
|
0: "SUBSCRIBER_PING",
|
||||||
|
1: "SUBSCRIBE",
|
||||||
|
2: "UNSUBSCRIBE",
|
||||||
|
3: "UNSUBSCRIBE_ALL",
|
||||||
|
}
|
||||||
|
FilterSubscribeRequest_FilterSubscribeType_value = map[string]int32{
|
||||||
|
"SUBSCRIBER_PING": 0,
|
||||||
|
"SUBSCRIBE": 1,
|
||||||
|
"UNSUBSCRIBE": 2,
|
||||||
|
"UNSUBSCRIBE_ALL": 3,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x FilterSubscribeRequest_FilterSubscribeType) Enum() *FilterSubscribeRequest_FilterSubscribeType {
|
||||||
|
p := new(FilterSubscribeRequest_FilterSubscribeType)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x FilterSubscribeRequest_FilterSubscribeType) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FilterSubscribeRequest_FilterSubscribeType) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_waku_filter_v2_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FilterSubscribeRequest_FilterSubscribeType) Type() protoreflect.EnumType {
|
||||||
|
return &file_waku_filter_v2_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x FilterSubscribeRequest_FilterSubscribeType) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterSubscribeRequest_FilterSubscribeType.Descriptor instead.
|
||||||
|
func (FilterSubscribeRequest_FilterSubscribeType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_v2_proto_rawDescGZIP(), []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Protocol identifier: /vac/waku/filter-subscribe/2.0.0-beta1
|
||||||
|
type FilterSubscribeRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
FilterSubscribeType FilterSubscribeRequest_FilterSubscribeType `protobuf:"varint,2,opt,name=filter_subscribe_type,json=filterSubscribeType,proto3,enum=pb.FilterSubscribeRequest_FilterSubscribeType" json:"filter_subscribe_type,omitempty"`
|
||||||
|
// Filter criteria
|
||||||
|
PubsubTopic string `protobuf:"bytes,10,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
||||||
|
ContentTopics []string `protobuf:"bytes,11,rep,name=content_topics,json=contentTopics,proto3" json:"content_topics,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) Reset() {
|
||||||
|
*x = FilterSubscribeRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*FilterSubscribeRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterSubscribeRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*FilterSubscribeRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_v2_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) GetFilterSubscribeType() FilterSubscribeRequest_FilterSubscribeType {
|
||||||
|
if x != nil {
|
||||||
|
return x.FilterSubscribeType
|
||||||
|
}
|
||||||
|
return FilterSubscribeRequest_SUBSCRIBER_PING
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) GetPubsubTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeRequest) GetContentTopics() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContentTopics
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterSubscribeResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
StatusCode uint32 `protobuf:"varint,10,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
|
||||||
|
StatusDesc string `protobuf:"bytes,11,opt,name=status_desc,json=statusDesc,proto3" json:"status_desc,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) Reset() {
|
||||||
|
*x = FilterSubscribeResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*FilterSubscribeResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use FilterSubscribeResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*FilterSubscribeResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_v2_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) GetStatusCode() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.StatusCode
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *FilterSubscribeResponse) GetStatusDesc() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.StatusDesc
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1
|
||||||
|
type MessagePushV2 struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
WakuMessage *pb.WakuMessage `protobuf:"bytes,1,opt,name=waku_message,json=wakuMessage,proto3" json:"waku_message,omitempty"`
|
||||||
|
PubsubTopic string `protobuf:"bytes,2,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePushV2) Reset() {
|
||||||
|
*x = MessagePushV2{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePushV2) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*MessagePushV2) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *MessagePushV2) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_filter_v2_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use MessagePushV2.ProtoReflect.Descriptor instead.
|
||||||
|
func (*MessagePushV2) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_filter_v2_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePushV2) GetWakuMessage() *pb.WakuMessage {
|
||||||
|
if x != nil {
|
||||||
|
return x.WakuMessage
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MessagePushV2) GetPubsubTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_filter_v2_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_filter_v2_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x14, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x32,
|
||||||
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x77, 0x61, 0x6b, 0x75,
|
||||||
|
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc6,
|
||||||
|
0x02, 0x0a, 0x16, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
||||||
|
0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71,
|
||||||
|
0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x62, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74,
|
||||||
|
0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x5f, 0x74, 0x79, 0x70,
|
||||||
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6c,
|
||||||
|
0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||||
|
0x65, 0x73, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||||
|
0x69, 0x62, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x13, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53,
|
||||||
|
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c,
|
||||||
|
0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x0a, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12,
|
||||||
|
0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63,
|
||||||
|
0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||||
|
0x54, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x22, 0x5f, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72,
|
||||||
|
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a,
|
||||||
|
0x0f, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x52, 0x5f, 0x50, 0x49, 0x4e, 0x47,
|
||||||
|
0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45, 0x10,
|
||||||
|
0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42, 0x45,
|
||||||
|
0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x4e, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, 0x49, 0x42,
|
||||||
|
0x45, 0x5f, 0x41, 0x4c, 0x4c, 0x10, 0x03, 0x22, 0x7a, 0x0a, 0x17, 0x46, 0x69, 0x6c, 0x74, 0x65,
|
||||||
|
0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
|
0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49,
|
||||||
|
0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65,
|
||||||
|
0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f,
|
||||||
|
0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64, 0x65, 0x73,
|
||||||
|
0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44,
|
||||||
|
0x65, 0x73, 0x63, 0x22, 0x66, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75,
|
||||||
|
0x73, 0x68, 0x56, 0x32, 0x12, 0x32, 0x0a, 0x0c, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x73,
|
||||||
|
0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e,
|
||||||
|
0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x77, 0x61, 0x6b,
|
||||||
|
0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73,
|
||||||
|
0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||||
|
0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_filter_v2_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_filter_v2_proto_rawDescData = file_waku_filter_v2_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_filter_v2_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_filter_v2_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_filter_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_filter_v2_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_filter_v2_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_filter_v2_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
|
var file_waku_filter_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||||
|
var file_waku_filter_v2_proto_goTypes = []interface{}{
|
||||||
|
(FilterSubscribeRequest_FilterSubscribeType)(0), // 0: pb.FilterSubscribeRequest.FilterSubscribeType
|
||||||
|
(*FilterSubscribeRequest)(nil), // 1: pb.FilterSubscribeRequest
|
||||||
|
(*FilterSubscribeResponse)(nil), // 2: pb.FilterSubscribeResponse
|
||||||
|
(*MessagePushV2)(nil), // 3: pb.MessagePushV2
|
||||||
|
(*pb.WakuMessage)(nil), // 4: pb.WakuMessage
|
||||||
|
}
|
||||||
|
var file_waku_filter_v2_proto_depIdxs = []int32{
|
||||||
|
0, // 0: pb.FilterSubscribeRequest.filter_subscribe_type:type_name -> pb.FilterSubscribeRequest.FilterSubscribeType
|
||||||
|
4, // 1: pb.MessagePushV2.waku_message:type_name -> pb.WakuMessage
|
||||||
|
2, // [2:2] is the sub-list for method output_type
|
||||||
|
2, // [2:2] is the sub-list for method input_type
|
||||||
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
|
2, // [2:2] is the sub-list for extension extendee
|
||||||
|
0, // [0:2] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_filter_v2_proto_init() }
|
||||||
|
func file_waku_filter_v2_proto_init() {
|
||||||
|
if File_waku_filter_v2_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_filter_v2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*FilterSubscribeRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_filter_v2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*FilterSubscribeResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_filter_v2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*MessagePushV2); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_filter_v2_proto_rawDesc,
|
||||||
|
NumEnums: 1,
|
||||||
|
NumMessages: 3,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_filter_v2_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_filter_v2_proto_depIdxs,
|
||||||
|
EnumInfos: file_waku_filter_v2_proto_enumTypes,
|
||||||
|
MessageInfos: file_waku_filter_v2_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_filter_v2_proto = out.File
|
||||||
|
file_waku_filter_v2_proto_rawDesc = nil
|
||||||
|
file_waku_filter_v2_proto_goTypes = nil
|
||||||
|
file_waku_filter_v2_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -11,13 +11,13 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
v2 "github.com/waku-org/go-waku/waku/v2"
|
v2 "github.com/waku-org/go-waku/waku/v2"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filterv2/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"go.opencensus.io/tag"
|
"go.opencensus.io/tag"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -87,7 +87,7 @@ func (wf *WakuFilterFull) onRequest(ctx context.Context) func(s network.Stream)
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
logger := wf.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
logger := wf.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
||||||
|
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
|
|
||||||
subscribeRequest := &pb.FilterSubscribeRequest{}
|
subscribeRequest := &pb.FilterSubscribeRequest{}
|
||||||
err := reader.ReadMsg(subscribeRequest)
|
err := reader.ReadMsg(subscribeRequest)
|
||||||
|
@ -125,7 +125,7 @@ func reply(s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequ
|
||||||
response.StatusDesc = http.StatusText(statusCode)
|
response.StatusDesc = http.StatusText(statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(s)
|
writer := pbio.NewDelimitedWriter(s)
|
||||||
err := writer.WriteMsg(response)
|
err := writer.WriteMsg(response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("sending response", zap.Error(err))
|
logger.Error("sending response", zap.Error(err))
|
||||||
|
@ -251,7 +251,7 @@ func (wf *WakuFilterFull) pushMessage(ctx context.Context, peerID peer.ID, env *
|
||||||
}
|
}
|
||||||
|
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
writer := protoio.NewDelimitedWriter(conn)
|
writer := pbio.NewDelimitedWriter(conn)
|
||||||
err = writer.WriteMsg(messagePush)
|
err = writer.WriteMsg(messagePush)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("pushing messages to peer", zap.Error(err))
|
logger.Error("pushing messages to peer", zap.Error(err))
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I./../../pb/. -I. --go_opt=paths=source_relative --go_opt=Mwaku_lightpush.proto=github.com/waku-org/go-waku/waku/v2/protocol/lightpush/pb --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_lightpush.proto
|
|
@ -0,0 +1,316 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_lightpush.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
pb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type PushRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
PubsubTopic string `protobuf:"bytes,1,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
||||||
|
Message *pb.WakuMessage `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRequest) Reset() {
|
||||||
|
*x = PushRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PushRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PushRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PushRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PushRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_lightpush_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRequest) GetPubsubTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRequest) GetMessage() *pb.WakuMessage {
|
||||||
|
if x != nil {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
|
||||||
|
// Error messages, etc
|
||||||
|
Info string `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushResponse) Reset() {
|
||||||
|
*x = PushResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PushResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PushResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PushResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PushResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_lightpush_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushResponse) GetIsSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsSuccess
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushResponse) GetInfo() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Info
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushRPC struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
Query *PushRequest `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
|
||||||
|
Response *PushResponse `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRPC) Reset() {
|
||||||
|
*x = PushRPC{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRPC) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PushRPC) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PushRPC) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_lightpush_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PushRPC.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PushRPC) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_lightpush_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRPC) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRPC) GetQuery() *PushRequest {
|
||||||
|
if x != nil {
|
||||||
|
return x.Query
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PushRPC) GetResponse() *PushResponse {
|
||||||
|
if x != nil {
|
||||||
|
return x.Response
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_lightpush_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_lightpush_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x14, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x70, 0x75, 0x73, 0x68,
|
||||||
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x77, 0x61, 0x6b, 0x75,
|
||||||
|
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5b,
|
||||||
|
0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a,
|
||||||
|
0x0c, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63,
|
||||||
|
0x12, 0x29, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||||
|
0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x41, 0x0a, 0x0c, 0x50,
|
||||||
|
0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69,
|
||||||
|
0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||||
|
0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e,
|
||||||
|
0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x7d,
|
||||||
|
0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x52, 0x50, 0x43, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71,
|
||||||
|
0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72,
|
||||||
|
0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73,
|
||||||
|
0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12,
|
||||||
|
0x2c, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
|
0x6e, 0x73, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_lightpush_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_lightpush_proto_rawDescData = file_waku_lightpush_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_lightpush_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_lightpush_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_lightpush_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_lightpush_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_lightpush_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_lightpush_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||||
|
var file_waku_lightpush_proto_goTypes = []interface{}{
|
||||||
|
(*PushRequest)(nil), // 0: pb.PushRequest
|
||||||
|
(*PushResponse)(nil), // 1: pb.PushResponse
|
||||||
|
(*PushRPC)(nil), // 2: pb.PushRPC
|
||||||
|
(*pb.WakuMessage)(nil), // 3: pb.WakuMessage
|
||||||
|
}
|
||||||
|
var file_waku_lightpush_proto_depIdxs = []int32{
|
||||||
|
3, // 0: pb.PushRequest.message:type_name -> pb.WakuMessage
|
||||||
|
0, // 1: pb.PushRPC.query:type_name -> pb.PushRequest
|
||||||
|
1, // 2: pb.PushRPC.response:type_name -> pb.PushResponse
|
||||||
|
3, // [3:3] is the sub-list for method output_type
|
||||||
|
3, // [3:3] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_lightpush_proto_init() }
|
||||||
|
func file_waku_lightpush_proto_init() {
|
||||||
|
if File_waku_lightpush_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_lightpush_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PushRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_lightpush_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PushResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_lightpush_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PushRPC); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_lightpush_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 3,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_lightpush_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_lightpush_proto_depIdxs,
|
||||||
|
MessageInfos: file_waku_lightpush_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_lightpush_proto = out.File
|
||||||
|
file_waku_lightpush_proto_rawDesc = nil
|
||||||
|
file_waku_lightpush_proto_goTypes = nil
|
||||||
|
file_waku_lightpush_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -9,11 +9,12 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/host"
|
"github.com/libp2p/go-libp2p/core/host"
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush/pb"
|
||||||
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -70,8 +71,8 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea
|
||||||
logger := wakuLP.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
logger := wakuLP.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
||||||
requestPushRPC := &pb.PushRPC{}
|
requestPushRPC := &pb.PushRPC{}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(s)
|
writer := pbio.NewDelimitedWriter(s)
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
|
|
||||||
err := reader.ReadMsg(requestPushRPC)
|
err := reader.ReadMsg(requestPushRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -169,8 +170,8 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o
|
||||||
|
|
||||||
pushRequestRPC := &pb.PushRPC{RequestId: hex.EncodeToString(params.requestId), Query: req}
|
pushRequestRPC := &pb.PushRPC{RequestId: hex.EncodeToString(params.requestId), Query: req}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(connOpt)
|
writer := pbio.NewDelimitedWriter(connOpt)
|
||||||
reader := protoio.NewDelimitedReader(connOpt, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(connOpt, math.MaxInt32)
|
||||||
|
|
||||||
err = writer.WriteMsg(pushRequestRPC)
|
err = writer.WriteMsg(pushRequestRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -200,7 +201,7 @@ func (wakuLP *WakuLightPush) Stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PublishToTopic is used to broadcast a WakuMessage to a pubsub topic via lightpush protocol
|
// PublishToTopic is used to broadcast a WakuMessage to a pubsub topic via lightpush protocol
|
||||||
func (wakuLP *WakuLightPush) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string, opts ...LightPushOption) ([]byte, error) {
|
func (wakuLP *WakuLightPush) PublishToTopic(ctx context.Context, message *wpb.WakuMessage, topic string, opts ...LightPushOption) ([]byte, error) {
|
||||||
if message == nil {
|
if message == nil {
|
||||||
return nil, errors.New("message can't be null")
|
return nil, errors.New("message can't be null")
|
||||||
}
|
}
|
||||||
|
@ -224,6 +225,6 @@ func (wakuLP *WakuLightPush) PublishToTopic(ctx context.Context, message *pb.Wak
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish is used to broadcast a WakuMessage to the default waku pubsub topic via lightpush protocol
|
// Publish is used to broadcast a WakuMessage to the default waku pubsub topic via lightpush protocol
|
||||||
func (wakuLP *WakuLightPush) Publish(ctx context.Context, message *pb.WakuMessage, opts ...LightPushOption) ([]byte, error) {
|
func (wakuLP *WakuLightPush) Publish(ctx context.Context, message *wpb.WakuMessage, opts ...LightPushOption) ([]byte, error) {
|
||||||
return wakuLP.PublishToTopic(ctx, message, relay.DefaultWakuTopic, opts...)
|
return wakuLP.PublishToTopic(ctx, message, relay.DefaultWakuTopic, opts...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/waku-org/go-waku/tests"
|
"github.com/waku-org/go-waku/tests"
|
||||||
v2 "github.com/waku-org/go-waku/waku/v2"
|
v2 "github.com/waku-org/go-waku/waku/v2"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_filter.proto
|
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_message.proto
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_lightpush.proto
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_message.proto
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_store.proto
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_swap.proto
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_peer_exchange.proto
|
|
||||||
//go:generate protoc -I. --gofast_out=. ./waku_filter_v2.proto
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package pb
|
||||||
import (
|
import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Hash calculates the hash of a waku message
|
// Hash calculates the hash of a waku message
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,916 +0,0 @@
|
||||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
||||||
// source: waku_lightpush.proto
|
|
||||||
|
|
||||||
package pb
|
|
||||||
|
|
||||||
import (
|
|
||||||
fmt "fmt"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
io "io"
|
|
||||||
math "math"
|
|
||||||
math_bits "math/bits"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the proto package it is being compiled against.
|
|
||||||
// A compilation error at this line likely means your copy of the
|
|
||||||
// proto package needs to be updated.
|
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
||||||
|
|
||||||
type PushRequest struct {
|
|
||||||
PubsubTopic string `protobuf:"bytes,1,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
|
||||||
Message *WakuMessage `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRequest) Reset() { *m = PushRequest{} }
|
|
||||||
func (m *PushRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PushRequest) ProtoMessage() {}
|
|
||||||
func (*PushRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_0edfa2f8ec212684, []int{0}
|
|
||||||
}
|
|
||||||
func (m *PushRequest) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PushRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PushRequest.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PushRequest) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PushRequest.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PushRequest) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PushRequest) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PushRequest.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PushRequest proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PushRequest) GetPubsubTopic() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.PubsubTopic
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRequest) GetMessage() *WakuMessage {
|
|
||||||
if m != nil {
|
|
||||||
return m.Message
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushResponse struct {
|
|
||||||
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
|
|
||||||
// Error messages, etc
|
|
||||||
Info string `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) Reset() { *m = PushResponse{} }
|
|
||||||
func (m *PushResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PushResponse) ProtoMessage() {}
|
|
||||||
func (*PushResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_0edfa2f8ec212684, []int{1}
|
|
||||||
}
|
|
||||||
func (m *PushResponse) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PushResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PushResponse.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PushResponse) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PushResponse.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PushResponse) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PushResponse) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PushResponse.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PushResponse proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PushResponse) GetIsSuccess() bool {
|
|
||||||
if m != nil {
|
|
||||||
return m.IsSuccess
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) GetInfo() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Info
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushRPC struct {
|
|
||||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
||||||
Query *PushRequest `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
|
|
||||||
Response *PushResponse `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) Reset() { *m = PushRPC{} }
|
|
||||||
func (m *PushRPC) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PushRPC) ProtoMessage() {}
|
|
||||||
func (*PushRPC) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_0edfa2f8ec212684, []int{2}
|
|
||||||
}
|
|
||||||
func (m *PushRPC) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PushRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PushRPC.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PushRPC) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PushRPC.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PushRPC) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PushRPC) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PushRPC.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PushRPC proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PushRPC) GetRequestId() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.RequestId
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) GetQuery() *PushRequest {
|
|
||||||
if m != nil {
|
|
||||||
return m.Query
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) GetResponse() *PushResponse {
|
|
||||||
if m != nil {
|
|
||||||
return m.Response
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
proto.RegisterType((*PushRequest)(nil), "pb.PushRequest")
|
|
||||||
proto.RegisterType((*PushResponse)(nil), "pb.PushResponse")
|
|
||||||
proto.RegisterType((*PushRPC)(nil), "pb.PushRPC")
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { proto.RegisterFile("waku_lightpush.proto", fileDescriptor_0edfa2f8ec212684) }
|
|
||||||
|
|
||||||
var fileDescriptor_0edfa2f8ec212684 = []byte{
|
|
||||||
// 268 bytes of a gzipped FileDescriptorProto
|
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4f, 0xcc, 0x2e,
|
|
||||||
0x8d, 0xcf, 0xc9, 0x4c, 0xcf, 0x28, 0x29, 0x28, 0x2d, 0xce, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
|
|
||||||
0x17, 0x62, 0x2a, 0x48, 0x92, 0x12, 0x02, 0xcb, 0xe4, 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x42,
|
|
||||||
0xc4, 0x95, 0xa2, 0xb9, 0xb8, 0x03, 0x4a, 0x8b, 0x33, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b,
|
|
||||||
0x84, 0x14, 0xb9, 0x78, 0x0a, 0x4a, 0x93, 0x8a, 0x4b, 0x93, 0xe2, 0x4b, 0xf2, 0x0b, 0x32, 0x93,
|
|
||||||
0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0xb8, 0x21, 0x62, 0x21, 0x20, 0x21, 0x21, 0x4d, 0x2e,
|
|
||||||
0x76, 0xa8, 0x11, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0xfc, 0x7a, 0x05, 0x49, 0x7a, 0xe1,
|
|
||||||
0x89, 0xd9, 0xa5, 0xbe, 0x10, 0xe1, 0x20, 0x98, 0xbc, 0x92, 0x23, 0x17, 0x0f, 0xc4, 0xf0, 0xe2,
|
|
||||||
0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x21, 0x59, 0x2e, 0xae, 0xcc, 0xe2, 0xf8, 0xe2, 0xd2, 0xe4, 0xe4,
|
|
||||||
0xd4, 0xe2, 0x62, 0xb0, 0xd9, 0x1c, 0x41, 0x9c, 0x99, 0xc5, 0xc1, 0x10, 0x01, 0x21, 0x21, 0x2e,
|
|
||||||
0x96, 0xcc, 0xbc, 0xb4, 0x7c, 0xb0, 0xb1, 0x9c, 0x41, 0x60, 0xb6, 0x52, 0x2d, 0x17, 0x3b, 0xd8,
|
|
||||||
0x88, 0x00, 0x67, 0x90, 0xee, 0x22, 0x88, 0x33, 0xe3, 0x33, 0x53, 0xa0, 0x2e, 0xe3, 0x84, 0x8a,
|
|
||||||
0x78, 0xa6, 0x08, 0xa9, 0x72, 0xb1, 0x16, 0x96, 0xa6, 0x16, 0x55, 0x22, 0xbb, 0x0a, 0xc9, 0x6b,
|
|
||||||
0x41, 0x10, 0x59, 0x21, 0x1d, 0x2e, 0x8e, 0x22, 0xa8, 0x7b, 0x24, 0x98, 0xc1, 0x2a, 0x05, 0x10,
|
|
||||||
0x2a, 0x21, 0xe2, 0x41, 0x70, 0x15, 0x4e, 0x02, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7,
|
|
||||||
0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x49, 0x6c, 0xe0, 0x70, 0x33, 0x06, 0x04,
|
|
||||||
0x00, 0x00, 0xff, 0xff, 0x76, 0x20, 0x2e, 0xed, 0x67, 0x01, 0x00, 0x00,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRequest) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRequest) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if m.Message != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Message.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if len(m.PubsubTopic) > 0 {
|
|
||||||
i -= len(m.PubsubTopic)
|
|
||||||
copy(dAtA[i:], m.PubsubTopic)
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(len(m.PubsubTopic)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if len(m.Info) > 0 {
|
|
||||||
i -= len(m.Info)
|
|
||||||
copy(dAtA[i:], m.Info)
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(len(m.Info)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if m.IsSuccess {
|
|
||||||
i--
|
|
||||||
if m.IsSuccess {
|
|
||||||
dAtA[i] = 1
|
|
||||||
} else {
|
|
||||||
dAtA[i] = 0
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x8
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if m.Response != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Response.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x1a
|
|
||||||
}
|
|
||||||
if m.Query != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Query.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if len(m.RequestId) > 0 {
|
|
||||||
i -= len(m.RequestId)
|
|
||||||
copy(dAtA[i:], m.RequestId)
|
|
||||||
i = encodeVarintWakuLightpush(dAtA, i, uint64(len(m.RequestId)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeVarintWakuLightpush(dAtA []byte, offset int, v uint64) int {
|
|
||||||
offset -= sovWakuLightpush(v)
|
|
||||||
base := offset
|
|
||||||
for v >= 1<<7 {
|
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
||||||
v >>= 7
|
|
||||||
offset++
|
|
||||||
}
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
func (m *PushRequest) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.PubsubTopic)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Message != nil {
|
|
||||||
l = m.Message.Size()
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushResponse) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.IsSuccess {
|
|
||||||
n += 2
|
|
||||||
}
|
|
||||||
l = len(m.Info)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PushRPC) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.RequestId)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Query != nil {
|
|
||||||
l = m.Query.Size()
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Response != nil {
|
|
||||||
l = m.Response.Size()
|
|
||||||
n += 1 + l + sovWakuLightpush(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func sovWakuLightpush(x uint64) (n int) {
|
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
|
||||||
}
|
|
||||||
func sozWakuLightpush(x uint64) (n int) {
|
|
||||||
return sovWakuLightpush(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
||||||
}
|
|
||||||
func (m *PushRequest) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PushRequest: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PushRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field PubsubTopic", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.PubsubTopic = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Message == nil {
|
|
||||||
m.Message = &WakuMessage{}
|
|
||||||
}
|
|
||||||
if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuLightpush(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *PushResponse) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PushResponse: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PushResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field IsSuccess", wireType)
|
|
||||||
}
|
|
||||||
var v int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
v |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.IsSuccess = bool(v != 0)
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Info = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuLightpush(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *PushRPC) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PushRPC: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PushRPC: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.RequestId = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Query == nil {
|
|
||||||
m.Query = &PushRequest{}
|
|
||||||
}
|
|
||||||
if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 3:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Response == nil {
|
|
||||||
m.Response = &PushResponse{}
|
|
||||||
}
|
|
||||||
if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuLightpush(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func skipWakuLightpush(dAtA []byte) (n int, err error) {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
depth := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= (uint64(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
switch wireType {
|
|
||||||
case 0:
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx++
|
|
||||||
if dAtA[iNdEx-1] < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
iNdEx += 8
|
|
||||||
case 2:
|
|
||||||
var length int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuLightpush
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
length |= (int(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if length < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
iNdEx += length
|
|
||||||
case 3:
|
|
||||||
depth++
|
|
||||||
case 4:
|
|
||||||
if depth == 0 {
|
|
||||||
return 0, ErrUnexpectedEndOfGroupWakuLightpush
|
|
||||||
}
|
|
||||||
depth--
|
|
||||||
case 5:
|
|
||||||
iNdEx += 4
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
||||||
}
|
|
||||||
if iNdEx < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuLightpush
|
|
||||||
}
|
|
||||||
if depth == 0 {
|
|
||||||
return iNdEx, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrInvalidLengthWakuLightpush = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
||||||
ErrIntOverflowWakuLightpush = fmt.Errorf("proto: integer overflow")
|
|
||||||
ErrUnexpectedEndOfGroupWakuLightpush = fmt.Errorf("proto: unexpected end of group")
|
|
||||||
)
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,938 +0,0 @@
|
||||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
||||||
// source: waku_peer_exchange.proto
|
|
||||||
|
|
||||||
package pb
|
|
||||||
|
|
||||||
import (
|
|
||||||
fmt "fmt"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
io "io"
|
|
||||||
math "math"
|
|
||||||
math_bits "math/bits"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the proto package it is being compiled against.
|
|
||||||
// A compilation error at this line likely means your copy of the
|
|
||||||
// proto package needs to be updated.
|
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
||||||
|
|
||||||
type PeerInfo struct {
|
|
||||||
ENR []byte `protobuf:"bytes,1,opt,name=ENR,proto3" json:"ENR,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerInfo) Reset() { *m = PeerInfo{} }
|
|
||||||
func (m *PeerInfo) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PeerInfo) ProtoMessage() {}
|
|
||||||
func (*PeerInfo) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ce50192ba54b780f, []int{0}
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PeerInfo.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PeerInfo.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PeerInfo.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PeerInfo proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PeerInfo) GetENR() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.ENR
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type PeerExchangeQuery struct {
|
|
||||||
NumPeers uint64 `protobuf:"varint,1,opt,name=numPeers,proto3" json:"numPeers,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) Reset() { *m = PeerExchangeQuery{} }
|
|
||||||
func (m *PeerExchangeQuery) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PeerExchangeQuery) ProtoMessage() {}
|
|
||||||
func (*PeerExchangeQuery) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ce50192ba54b780f, []int{1}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PeerExchangeQuery.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PeerExchangeQuery.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PeerExchangeQuery.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PeerExchangeQuery proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) GetNumPeers() uint64 {
|
|
||||||
if m != nil {
|
|
||||||
return m.NumPeers
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type PeerExchangeResponse struct {
|
|
||||||
PeerInfos []*PeerInfo `protobuf:"bytes,1,rep,name=peerInfos,proto3" json:"peerInfos,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) Reset() { *m = PeerExchangeResponse{} }
|
|
||||||
func (m *PeerExchangeResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PeerExchangeResponse) ProtoMessage() {}
|
|
||||||
func (*PeerExchangeResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ce50192ba54b780f, []int{2}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PeerExchangeResponse.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PeerExchangeResponse.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PeerExchangeResponse.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PeerExchangeResponse proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) GetPeerInfos() []*PeerInfo {
|
|
||||||
if m != nil {
|
|
||||||
return m.PeerInfos
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type PeerExchangeRPC struct {
|
|
||||||
Query *PeerExchangeQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
|
|
||||||
Response *PeerExchangeResponse `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) Reset() { *m = PeerExchangeRPC{} }
|
|
||||||
func (m *PeerExchangeRPC) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*PeerExchangeRPC) ProtoMessage() {}
|
|
||||||
func (*PeerExchangeRPC) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ce50192ba54b780f, []int{3}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_PeerExchangeRPC.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_PeerExchangeRPC.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_PeerExchangeRPC.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_PeerExchangeRPC proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) GetQuery() *PeerExchangeQuery {
|
|
||||||
if m != nil {
|
|
||||||
return m.Query
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) GetResponse() *PeerExchangeResponse {
|
|
||||||
if m != nil {
|
|
||||||
return m.Response
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
proto.RegisterType((*PeerInfo)(nil), "pb.PeerInfo")
|
|
||||||
proto.RegisterType((*PeerExchangeQuery)(nil), "pb.PeerExchangeQuery")
|
|
||||||
proto.RegisterType((*PeerExchangeResponse)(nil), "pb.PeerExchangeResponse")
|
|
||||||
proto.RegisterType((*PeerExchangeRPC)(nil), "pb.PeerExchangeRPC")
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { proto.RegisterFile("waku_peer_exchange.proto", fileDescriptor_ce50192ba54b780f) }
|
|
||||||
|
|
||||||
var fileDescriptor_ce50192ba54b780f = []byte{
|
|
||||||
// 220 bytes of a gzipped FileDescriptorProto
|
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0x4f, 0xcc, 0x2e,
|
|
||||||
0x8d, 0x2f, 0x48, 0x4d, 0x2d, 0x8a, 0x4f, 0xad, 0x48, 0xce, 0x48, 0xcc, 0x4b, 0x4f, 0xd5, 0x2b,
|
|
||||||
0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52, 0x92, 0xe1, 0xe2, 0x08, 0x48, 0x4d, 0x2d,
|
|
||||||
0xf2, 0xcc, 0x4b, 0xcb, 0x17, 0x12, 0xe0, 0x62, 0x76, 0xf5, 0x0b, 0x92, 0x60, 0x54, 0x60, 0xd4,
|
|
||||||
0xe0, 0x09, 0x02, 0x31, 0x95, 0xf4, 0xb9, 0x04, 0x41, 0xb2, 0xae, 0x50, 0x7d, 0x81, 0xa5, 0xa9,
|
|
||||||
0x45, 0x95, 0x42, 0x52, 0x5c, 0x1c, 0x79, 0xa5, 0xb9, 0x20, 0xf1, 0x62, 0xb0, 0x5a, 0x96, 0x20,
|
|
||||||
0x38, 0x5f, 0xc9, 0x89, 0x4b, 0x04, 0x59, 0x43, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa,
|
|
||||||
0x90, 0x16, 0x17, 0x67, 0x01, 0xd4, 0x1a, 0x90, 0x26, 0x66, 0x0d, 0x6e, 0x23, 0x1e, 0xbd, 0x82,
|
|
||||||
0x24, 0x3d, 0x98, 0xdd, 0x41, 0x08, 0x69, 0xa5, 0x12, 0x2e, 0x7e, 0x14, 0x33, 0x02, 0x9c, 0x85,
|
|
||||||
0xb4, 0xb9, 0x58, 0x0b, 0x41, 0x76, 0x83, 0xed, 0xe3, 0x36, 0x12, 0x85, 0x69, 0x45, 0x71, 0x58,
|
|
||||||
0x10, 0x44, 0x8d, 0x90, 0x09, 0x17, 0x47, 0x11, 0xd4, 0x5e, 0x09, 0x26, 0xb0, 0x7a, 0x09, 0x74,
|
|
||||||
0xf5, 0x30, 0x77, 0x05, 0xc1, 0x55, 0x3a, 0x09, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c,
|
|
||||||
0xe3, 0x83, 0x47, 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0x43, 0xc9, 0x18, 0x10,
|
|
||||||
0x00, 0x00, 0xff, 0xff, 0x25, 0x86, 0x8e, 0x1d, 0x41, 0x01, 0x00, 0x00,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerInfo) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if len(m.ENR) > 0 {
|
|
||||||
i -= len(m.ENR)
|
|
||||||
copy(dAtA[i:], m.ENR)
|
|
||||||
i = encodeVarintWakuPeerExchange(dAtA, i, uint64(len(m.ENR)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if m.NumPeers != 0 {
|
|
||||||
i = encodeVarintWakuPeerExchange(dAtA, i, uint64(m.NumPeers))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x8
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if len(m.PeerInfos) > 0 {
|
|
||||||
for iNdEx := len(m.PeerInfos) - 1; iNdEx >= 0; iNdEx-- {
|
|
||||||
{
|
|
||||||
size, err := m.PeerInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuPeerExchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if m.Response != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Response.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuPeerExchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if m.Query != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Query.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintWakuPeerExchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeVarintWakuPeerExchange(dAtA []byte, offset int, v uint64) int {
|
|
||||||
offset -= sovWakuPeerExchange(v)
|
|
||||||
base := offset
|
|
||||||
for v >= 1<<7 {
|
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
||||||
v >>= 7
|
|
||||||
offset++
|
|
||||||
}
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.ENR)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuPeerExchange(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeQuery) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.NumPeers != 0 {
|
|
||||||
n += 1 + sovWakuPeerExchange(uint64(m.NumPeers))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeResponse) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.PeerInfos) > 0 {
|
|
||||||
for _, e := range m.PeerInfos {
|
|
||||||
l = e.Size()
|
|
||||||
n += 1 + l + sovWakuPeerExchange(uint64(l))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *PeerExchangeRPC) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.Query != nil {
|
|
||||||
l = m.Query.Size()
|
|
||||||
n += 1 + l + sovWakuPeerExchange(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Response != nil {
|
|
||||||
l = m.Response.Size()
|
|
||||||
n += 1 + l + sovWakuPeerExchange(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func sovWakuPeerExchange(x uint64) (n int) {
|
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
|
||||||
}
|
|
||||||
func sozWakuPeerExchange(x uint64) (n int) {
|
|
||||||
return sovWakuPeerExchange(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
||||||
}
|
|
||||||
func (m *PeerInfo) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PeerInfo: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PeerInfo: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field ENR", wireType)
|
|
||||||
}
|
|
||||||
var byteLen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
byteLen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if byteLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + byteLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.ENR = append(m.ENR[:0], dAtA[iNdEx:postIndex]...)
|
|
||||||
if m.ENR == nil {
|
|
||||||
m.ENR = []byte{}
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuPeerExchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeQuery) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeQuery: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeQuery: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field NumPeers", wireType)
|
|
||||||
}
|
|
||||||
m.NumPeers = 0
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
m.NumPeers |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuPeerExchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeResponse) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeResponse: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field PeerInfos", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.PeerInfos = append(m.PeerInfos, &PeerInfo{})
|
|
||||||
if err := m.PeerInfos[len(m.PeerInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuPeerExchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *PeerExchangeRPC) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeRPC: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: PeerExchangeRPC: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Query == nil {
|
|
||||||
m.Query = &PeerExchangeQuery{}
|
|
||||||
}
|
|
||||||
if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Response == nil {
|
|
||||||
m.Response = &PeerExchangeResponse{}
|
|
||||||
}
|
|
||||||
if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuPeerExchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func skipWakuPeerExchange(dAtA []byte) (n int, err error) {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
depth := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= (uint64(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
switch wireType {
|
|
||||||
case 0:
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx++
|
|
||||||
if dAtA[iNdEx-1] < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
iNdEx += 8
|
|
||||||
case 2:
|
|
||||||
var length int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuPeerExchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
length |= (int(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if length < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
iNdEx += length
|
|
||||||
case 3:
|
|
||||||
depth++
|
|
||||||
case 4:
|
|
||||||
if depth == 0 {
|
|
||||||
return 0, ErrUnexpectedEndOfGroupWakuPeerExchange
|
|
||||||
}
|
|
||||||
depth--
|
|
||||||
case 5:
|
|
||||||
iNdEx += 4
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
||||||
}
|
|
||||||
if iNdEx < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuPeerExchange
|
|
||||||
}
|
|
||||||
if depth == 0 {
|
|
||||||
return iNdEx, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrInvalidLengthWakuPeerExchange = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
||||||
ErrIntOverflowWakuPeerExchange = fmt.Errorf("proto: integer overflow")
|
|
||||||
ErrUnexpectedEndOfGroupWakuPeerExchange = fmt.Errorf("proto: unexpected end of group")
|
|
||||||
)
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,687 +0,0 @@
|
||||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
||||||
// source: waku_swap.proto
|
|
||||||
|
|
||||||
package pb
|
|
||||||
|
|
||||||
import (
|
|
||||||
fmt "fmt"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
io "io"
|
|
||||||
math "math"
|
|
||||||
math_bits "math/bits"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the proto package it is being compiled against.
|
|
||||||
// A compilation error at this line likely means your copy of the
|
|
||||||
// proto package needs to be updated.
|
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
||||||
|
|
||||||
type Cheque struct {
|
|
||||||
IssuerAddress string `protobuf:"bytes,1,opt,name=issuerAddress,proto3" json:"issuerAddress,omitempty"`
|
|
||||||
Beneficiary []byte `protobuf:"bytes,2,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
|
|
||||||
Date uint32 `protobuf:"varint,3,opt,name=date,proto3" json:"date,omitempty"`
|
|
||||||
Amount uint32 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
|
|
||||||
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) Reset() { *m = Cheque{} }
|
|
||||||
func (m *Cheque) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Cheque) ProtoMessage() {}
|
|
||||||
func (*Cheque) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_8ec987fcc28cf932, []int{0}
|
|
||||||
}
|
|
||||||
func (m *Cheque) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *Cheque) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_Cheque.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *Cheque) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_Cheque.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *Cheque) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *Cheque) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_Cheque.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_Cheque proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *Cheque) GetIssuerAddress() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.IssuerAddress
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) GetBeneficiary() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Beneficiary
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) GetDate() uint32 {
|
|
||||||
if m != nil {
|
|
||||||
return m.Date
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) GetAmount() uint32 {
|
|
||||||
if m != nil {
|
|
||||||
return m.Amount
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) GetSignature() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Signature
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Handshake struct {
|
|
||||||
Beneficiary []byte `protobuf:"bytes,1,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Handshake) Reset() { *m = Handshake{} }
|
|
||||||
func (m *Handshake) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*Handshake) ProtoMessage() {}
|
|
||||||
func (*Handshake) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_8ec987fcc28cf932, []int{1}
|
|
||||||
}
|
|
||||||
func (m *Handshake) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *Handshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_Handshake.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *Handshake) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_Handshake.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *Handshake) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *Handshake) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_Handshake.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_Handshake proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *Handshake) GetBeneficiary() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.Beneficiary
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
proto.RegisterType((*Cheque)(nil), "pb.Cheque")
|
|
||||||
proto.RegisterType((*Handshake)(nil), "pb.Handshake")
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { proto.RegisterFile("waku_swap.proto", fileDescriptor_8ec987fcc28cf932) }
|
|
||||||
|
|
||||||
var fileDescriptor_8ec987fcc28cf932 = []byte{
|
|
||||||
// 200 bytes of a gzipped FileDescriptorProto
|
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4f, 0xcc, 0x2e,
|
|
||||||
0x8d, 0x2f, 0x2e, 0x4f, 0x2c, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, 0x48, 0x52,
|
|
||||||
0x9a, 0xc5, 0xc8, 0xc5, 0xe6, 0x9c, 0x91, 0x5a, 0x58, 0x9a, 0x2a, 0xa4, 0xc2, 0xc5, 0x9b, 0x59,
|
|
||||||
0x5c, 0x5c, 0x9a, 0x5a, 0xe4, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8,
|
|
||||||
0xc1, 0x19, 0x84, 0x2a, 0x28, 0xa4, 0xc0, 0xc5, 0x9d, 0x94, 0x9a, 0x97, 0x9a, 0x96, 0x99, 0x9c,
|
|
||||||
0x99, 0x58, 0x54, 0x29, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x84, 0x2c, 0x24, 0x24, 0xc4, 0xc5,
|
|
||||||
0x92, 0x92, 0x58, 0x92, 0x2a, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x1b, 0x04, 0x66, 0x0b, 0x89, 0x71,
|
|
||||||
0xb1, 0x25, 0xe6, 0xe6, 0x97, 0xe6, 0x95, 0x48, 0xb0, 0x80, 0x45, 0xa1, 0x3c, 0x21, 0x19, 0x2e,
|
|
||||||
0xce, 0xe2, 0xcc, 0xf4, 0xbc, 0xc4, 0x92, 0xd2, 0xa2, 0x54, 0x09, 0x56, 0xb0, 0x59, 0x08, 0x01,
|
|
||||||
0x25, 0x5d, 0x2e, 0x4e, 0x8f, 0xc4, 0xbc, 0x94, 0xe2, 0x8c, 0xc4, 0xec, 0x54, 0x74, 0x8b, 0x19,
|
|
||||||
0x31, 0x2c, 0x76, 0x12, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
|
|
||||||
0x18, 0x67, 0x3c, 0x96, 0x63, 0x48, 0x62, 0x03, 0x7b, 0xd4, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff,
|
|
||||||
0xce, 0x34, 0x72, 0xd2, 0xfb, 0x00, 0x00, 0x00,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Cheque) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if len(m.Signature) > 0 {
|
|
||||||
i -= len(m.Signature)
|
|
||||||
copy(dAtA[i:], m.Signature)
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(len(m.Signature)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x2a
|
|
||||||
}
|
|
||||||
if m.Amount != 0 {
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(m.Amount))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x20
|
|
||||||
}
|
|
||||||
if m.Date != 0 {
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(m.Date))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x18
|
|
||||||
}
|
|
||||||
if len(m.Beneficiary) > 0 {
|
|
||||||
i -= len(m.Beneficiary)
|
|
||||||
copy(dAtA[i:], m.Beneficiary)
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(len(m.Beneficiary)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if len(m.IssuerAddress) > 0 {
|
|
||||||
i -= len(m.IssuerAddress)
|
|
||||||
copy(dAtA[i:], m.IssuerAddress)
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(len(m.IssuerAddress)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Handshake) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Handshake) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Handshake) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
i -= len(m.XXX_unrecognized)
|
|
||||||
copy(dAtA[i:], m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
if len(m.Beneficiary) > 0 {
|
|
||||||
i -= len(m.Beneficiary)
|
|
||||||
copy(dAtA[i:], m.Beneficiary)
|
|
||||||
i = encodeVarintWakuSwap(dAtA, i, uint64(len(m.Beneficiary)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeVarintWakuSwap(dAtA []byte, offset int, v uint64) int {
|
|
||||||
offset -= sovWakuSwap(v)
|
|
||||||
base := offset
|
|
||||||
for v >= 1<<7 {
|
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
||||||
v >>= 7
|
|
||||||
offset++
|
|
||||||
}
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
func (m *Cheque) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.IssuerAddress)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuSwap(uint64(l))
|
|
||||||
}
|
|
||||||
l = len(m.Beneficiary)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuSwap(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Date != 0 {
|
|
||||||
n += 1 + sovWakuSwap(uint64(m.Date))
|
|
||||||
}
|
|
||||||
if m.Amount != 0 {
|
|
||||||
n += 1 + sovWakuSwap(uint64(m.Amount))
|
|
||||||
}
|
|
||||||
l = len(m.Signature)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuSwap(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Handshake) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.Beneficiary)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovWakuSwap(uint64(l))
|
|
||||||
}
|
|
||||||
if m.XXX_unrecognized != nil {
|
|
||||||
n += len(m.XXX_unrecognized)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func sovWakuSwap(x uint64) (n int) {
|
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
|
||||||
}
|
|
||||||
func sozWakuSwap(x uint64) (n int) {
|
|
||||||
return sovWakuSwap(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
||||||
}
|
|
||||||
func (m *Cheque) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: Cheque: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: Cheque: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field IssuerAddress", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.IssuerAddress = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType)
|
|
||||||
}
|
|
||||||
var byteLen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
byteLen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if byteLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + byteLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Beneficiary = append(m.Beneficiary[:0], dAtA[iNdEx:postIndex]...)
|
|
||||||
if m.Beneficiary == nil {
|
|
||||||
m.Beneficiary = []byte{}
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 3:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType)
|
|
||||||
}
|
|
||||||
m.Date = 0
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
m.Date |= uint32(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
|
|
||||||
}
|
|
||||||
m.Amount = 0
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
m.Amount |= uint32(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
|
|
||||||
}
|
|
||||||
var byteLen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
byteLen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if byteLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + byteLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...)
|
|
||||||
if m.Signature == nil {
|
|
||||||
m.Signature = []byte{}
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuSwap(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *Handshake) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: Handshake: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: Handshake: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Beneficiary", wireType)
|
|
||||||
}
|
|
||||||
var byteLen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
byteLen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if byteLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + byteLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Beneficiary = append(m.Beneficiary[:0], dAtA[iNdEx:postIndex]...)
|
|
||||||
if m.Beneficiary == nil {
|
|
||||||
m.Beneficiary = []byte{}
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipWakuSwap(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func skipWakuSwap(dAtA []byte) (n int, err error) {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
depth := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= (uint64(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
switch wireType {
|
|
||||||
case 0:
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx++
|
|
||||||
if dAtA[iNdEx-1] < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
iNdEx += 8
|
|
||||||
case 2:
|
|
||||||
var length int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowWakuSwap
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
length |= (int(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if length < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
iNdEx += length
|
|
||||||
case 3:
|
|
||||||
depth++
|
|
||||||
case 4:
|
|
||||||
if depth == 0 {
|
|
||||||
return 0, ErrUnexpectedEndOfGroupWakuSwap
|
|
||||||
}
|
|
||||||
depth--
|
|
||||||
case 5:
|
|
||||||
iNdEx += 4
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
||||||
}
|
|
||||||
if iNdEx < 0 {
|
|
||||||
return 0, ErrInvalidLengthWakuSwap
|
|
||||||
}
|
|
||||||
if depth == 0 {
|
|
||||||
return iNdEx, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrInvalidLengthWakuSwap = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
||||||
ErrIntOverflowWakuSwap = fmt.Errorf("proto: integer overflow")
|
|
||||||
ErrUnexpectedEndOfGroupWakuSwap = fmt.Errorf("proto: unexpected end of group")
|
|
||||||
)
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mwaku_peer_exchange.proto=github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb --go_out=. ./waku_peer_exchange.proto
|
|
@ -0,0 +1,346 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_peer_exchange.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type PeerInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
ENR []byte `protobuf:"bytes,1,opt,name=ENR,proto3" json:"ENR,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerInfo) Reset() {
|
||||||
|
*x = PeerInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PeerInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PeerInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PeerInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerInfo) GetENR() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.ENR
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type PeerExchangeQuery struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
NumPeers uint64 `protobuf:"varint,1,opt,name=numPeers,proto3" json:"numPeers,omitempty"` // number of peers requested
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeQuery) Reset() {
|
||||||
|
*x = PeerExchangeQuery{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeQuery) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PeerExchangeQuery) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PeerExchangeQuery) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PeerExchangeQuery.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PeerExchangeQuery) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeQuery) GetNumPeers() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.NumPeers
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type PeerExchangeResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
PeerInfos []*PeerInfo `protobuf:"bytes,1,rep,name=peerInfos,proto3" json:"peerInfos,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeResponse) Reset() {
|
||||||
|
*x = PeerExchangeResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PeerExchangeResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PeerExchangeResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PeerExchangeResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PeerExchangeResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeResponse) GetPeerInfos() []*PeerInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.PeerInfos
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type PeerExchangeRPC struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Query *PeerExchangeQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
|
||||||
|
Response *PeerExchangeResponse `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeRPC) Reset() {
|
||||||
|
*x = PeerExchangeRPC{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeRPC) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PeerExchangeRPC) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PeerExchangeRPC) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_peer_exchange_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PeerExchangeRPC.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PeerExchangeRPC) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeRPC) GetQuery() *PeerExchangeQuery {
|
||||||
|
if x != nil {
|
||||||
|
return x.Query
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PeerExchangeRPC) GetResponse() *PeerExchangeResponse {
|
||||||
|
if x != nil {
|
||||||
|
return x.Response
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_peer_exchange_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_peer_exchange_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x18, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68,
|
||||||
|
0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x1c,
|
||||||
|
0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x45, 0x4e,
|
||||||
|
0x52, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x45, 0x4e, 0x52, 0x22, 0x2f, 0x0a, 0x11,
|
||||||
|
0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72,
|
||||||
|
0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x04, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x22, 0x42, 0x0a,
|
||||||
|
0x14, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73,
|
||||||
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66,
|
||||||
|
0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65,
|
||||||
|
0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
|
||||||
|
0x73, 0x22, 0x74, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
||||||
|
0x65, 0x52, 0x50, 0x43, 0x12, 0x2b, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63,
|
||||||
|
0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72,
|
||||||
|
0x79, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63,
|
||||||
|
0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72,
|
||||||
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_peer_exchange_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_peer_exchange_proto_rawDescData = file_waku_peer_exchange_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_peer_exchange_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_peer_exchange_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_peer_exchange_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_peer_exchange_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_peer_exchange_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_peer_exchange_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
|
var file_waku_peer_exchange_proto_goTypes = []interface{}{
|
||||||
|
(*PeerInfo)(nil), // 0: pb.PeerInfo
|
||||||
|
(*PeerExchangeQuery)(nil), // 1: pb.PeerExchangeQuery
|
||||||
|
(*PeerExchangeResponse)(nil), // 2: pb.PeerExchangeResponse
|
||||||
|
(*PeerExchangeRPC)(nil), // 3: pb.PeerExchangeRPC
|
||||||
|
}
|
||||||
|
var file_waku_peer_exchange_proto_depIdxs = []int32{
|
||||||
|
0, // 0: pb.PeerExchangeResponse.peerInfos:type_name -> pb.PeerInfo
|
||||||
|
1, // 1: pb.PeerExchangeRPC.query:type_name -> pb.PeerExchangeQuery
|
||||||
|
2, // 2: pb.PeerExchangeRPC.response:type_name -> pb.PeerExchangeResponse
|
||||||
|
3, // [3:3] is the sub-list for method output_type
|
||||||
|
3, // [3:3] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_peer_exchange_proto_init() }
|
||||||
|
func file_waku_peer_exchange_proto_init() {
|
||||||
|
if File_waku_peer_exchange_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_peer_exchange_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PeerInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_peer_exchange_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PeerExchangeQuery); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_peer_exchange_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PeerExchangeResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_peer_exchange_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PeerExchangeRPC); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_peer_exchange_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 4,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_peer_exchange_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_peer_exchange_proto_depIdxs,
|
||||||
|
MessageInfos: file_waku_peer_exchange_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_peer_exchange_proto = out.File
|
||||||
|
file_waku_peer_exchange_proto_rawDesc = nil
|
||||||
|
file_waku_peer_exchange_proto_goTypes = nil
|
||||||
|
file_waku_peer_exchange_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -19,12 +19,12 @@ import (
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
"github.com/waku-org/go-waku/waku/v2/discv5"
|
"github.com/waku-org/go-waku/waku/v2/discv5"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
@ -146,7 +146,7 @@ func (wakuPX *WakuPeerExchange) onRequest(ctx context.Context) func(s network.St
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
logger := wakuPX.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
logger := wakuPX.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
||||||
requestRPC := &pb.PeerExchangeRPC{}
|
requestRPC := &pb.PeerExchangeRPC{}
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
err := reader.ReadMsg(requestRPC)
|
err := reader.ReadMsg(requestRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("reading request", zap.Error(err))
|
logger.Error("reading request", zap.Error(err))
|
||||||
|
@ -229,7 +229,7 @@ func (wakuPX *WakuPeerExchange) sendPeerExchangeRPCToPeer(ctx context.Context, r
|
||||||
}
|
}
|
||||||
defer connOpt.Close()
|
defer connOpt.Close()
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(connOpt)
|
writer := pbio.NewDelimitedWriter(connOpt)
|
||||||
err = writer.WriteMsg(rpc)
|
err = writer.WriteMsg(rpc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("writing response", zap.Error(err))
|
logger.Error("writing response", zap.Error(err))
|
||||||
|
|
|
@ -8,12 +8,12 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
"github.com/libp2p/go-libp2p/core/host"
|
"github.com/libp2p/go-libp2p/core/host"
|
||||||
"github.com/libp2p/go-libp2p/core/protocol"
|
"github.com/libp2p/go-libp2p/core/protocol"
|
||||||
"go.opencensus.io/stats"
|
"go.opencensus.io/stats"
|
||||||
"go.opencensus.io/tag"
|
"go.opencensus.io/tag"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
proto "google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||||
pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb"
|
||||||
|
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
@ -21,6 +20,7 @@ import (
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
r "github.com/waku-org/go-zerokit-rln/rln"
|
r "github.com/waku-org/go-zerokit-rln/rln"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
proto "google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// the maximum clock difference between peers in seconds
|
// the maximum clock difference between peers in seconds
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I./../../pb/. -I. --go_opt=paths=source_relative --go_opt=Mwaku_store.proto=github.com/waku-org/go-waku/waku/v2/protocol/store/pb --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_store.proto
|
|
@ -0,0 +1,709 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_store.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
pb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type PagingInfo_Direction int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
PagingInfo_BACKWARD PagingInfo_Direction = 0
|
||||||
|
PagingInfo_FORWARD PagingInfo_Direction = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for PagingInfo_Direction.
|
||||||
|
var (
|
||||||
|
PagingInfo_Direction_name = map[int32]string{
|
||||||
|
0: "BACKWARD",
|
||||||
|
1: "FORWARD",
|
||||||
|
}
|
||||||
|
PagingInfo_Direction_value = map[string]int32{
|
||||||
|
"BACKWARD": 0,
|
||||||
|
"FORWARD": 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x PagingInfo_Direction) Enum() *PagingInfo_Direction {
|
||||||
|
p := new(PagingInfo_Direction)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x PagingInfo_Direction) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (PagingInfo_Direction) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_waku_store_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (PagingInfo_Direction) Type() protoreflect.EnumType {
|
||||||
|
return &file_waku_store_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x PagingInfo_Direction) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PagingInfo_Direction.Descriptor instead.
|
||||||
|
func (PagingInfo_Direction) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{1, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type HistoryResponse_Error int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
HistoryResponse_NONE HistoryResponse_Error = 0
|
||||||
|
HistoryResponse_INVALID_CURSOR HistoryResponse_Error = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for HistoryResponse_Error.
|
||||||
|
var (
|
||||||
|
HistoryResponse_Error_name = map[int32]string{
|
||||||
|
0: "NONE",
|
||||||
|
1: "INVALID_CURSOR",
|
||||||
|
}
|
||||||
|
HistoryResponse_Error_value = map[string]int32{
|
||||||
|
"NONE": 0,
|
||||||
|
"INVALID_CURSOR": 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x HistoryResponse_Error) Enum() *HistoryResponse_Error {
|
||||||
|
p := new(HistoryResponse_Error)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x HistoryResponse_Error) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (HistoryResponse_Error) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_waku_store_proto_enumTypes[1].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (HistoryResponse_Error) Type() protoreflect.EnumType {
|
||||||
|
return &file_waku_store_proto_enumTypes[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x HistoryResponse_Error) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HistoryResponse_Error.Descriptor instead.
|
||||||
|
func (HistoryResponse_Error) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{4, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Index struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||||
|
ReceiverTime int64 `protobuf:"zigzag64,2,opt,name=receiverTime,proto3" json:"receiverTime,omitempty"`
|
||||||
|
SenderTime int64 `protobuf:"zigzag64,3,opt,name=senderTime,proto3" json:"senderTime,omitempty"`
|
||||||
|
PubsubTopic string `protobuf:"bytes,4,opt,name=pubsubTopic,proto3" json:"pubsubTopic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) Reset() {
|
||||||
|
*x = Index{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Index) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Index) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Index.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Index) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) GetDigest() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.Digest
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) GetReceiverTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ReceiverTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) GetSenderTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.SenderTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Index) GetPubsubTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type PagingInfo struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
PageSize uint64 `protobuf:"varint,1,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
|
||||||
|
Cursor *Index `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"`
|
||||||
|
Direction PagingInfo_Direction `protobuf:"varint,3,opt,name=direction,proto3,enum=pb.PagingInfo_Direction" json:"direction,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PagingInfo) Reset() {
|
||||||
|
*x = PagingInfo{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PagingInfo) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PagingInfo) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PagingInfo) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PagingInfo.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PagingInfo) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PagingInfo) GetPageSize() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PageSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PagingInfo) GetCursor() *Index {
|
||||||
|
if x != nil {
|
||||||
|
return x.Cursor
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PagingInfo) GetDirection() PagingInfo_Direction {
|
||||||
|
if x != nil {
|
||||||
|
return x.Direction
|
||||||
|
}
|
||||||
|
return PagingInfo_BACKWARD
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContentFilter struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
ContentTopic string `protobuf:"bytes,1,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ContentFilter) Reset() {
|
||||||
|
*x = ContentFilter{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ContentFilter) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ContentFilter) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ContentFilter) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ContentFilter.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ContentFilter) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ContentFilter) GetContentTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContentTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type HistoryQuery struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
PubsubTopic string `protobuf:"bytes,2,opt,name=pubsubTopic,proto3" json:"pubsubTopic,omitempty"`
|
||||||
|
ContentFilters []*ContentFilter `protobuf:"bytes,3,rep,name=contentFilters,proto3" json:"contentFilters,omitempty"`
|
||||||
|
PagingInfo *PagingInfo `protobuf:"bytes,4,opt,name=pagingInfo,proto3" json:"pagingInfo,omitempty"` // used for pagination
|
||||||
|
StartTime int64 `protobuf:"zigzag64,5,opt,name=startTime,proto3" json:"startTime,omitempty"`
|
||||||
|
EndTime int64 `protobuf:"zigzag64,6,opt,name=endTime,proto3" json:"endTime,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) Reset() {
|
||||||
|
*x = HistoryQuery{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HistoryQuery) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HistoryQuery.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HistoryQuery) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) GetPubsubTopic() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PubsubTopic
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) GetContentFilters() []*ContentFilter {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContentFilters
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) GetPagingInfo() *PagingInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.PagingInfo
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) GetStartTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.StartTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryQuery) GetEndTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.EndTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type HistoryResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
// the first field is reserved for future use
|
||||||
|
Messages []*pb.WakuMessage `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"`
|
||||||
|
PagingInfo *PagingInfo `protobuf:"bytes,3,opt,name=pagingInfo,proto3" json:"pagingInfo,omitempty"`
|
||||||
|
Error HistoryResponse_Error `protobuf:"varint,4,opt,name=error,proto3,enum=pb.HistoryResponse_Error" json:"error,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) Reset() {
|
||||||
|
*x = HistoryResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HistoryResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[4]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HistoryResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) GetMessages() []*pb.WakuMessage {
|
||||||
|
if x != nil {
|
||||||
|
return x.Messages
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) GetPagingInfo() *PagingInfo {
|
||||||
|
if x != nil {
|
||||||
|
return x.PagingInfo
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryResponse) GetError() HistoryResponse_Error {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return HistoryResponse_NONE
|
||||||
|
}
|
||||||
|
|
||||||
|
type HistoryRPC struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||||
|
Query *HistoryQuery `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
|
||||||
|
Response *HistoryResponse `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) Reset() {
|
||||||
|
*x = HistoryRPC{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HistoryRPC) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_store_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HistoryRPC.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HistoryRPC) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_store_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) GetRequestId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.RequestId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) GetQuery() *HistoryQuery {
|
||||||
|
if x != nil {
|
||||||
|
return x.Query
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoryRPC) GetResponse() *HistoryResponse {
|
||||||
|
if x != nil {
|
||||||
|
return x.Response
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_store_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_store_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x10, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x73,
|
||||||
|
0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x49,
|
||||||
|
0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01,
|
||||||
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c,
|
||||||
|
0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||||
|
0x28, 0x12, 0x52, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65,
|
||||||
|
0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x12, 0x52, 0x0a, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65,
|
||||||
|
0x12, 0x20, 0x0a, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x18,
|
||||||
|
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70,
|
||||||
|
0x69, 0x63, 0x22, 0xab, 0x01, 0x0a, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66,
|
||||||
|
0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x04, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a,
|
||||||
|
0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e,
|
||||||
|
0x70, 0x62, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72,
|
||||||
|
0x12, 0x36, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
|
||||||
|
0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64,
|
||||||
|
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x26, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65,
|
||||||
|
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41, 0x43, 0x4b, 0x57, 0x41, 0x52,
|
||||||
|
0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x4f, 0x52, 0x57, 0x41, 0x52, 0x44, 0x10, 0x01,
|
||||||
|
0x22, 0x33, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65,
|
||||||
|
0x72, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, 0x69,
|
||||||
|
0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||||
|
0x54, 0x6f, 0x70, 0x69, 0x63, 0x22, 0xd3, 0x01, 0x0a, 0x0c, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
|
||||||
|
0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62,
|
||||||
|
0x54, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62,
|
||||||
|
0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x39, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74,
|
||||||
|
0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
|
||||||
|
0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c,
|
||||||
|
0x74, 0x65, 0x72, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74,
|
||||||
|
0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66,
|
||||||
|
0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x67,
|
||||||
|
0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49,
|
||||||
|
0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65,
|
||||||
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x12, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d,
|
||||||
|
0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01,
|
||||||
|
0x28, 0x12, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x0f,
|
||||||
|
0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
|
0x2b, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||||
|
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||||
|
0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x0a,
|
||||||
|
0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||||
|
0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f,
|
||||||
|
0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2f, 0x0a, 0x05,
|
||||||
|
0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x70, 0x62,
|
||||||
|
0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
|
0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x25, 0x0a,
|
||||||
|
0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00,
|
||||||
|
0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x43, 0x55, 0x52, 0x53,
|
||||||
|
0x4f, 0x52, 0x10, 0x01, 0x22, 0x84, 0x01, 0x0a, 0x0a, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79,
|
||||||
|
0x52, 0x50, 0x43, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69,
|
||||||
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
|
0x49, 0x64, 0x12, 0x26, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x51, 0x75,
|
||||||
|
0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x2f, 0x0a, 0x08, 0x72, 0x65,
|
||||||
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70,
|
||||||
|
0x62, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
|
0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_store_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_store_proto_rawDescData = file_waku_store_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_store_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_store_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_store_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_store_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_store_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_store_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||||
|
var file_waku_store_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||||
|
var file_waku_store_proto_goTypes = []interface{}{
|
||||||
|
(PagingInfo_Direction)(0), // 0: pb.PagingInfo.Direction
|
||||||
|
(HistoryResponse_Error)(0), // 1: pb.HistoryResponse.Error
|
||||||
|
(*Index)(nil), // 2: pb.Index
|
||||||
|
(*PagingInfo)(nil), // 3: pb.PagingInfo
|
||||||
|
(*ContentFilter)(nil), // 4: pb.ContentFilter
|
||||||
|
(*HistoryQuery)(nil), // 5: pb.HistoryQuery
|
||||||
|
(*HistoryResponse)(nil), // 6: pb.HistoryResponse
|
||||||
|
(*HistoryRPC)(nil), // 7: pb.HistoryRPC
|
||||||
|
(*pb.WakuMessage)(nil), // 8: pb.WakuMessage
|
||||||
|
}
|
||||||
|
var file_waku_store_proto_depIdxs = []int32{
|
||||||
|
2, // 0: pb.PagingInfo.cursor:type_name -> pb.Index
|
||||||
|
0, // 1: pb.PagingInfo.direction:type_name -> pb.PagingInfo.Direction
|
||||||
|
4, // 2: pb.HistoryQuery.contentFilters:type_name -> pb.ContentFilter
|
||||||
|
3, // 3: pb.HistoryQuery.pagingInfo:type_name -> pb.PagingInfo
|
||||||
|
8, // 4: pb.HistoryResponse.messages:type_name -> pb.WakuMessage
|
||||||
|
3, // 5: pb.HistoryResponse.pagingInfo:type_name -> pb.PagingInfo
|
||||||
|
1, // 6: pb.HistoryResponse.error:type_name -> pb.HistoryResponse.Error
|
||||||
|
5, // 7: pb.HistoryRPC.query:type_name -> pb.HistoryQuery
|
||||||
|
6, // 8: pb.HistoryRPC.response:type_name -> pb.HistoryResponse
|
||||||
|
9, // [9:9] is the sub-list for method output_type
|
||||||
|
9, // [9:9] is the sub-list for method input_type
|
||||||
|
9, // [9:9] is the sub-list for extension type_name
|
||||||
|
9, // [9:9] is the sub-list for extension extendee
|
||||||
|
0, // [0:9] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_store_proto_init() }
|
||||||
|
func file_waku_store_proto_init() {
|
||||||
|
if File_waku_store_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_store_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Index); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_store_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PagingInfo); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_store_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ContentFilter); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_store_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HistoryQuery); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_store_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HistoryResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_store_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HistoryRPC); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_store_proto_rawDesc,
|
||||||
|
NumEnums: 2,
|
||||||
|
NumMessages: 6,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_store_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_store_proto_depIdxs,
|
||||||
|
EnumInfos: file_waku_store_proto_enumTypes,
|
||||||
|
MessageInfos: file_waku_store_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_store_proto = out.File
|
||||||
|
file_waku_store_proto_rawDesc = nil
|
||||||
|
file_waku_store_proto_goTypes = nil
|
||||||
|
file_waku_store_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -7,13 +7,14 @@ import (
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ type Query struct {
|
||||||
// Result represents a valid response from a store node
|
// Result represents a valid response from a store node
|
||||||
type Result struct {
|
type Result struct {
|
||||||
started bool
|
started bool
|
||||||
Messages []*pb.WakuMessage
|
Messages []*wpb.WakuMessage
|
||||||
store Store
|
store Store
|
||||||
query *pb.HistoryQuery
|
query *pb.HistoryQuery
|
||||||
cursor *pb.Index
|
cursor *pb.Index
|
||||||
|
@ -71,14 +72,14 @@ func (r *Result) Next(ctx context.Context) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Result) GetMessages() []*pb.WakuMessage {
|
func (r *Result) GetMessages() []*wpb.WakuMessage {
|
||||||
if !r.started {
|
if !r.started {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return r.Messages
|
return r.Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
type criteriaFN = func(msg *pb.WakuMessage) (bool, error)
|
type criteriaFN = func(msg *wpb.WakuMessage) (bool, error)
|
||||||
|
|
||||||
type HistoryRequestParameters struct {
|
type HistoryRequestParameters struct {
|
||||||
selectedPeer peer.ID
|
selectedPeer peer.ID
|
||||||
|
@ -195,8 +196,8 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec
|
||||||
|
|
||||||
historyRequest := &pb.HistoryRPC{Query: q, RequestId: hex.EncodeToString(requestId)}
|
historyRequest := &pb.HistoryRPC{Query: q, RequestId: hex.EncodeToString(requestId)}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(connOpt)
|
writer := pbio.NewDelimitedWriter(connOpt)
|
||||||
reader := protoio.NewDelimitedReader(connOpt, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(connOpt, math.MaxInt32)
|
||||||
|
|
||||||
err = writer.WriteMsg(historyRequest)
|
err = writer.WriteMsg(historyRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -335,7 +336,7 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the first message that matches a criteria. criteriaCB is a function that will be invoked for each message and returns true if the message matches the criteria
|
// Find the first message that matches a criteria. criteriaCB is a function that will be invoked for each message and returns true if the message matches the criteria
|
||||||
func (store *WakuStore) Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*pb.WakuMessage, error) {
|
func (store *WakuStore) Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) {
|
||||||
if cb == nil {
|
if cb == nil {
|
||||||
return nil, errors.New("callback can't be null")
|
return nil, errors.New("callback can't be null")
|
||||||
}
|
}
|
||||||
|
@ -379,7 +380,7 @@ func (store *WakuStore) Next(ctx context.Context, r *Result) (*Result, error) {
|
||||||
return &Result{
|
return &Result{
|
||||||
store: store,
|
store: store,
|
||||||
started: true,
|
started: true,
|
||||||
Messages: []*pb.WakuMessage{},
|
Messages: []*wpb.WakuMessage{},
|
||||||
cursor: nil,
|
cursor: nil,
|
||||||
query: r.query,
|
query: r.query,
|
||||||
peerId: r.PeerID(),
|
peerId: r.PeerID(),
|
||||||
|
|
|
@ -6,12 +6,14 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/waku-org/go-waku/waku/persistence"
|
"github.com/waku-org/go-waku/waku/persistence"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIndexComputation(t *testing.T) {
|
func TestIndexComputation(t *testing.T) {
|
||||||
msg := &pb.WakuMessage{
|
msg := &wpb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
|
@ -22,14 +24,14 @@ func TestIndexComputation(t *testing.T) {
|
||||||
require.NotZero(t, idx.Digest)
|
require.NotZero(t, idx.Digest)
|
||||||
require.Len(t, idx.Digest, 32)
|
require.Len(t, idx.Digest, 32)
|
||||||
|
|
||||||
msg1 := &pb.WakuMessage{
|
msg1 := &wpb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
Timestamp: 123,
|
Timestamp: 123,
|
||||||
ContentTopic: "/waku/2/default-content/proto",
|
ContentTopic: "/waku/2/default-content/proto",
|
||||||
}
|
}
|
||||||
idx1 := protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), "test").Index()
|
idx1 := protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), "test").Index()
|
||||||
|
|
||||||
msg2 := &pb.WakuMessage{
|
msg2 := &wpb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
Timestamp: 123,
|
Timestamp: 123,
|
||||||
ContentTopic: "/waku/2/default-content/proto",
|
ContentTopic: "/waku/2/default-content/proto",
|
||||||
|
@ -43,7 +45,7 @@ func createSampleList(s int) []*protocol.Envelope {
|
||||||
var result []*protocol.Envelope
|
var result []*protocol.Envelope
|
||||||
for i := 0; i < s; i++ {
|
for i := 0; i < s; i++ {
|
||||||
msg :=
|
msg :=
|
||||||
&pb.WakuMessage{
|
&wpb.WakuMessage{
|
||||||
Payload: []byte{byte(i)},
|
Payload: []byte{byte(i)},
|
||||||
Timestamp: int64(i),
|
Timestamp: int64(i),
|
||||||
}
|
}
|
||||||
|
@ -65,7 +67,8 @@ func TestForwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err := findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err := findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 2)
|
require.Len(t, messages, 2)
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[4].Message(), msgList[5].Message()}, messages)
|
require.True(t, proto.Equal(msgList[4].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[5].Message(), messages[1]))
|
||||||
require.Equal(t, msgList[5].Index(), newPagingInfo.Cursor)
|
require.Equal(t, msgList[5].Index(), newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an initial pagination request with an empty cursor
|
// test for an initial pagination request with an empty cursor
|
||||||
|
@ -73,7 +76,8 @@ func TestForwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 2)
|
require.Len(t, messages, 2)
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[0].Message(), msgList[1].Message()}, messages)
|
require.True(t, proto.Equal(msgList[0].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[1].Message(), messages[1]))
|
||||||
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an initial pagination request with an empty cursor to fetch the entire history
|
// test for an initial pagination request with an empty cursor to fetch the entire history
|
||||||
|
@ -81,7 +85,7 @@ func TestForwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 10)
|
require.Len(t, messages, 10)
|
||||||
require.Equal(t, msgList[9].Message(), messages[9])
|
require.True(t, proto.Equal(msgList[9].Message(), messages[9]))
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an empty msgList
|
// test for an empty msgList
|
||||||
|
@ -96,7 +100,8 @@ func TestForwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 6)
|
require.Len(t, messages, 6)
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[4].Message(), msgList[5].Message(), msgList[6].Message(), msgList[7].Message(), msgList[8].Message(), msgList[9].Message()}, messages)
|
require.True(t, proto.Equal(msgList[4].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[9].Message(), messages[5]))
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for a page size larger than the maximum allowed page size
|
// test for a page size larger than the maximum allowed page size
|
||||||
|
@ -114,7 +119,7 @@ func TestForwardPagination(t *testing.T) {
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an invalid cursor
|
// test for an invalid cursor
|
||||||
invalidIndex := protocol.NewEnvelope(&pb.WakuMessage{Payload: []byte{255, 255, 255}}, utils.GetUnixEpoch(), "test").Index()
|
invalidIndex := protocol.NewEnvelope(&wpb.WakuMessage{Payload: []byte{255, 255, 255}}, utils.GetUnixEpoch(), "test").Index()
|
||||||
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_FORWARD}
|
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_FORWARD}
|
||||||
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
||||||
|
@ -145,7 +150,8 @@ func TestBackwardPagination(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 2)
|
require.Len(t, messages, 2)
|
||||||
|
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[1].Message(), msgList[2].Message()}, messages)
|
require.True(t, proto.Equal(msgList[1].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[2].Message(), messages[1]))
|
||||||
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an initial pagination request with an empty cursor
|
// test for an initial pagination request with an empty cursor
|
||||||
|
@ -153,7 +159,8 @@ func TestBackwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 2)
|
require.Len(t, messages, 2)
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[8].Message(), msgList[9].Message()}, messages)
|
require.True(t, proto.Equal(msgList[8].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[9].Message(), messages[1]))
|
||||||
require.Equal(t, msgList[8].Index(), newPagingInfo.Cursor)
|
require.Equal(t, msgList[8].Index(), newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an initial pagination request with an empty cursor to fetch the entire history
|
// test for an initial pagination request with an empty cursor to fetch the entire history
|
||||||
|
@ -161,8 +168,8 @@ func TestBackwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 10)
|
require.Len(t, messages, 10)
|
||||||
require.Equal(t, msgList[0].Message(), messages[0])
|
require.True(t, proto.Equal(msgList[0].Message(), messages[0]))
|
||||||
require.Equal(t, msgList[9].Message(), messages[9])
|
require.True(t, proto.Equal(msgList[9].Message(), messages[9]))
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an empty msgList
|
// test for an empty msgList
|
||||||
|
@ -179,7 +186,8 @@ func TestBackwardPagination(t *testing.T) {
|
||||||
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 3)
|
require.Len(t, messages, 3)
|
||||||
require.Equal(t, []*pb.WakuMessage{msgList[0].Message(), msgList[1].Message(), msgList[2].Message()}, messages)
|
require.True(t, proto.Equal(msgList[0].Message(), messages[0]))
|
||||||
|
require.True(t, proto.Equal(msgList[2].Message(), messages[2]))
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for a page size larger than the maximum allowed page size
|
// test for a page size larger than the maximum allowed page size
|
||||||
|
@ -198,7 +206,7 @@ func TestBackwardPagination(t *testing.T) {
|
||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an invalid cursor
|
// test for an invalid cursor
|
||||||
invalidIndex := protocol.NewEnvelope(&pb.WakuMessage{Payload: []byte{255, 255, 255}}, utils.GetUnixEpoch(), "test").Index()
|
invalidIndex := protocol.NewEnvelope(&wpb.WakuMessage{Payload: []byte{255, 255, 255}}, utils.GetUnixEpoch(), "test").Index()
|
||||||
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_BACKWARD}
|
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_BACKWARD}
|
||||||
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStorePersistence(t *testing.T) {
|
func TestStorePersistence(t *testing.T) {
|
||||||
|
@ -39,7 +40,7 @@ func TestStorePersistence(t *testing.T) {
|
||||||
allMsgs, err := db.GetAll()
|
allMsgs, err := db.GetAll()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, allMsgs, 1)
|
require.Len(t, allMsgs, 1)
|
||||||
require.Equal(t, msg, allMsgs[0].Message)
|
require.True(t, proto.Equal(msg, allMsgs[0].Message))
|
||||||
|
|
||||||
// Storing a duplicated message should not crash. It's okay to generate an error log in this case
|
// Storing a duplicated message should not crash. It's okay to generate an error log in this case
|
||||||
err = s1.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), defaultPubSubTopic))
|
err = s1.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||||
|
|
|
@ -9,21 +9,22 @@ import (
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
"github.com/libp2p/go-msgio/protoio"
|
"github.com/libp2p/go-msgio/pbio"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/logging"
|
"github.com/waku-org/go-waku/logging"
|
||||||
"github.com/waku-org/go-waku/waku/persistence"
|
"github.com/waku-org/go-waku/waku/persistence"
|
||||||
"github.com/waku-org/go-waku/waku/v2/metrics"
|
"github.com/waku-org/go-waku/waku/v2/metrics"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaxTimeVariance is the maximum duration in the future allowed for a message timestamp
|
// MaxTimeVariance is the maximum duration in the future allowed for a message timestamp
|
||||||
const MaxTimeVariance = time.Duration(20) * time.Second
|
const MaxTimeVariance = time.Duration(20) * time.Second
|
||||||
|
|
||||||
func findMessages(query *pb.HistoryQuery, msgProvider MessageProvider) ([]*pb.WakuMessage, *pb.PagingInfo, error) {
|
func findMessages(query *pb.HistoryQuery, msgProvider MessageProvider) ([]*wpb.WakuMessage, *pb.PagingInfo, error) {
|
||||||
if query.PagingInfo == nil {
|
if query.PagingInfo == nil {
|
||||||
query.PagingInfo = &pb.PagingInfo{
|
query.PagingInfo = &pb.PagingInfo{
|
||||||
Direction: pb.PagingInfo_FORWARD,
|
Direction: pb.PagingInfo_FORWARD,
|
||||||
|
@ -47,7 +48,7 @@ func findMessages(query *pb.HistoryQuery, msgProvider MessageProvider) ([]*pb.Wa
|
||||||
return nil, &pb.PagingInfo{Cursor: nil}, nil
|
return nil, &pb.PagingInfo{Cursor: nil}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
resultMessages := make([]*pb.WakuMessage, len(queryResult))
|
resultMessages := make([]*wpb.WakuMessage, len(queryResult))
|
||||||
for i := range queryResult {
|
for i := range queryResult {
|
||||||
resultMessages[i] = queryResult[i].Message
|
resultMessages[i] = queryResult[i].Message
|
||||||
}
|
}
|
||||||
|
@ -86,7 +87,7 @@ type MessageProvider interface {
|
||||||
type Store interface {
|
type Store interface {
|
||||||
Start(ctx context.Context) error
|
Start(ctx context.Context) error
|
||||||
Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error)
|
Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error)
|
||||||
Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*pb.WakuMessage, error)
|
Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error)
|
||||||
Next(ctx context.Context, r *Result) (*Result, error)
|
Next(ctx context.Context, r *Result) (*Result, error)
|
||||||
Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error)
|
Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error)
|
||||||
MessageChannel() chan *protocol.Envelope
|
MessageChannel() chan *protocol.Envelope
|
||||||
|
@ -184,8 +185,8 @@ func (store *WakuStore) onRequest(s network.Stream) {
|
||||||
logger := store.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
logger := store.log.With(logging.HostID("peer", s.Conn().RemotePeer()))
|
||||||
historyRPCRequest := &pb.HistoryRPC{}
|
historyRPCRequest := &pb.HistoryRPC{}
|
||||||
|
|
||||||
writer := protoio.NewDelimitedWriter(s)
|
writer := pbio.NewDelimitedWriter(s)
|
||||||
reader := protoio.NewDelimitedReader(s, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(s, math.MaxInt32)
|
||||||
|
|
||||||
err := reader.ReadMsg(historyRPCRequest)
|
err := reader.ReadMsg(historyRPCRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -246,7 +247,7 @@ func (store *WakuStore) Stop() {
|
||||||
store.wg.Wait()
|
store.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *WakuStore) queryLoop(ctx context.Context, query *pb.HistoryQuery, candidateList []peer.ID) ([]*pb.WakuMessage, error) {
|
func (store *WakuStore) queryLoop(ctx context.Context, query *pb.HistoryQuery, candidateList []peer.ID) ([]*wpb.WakuMessage, error) {
|
||||||
// loops through the candidateList in order and sends the query to each until one of the query gets resolved successfully
|
// loops through the candidateList in order and sends the query to each until one of the query gets resolved successfully
|
||||||
// returns the number of retrieved messages, or error if all the requests fail
|
// returns the number of retrieved messages, or error if all the requests fail
|
||||||
|
|
||||||
|
@ -270,7 +271,7 @@ func (store *WakuStore) queryLoop(ctx context.Context, query *pb.HistoryQuery, c
|
||||||
queryWg.Wait()
|
queryWg.Wait()
|
||||||
close(resultChan)
|
close(resultChan)
|
||||||
|
|
||||||
var messages []*pb.WakuMessage
|
var messages []*wpb.WakuMessage
|
||||||
hasResults := false
|
hasResults := false
|
||||||
for result := range resultChan {
|
for result := range resultChan {
|
||||||
hasResults = true
|
hasResults = true
|
||||||
|
|
|
@ -6,7 +6,10 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/waku-org/go-waku/tests"
|
"github.com/waku-org/go-waku/tests"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
)
|
)
|
||||||
|
@ -31,7 +34,7 @@ func TestStoreQuery(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
require.Len(t, response.Messages, 1)
|
require.Len(t, response.Messages, 1)
|
||||||
require.Equal(t, msg1, response.Messages[0])
|
require.True(t, proto.Equal(msg1, response.Messages[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStoreQueryMultipleContentFilters(t *testing.T) {
|
func TestStoreQueryMultipleContentFilters(t *testing.T) {
|
||||||
|
@ -62,9 +65,8 @@ func TestStoreQueryMultipleContentFilters(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
require.Len(t, response.Messages, 2)
|
require.Len(t, response.Messages, 2)
|
||||||
require.Contains(t, response.Messages, msg1)
|
require.True(t, proto.Equal(response.Messages[0], msg1))
|
||||||
require.Contains(t, response.Messages, msg3)
|
require.True(t, proto.Equal(response.Messages[1], msg3))
|
||||||
require.NotContains(t, response.Messages, msg2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStoreQueryPubsubTopicFilter(t *testing.T) {
|
func TestStoreQueryPubsubTopicFilter(t *testing.T) {
|
||||||
|
@ -96,7 +98,7 @@ func TestStoreQueryPubsubTopicFilter(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
require.Len(t, response.Messages, 1)
|
require.Len(t, response.Messages, 1)
|
||||||
require.Equal(t, msg1, response.Messages[0])
|
require.True(t, proto.Equal(msg1, response.Messages[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStoreQueryPubsubTopicNoMatch(t *testing.T) {
|
func TestStoreQueryPubsubTopicNoMatch(t *testing.T) {
|
||||||
|
@ -142,9 +144,9 @@ func TestStoreQueryPubsubTopicAllMessages(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
require.Len(t, response.Messages, 3)
|
require.Len(t, response.Messages, 3)
|
||||||
require.Contains(t, response.Messages, msg1)
|
require.True(t, proto.Equal(response.Messages[0], msg1))
|
||||||
require.Contains(t, response.Messages, msg2)
|
require.True(t, proto.Equal(response.Messages[1], msg2))
|
||||||
require.Contains(t, response.Messages, msg3)
|
require.True(t, proto.Equal(response.Messages[2], msg3))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStoreQueryForwardPagination(t *testing.T) {
|
func TestStoreQueryForwardPagination(t *testing.T) {
|
||||||
|
@ -177,7 +179,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) {
|
||||||
|
|
||||||
s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger())
|
s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger())
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
msg := &pb.WakuMessage{
|
msg := &wpb.WakuMessage{
|
||||||
Payload: []byte{byte(i)},
|
Payload: []byte{byte(i)},
|
||||||
ContentTopic: topic1,
|
ContentTopic: topic1,
|
||||||
Version: 0,
|
Version: 0,
|
||||||
|
@ -203,7 +205,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) {
|
||||||
func TestTemporalHistoryQueries(t *testing.T) {
|
func TestTemporalHistoryQueries(t *testing.T) {
|
||||||
s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger())
|
s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger())
|
||||||
|
|
||||||
var messages []*pb.WakuMessage
|
var messages []*wpb.WakuMessage
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
contentTopic := "1"
|
contentTopic := "1"
|
||||||
if i%2 == 0 {
|
if i%2 == 0 {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package pb
|
||||||
|
|
||||||
|
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mwaku_swap.proto=github.com/waku-org/go-waku/waku/v2/protocol/swap/pb --go_out=. ./waku_swap.proto
|
|
@ -0,0 +1,243 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.26.0
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: waku_swap.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Cheque struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
IssuerAddress string `protobuf:"bytes,1,opt,name=issuerAddress,proto3" json:"issuerAddress,omitempty"`
|
||||||
|
Beneficiary []byte `protobuf:"bytes,2,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
|
||||||
|
Date uint32 `protobuf:"varint,3,opt,name=date,proto3" json:"date,omitempty"`
|
||||||
|
Amount uint32 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||||
|
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) Reset() {
|
||||||
|
*x = Cheque{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_swap_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Cheque) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Cheque) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_swap_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Cheque.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Cheque) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_swap_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) GetIssuerAddress() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.IssuerAddress
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) GetBeneficiary() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.Beneficiary
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) GetDate() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Date
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) GetAmount() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Amount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cheque) GetSignature() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.Signature
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Handshake struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Beneficiary []byte `protobuf:"bytes,1,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Handshake) Reset() {
|
||||||
|
*x = Handshake{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_waku_swap_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Handshake) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Handshake) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Handshake) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_waku_swap_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Handshake.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Handshake) Descriptor() ([]byte, []int) {
|
||||||
|
return file_waku_swap_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Handshake) GetBeneficiary() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.Beneficiary
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_waku_swap_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_waku_swap_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x0f, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9a, 0x01, 0x0a, 0x06, 0x43, 0x68, 0x65, 0x71, 0x75, 0x65,
|
||||||
|
0x12, 0x24, 0x0a, 0x0d, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||||
|
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x41,
|
||||||
|
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69,
|
||||||
|
0x63, 0x69, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x6e,
|
||||||
|
0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65,
|
||||||
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
||||||
|
0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6d,
|
||||||
|
0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72,
|
||||||
|
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75,
|
||||||
|
0x72, 0x65, 0x22, 0x2d, 0x0a, 0x09, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x12,
|
||||||
|
0x20, 0x0a, 0x0b, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x18, 0x01,
|
||||||
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72,
|
||||||
|
0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_waku_swap_proto_rawDescOnce sync.Once
|
||||||
|
file_waku_swap_proto_rawDescData = file_waku_swap_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_waku_swap_proto_rawDescGZIP() []byte {
|
||||||
|
file_waku_swap_proto_rawDescOnce.Do(func() {
|
||||||
|
file_waku_swap_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_swap_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_waku_swap_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_waku_swap_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
|
var file_waku_swap_proto_goTypes = []interface{}{
|
||||||
|
(*Cheque)(nil), // 0: pb.Cheque
|
||||||
|
(*Handshake)(nil), // 1: pb.Handshake
|
||||||
|
}
|
||||||
|
var file_waku_swap_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_waku_swap_proto_init() }
|
||||||
|
func file_waku_swap_proto_init() {
|
||||||
|
if File_waku_swap_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_waku_swap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Cheque); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_waku_swap_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Handshake); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_waku_swap_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 2,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_waku_swap_proto_goTypes,
|
||||||
|
DependencyIndexes: file_waku_swap_proto_depIdxs,
|
||||||
|
MessageInfos: file_waku_swap_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_waku_swap_proto = out.File
|
||||||
|
file_waku_swap_proto_rawDesc = nil
|
||||||
|
file_waku_swap_proto_goTypes = nil
|
||||||
|
file_waku_swap_proto_depIdxs = nil
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ import (
|
||||||
"github.com/waku-org/go-waku/waku/v2/node"
|
"github.com/waku-org/go-waku/waku/v2/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ type FilterService struct {
|
||||||
node *node.WakuNode
|
node *node.WakuNode
|
||||||
log *zap.Logger
|
log *zap.Logger
|
||||||
|
|
||||||
messages map[string][]*pb.WakuMessage
|
messages map[string][]*wpb.WakuMessage
|
||||||
cacheCapacity int
|
cacheCapacity int
|
||||||
messagesMutex sync.RWMutex
|
messagesMutex sync.RWMutex
|
||||||
|
|
||||||
|
@ -24,8 +25,8 @@ type FilterService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FilterContentArgs struct {
|
type FilterContentArgs struct {
|
||||||
Topic string `json:"topic,omitempty"`
|
Topic string `json:"topic,omitempty"`
|
||||||
ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"`
|
ContentFilters []*pb.FilterRequest_ContentFilter `json:"contentFilters,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContentTopicArgs struct {
|
type ContentTopicArgs struct {
|
||||||
|
@ -37,7 +38,7 @@ func NewFilterService(node *node.WakuNode, cacheCapacity int, log *zap.Logger) *
|
||||||
node: node,
|
node: node,
|
||||||
log: log.Named("filter"),
|
log: log.Named("filter"),
|
||||||
cacheCapacity: cacheCapacity,
|
cacheCapacity: cacheCapacity,
|
||||||
messages: make(map[string][]*pb.WakuMessage),
|
messages: make(map[string][]*wpb.WakuMessage),
|
||||||
}
|
}
|
||||||
s.runner = newRunnerService(node.Broadcaster(), s.addEnvelope)
|
s.runner = newRunnerService(node.Broadcaster(), s.addEnvelope)
|
||||||
return s
|
return s
|
||||||
|
@ -91,7 +92,7 @@ func (f *FilterService) PostV1Subscription(req *http.Request, args *FilterConten
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, contentFilter := range args.ContentFilters {
|
for _, contentFilter := range args.ContentFilters {
|
||||||
f.messages[contentFilter.ContentTopic] = make([]*pb.WakuMessage, 0)
|
f.messages[contentFilter.ContentTopic] = make([]*wpb.WakuMessage, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
*reply = true
|
*reply = true
|
||||||
|
@ -125,6 +126,6 @@ func (f *FilterService) GetV1Messages(req *http.Request, args *ContentTopicArgs,
|
||||||
|
|
||||||
*reply = f.messages[args.ContentTopic]
|
*reply = f.messages[args.ContentTopic]
|
||||||
|
|
||||||
f.messages[args.ContentTopic] = make([]*pb.WakuMessage, 0)
|
f.messages[args.ContentTopic] = make([]*wpb.WakuMessage, 0)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ import (
|
||||||
v2 "github.com/waku-org/go-waku/waku/v2"
|
v2 "github.com/waku-org/go-waku/waku/v2"
|
||||||
"github.com/waku-org/go-waku/waku/v2/node"
|
"github.com/waku-org/go-waku/waku/v2/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/filter/pb"
|
||||||
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
@ -75,7 +76,7 @@ func TestFilterSubscription(t *testing.T) {
|
||||||
_, err = d.node.AddPeer(addr, string(filter.FilterID_v20beta1))
|
_, err = d.node.AddPeer(addr, string(filter.FilterID_v20beta1))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
args := &FilterContentArgs{Topic: testTopic, ContentFilters: []pb.ContentFilter{{ContentTopic: "ct"}}}
|
args := &FilterContentArgs{Topic: testTopic, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: "ct"}}}
|
||||||
|
|
||||||
var reply SuccessReply
|
var reply SuccessReply
|
||||||
err = d.PostV1Subscription(
|
err = d.PostV1Subscription(
|
||||||
|
@ -117,7 +118,7 @@ func TestFilterGetV1Messages(t *testing.T) {
|
||||||
// Wait for the dial to complete
|
// Wait for the dial to complete
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
args := &FilterContentArgs{Topic: testTopic, ContentFilters: []pb.ContentFilter{{ContentTopic: "ct"}}}
|
args := &FilterContentArgs{Topic: testTopic, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: "ct"}}}
|
||||||
err = serviceB.PostV1Subscription(
|
err = serviceB.PostV1Subscription(
|
||||||
makeRequest(t),
|
makeRequest(t),
|
||||||
args,
|
args,
|
||||||
|
@ -131,7 +132,7 @@ func TestFilterGetV1Messages(t *testing.T) {
|
||||||
|
|
||||||
_, err = serviceA.node.Relay().PublishToTopic(
|
_, err = serviceA.node.Relay().PublishToTopic(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
&pb.WakuMessage{ContentTopic: "ct"},
|
&wpb.WakuMessage{ContentTopic: "ct"},
|
||||||
testTopic,
|
testTopic,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -4,8 +4,9 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/node"
|
"github.com/waku-org/go-waku/waku/v2/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
||||||
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ type StoreMessagesArgs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreMessagesReply struct {
|
type StoreMessagesReply struct {
|
||||||
Messages []*pb.WakuMessage `json:"messages,omitempty"`
|
Messages []*wpb.WakuMessage `json:"messages,omitempty"`
|
||||||
PagingInfo StorePagingOptions `json:"pagingInfo,omitempty"`
|
PagingInfo StorePagingOptions `json:"pagingInfo,omitempty"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue