diff --git a/Makefile b/Makefile index d1c6505c..7b371732 100644 --- a/Makefile +++ b/Makefile @@ -85,11 +85,7 @@ _after-cc: test-ci: _before-cc test _after-cc generate: - ${GOBIN} generate ./waku/v2/protocol/pb/generate.go - ${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 + ${GOBIN} generate ./... coverage: diff --git a/dbutils/insert.go b/dbutils/insert.go deleted file mode 100644 index 7fae35f0..00000000 --- a/dbutils/insert.go +++ /dev/null @@ -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) - } - } -} diff --git a/examples/basic2/go.mod b/examples/basic2/go.mod index d79bb36d..4f2f6b7d 100644 --- a/examples/basic2/go.mod +++ b/examples/basic2/go.mod @@ -8,8 +8,8 @@ replace github.com/ethereum/go-ethereum v1.10.25 => github.com/status-im/go-ethe require ( 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 + go.uber.org/zap v1.23.0 ) require ( @@ -53,6 +53,7 @@ require ( github.com/huin/goupnp v1.0.3 // indirect github.com/ipfs/go-cid v0.3.2 // 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/jbenet/go-temp-err-catcher v0.1.0 // 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-pubsub v0.8.1 // 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-netroute v0.2.0 // indirect github.com/libp2p/go-openssl v0.1.0 // indirect @@ -125,7 +126,6 @@ require ( go.opencensus.io v0.23.0 // indirect go.uber.org/atomic v1.10.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/exp v0.0.0-20220916125017-b168a2c6b86b // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect diff --git a/examples/basic2/go.sum b/examples/basic2/go.sum index 74022e0b..671aed2c 100644 --- a/examples/basic2/go.sum +++ b/examples/basic2/go.sum @@ -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-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-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +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/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= diff --git a/examples/chat2/go.mod b/examples/chat2/go.mod index aff7b963..a16147fc 100644 --- a/examples/chat2/go.mod +++ b/examples/chat2/go.mod @@ -11,7 +11,6 @@ require ( github.com/charmbracelet/bubbletea v0.22.0 github.com/charmbracelet/lipgloss v0.5.0 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/libp2p/go-libp2p v0.23.2 github.com/muesli/reflow v0.3.0 @@ -58,6 +57,7 @@ require ( github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // 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/google/gopacket v1.1.19 // 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-pubsub v0.8.1 // 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-netroute v0.2.0 // indirect github.com/libp2p/go-openssl v0.1.0 // indirect diff --git a/examples/chat2/go.sum b/examples/chat2/go.sum index 19b2fb2c..f428eb95 100644 --- a/examples/chat2/go.sum +++ b/examples/chat2/go.sum @@ -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-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-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +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/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= diff --git a/examples/chat2/pb/chat2.pb.go b/examples/chat2/pb/chat2.pb.go index 4375d4cf..915ef148 100644 --- a/examples/chat2/pb/chat2.pb.go +++ b/examples/chat2/pb/chat2.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.14.0 +// protoc-gen-go v1.26.0 +// protoc v3.21.12 // source: chat2.proto package pb import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = 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 { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/examples/chat2/pb/generate.go b/examples/chat2/pb/generate.go new file mode 100644 index 00000000..c69b6841 --- /dev/null +++ b/examples/chat2/pb/generate.go @@ -0,0 +1,3 @@ +package pb + +//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mchat2.proto=./pb --go_out=. ./chat2.proto diff --git a/examples/filter2/go.mod b/examples/filter2/go.mod index 904c1163..2c8f6e9c 100644 --- a/examples/filter2/go.mod +++ b/examples/filter2/go.mod @@ -66,7 +66,7 @@ require ( 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-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-netroute v0.2.0 // indirect github.com/libp2p/go-openssl v0.1.0 // indirect diff --git a/examples/filter2/go.sum b/examples/filter2/go.sum index 74022e0b..671aed2c 100644 --- a/examples/filter2/go.sum +++ b/examples/filter2/go.sum @@ -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-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-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +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/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= diff --git a/examples/noise/chat2.pb.go b/examples/noise/chat2.pb.go index 448d399e..242cf7dc 100644 --- a/examples/noise/chat2.pb.go +++ b/examples/noise/chat2.pb.go @@ -7,7 +7,7 @@ package main import ( - proto "github.com/golang/protobuf/proto" + proto "google.golang.org/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" diff --git a/go.mod b/go.mod index 8563b305..758ee598 100644 --- a/go.mod +++ b/go.mod @@ -9,15 +9,14 @@ require ( github.com/btcsuite/btcd/btcec/v2 v2.2.1 github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d 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/protobuf v1.5.2 + github.com/golang/protobuf v1.5.2 // indirect github.com/gorilla/rpc v1.2.0 github.com/ipfs/go-ds-sql v0.3.0 github.com/ipfs/go-log/v2 v2.5.1 github.com/libp2p/go-libp2p v0.23.2 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/multiformats/go-multiaddr v0.7.0 github.com/onsi/ginkgo v1.16.5 // indirect @@ -41,7 +40,10 @@ require ( 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 ( 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/time v0.0.0-20220224211638-0e9765cccd65 // 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/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 072a8441..514a03f0 100644 --- a/go.sum +++ b/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-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-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +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/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= diff --git a/logging/logging.go b/logging/logging.go index 7a2e9f65..947696fd 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -15,7 +15,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enode" "github.com/libp2p/go-libp2p/core/peer" "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/zapcore" ) diff --git a/mobile/api_filter.go b/mobile/api_filter.go index 23ddc638..33c05ccf 100644 --- a/mobile/api_filter.go +++ b/mobile/api_filter.go @@ -7,12 +7,12 @@ import ( "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/pb" + "github.com/waku-org/go-waku/waku/v2/protocol/filter/pb" ) type FilterArgument struct { - Topic string `json:"pubsubTopic,omitempty"` - ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"` + Topic string `json:"pubsubTopic,omitempty"` + ContentFilters []*pb.FilterRequest_ContentFilter `json:"contentFilters,omitempty"` } func toContentFilter(filterJSON string) (filter.ContentFilter, error) { diff --git a/mobile/api_lightpush.go b/mobile/api_lightpush.go index 5e86283f..3d008e70 100644 --- a/mobile/api_lightpush.go +++ b/mobile/api_lightpush.go @@ -11,7 +11,7 @@ import ( "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 { return "", errWakuNodeNotReady } @@ -37,7 +37,7 @@ func lightpushPublish(msg pb.WakuMessage, pubsubTopic string, peerID string, ms 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 } diff --git a/mobile/api_relay.go b/mobile/api_relay.go index a4b6adc0..7e3edd88 100644 --- a/mobile/api_relay.go +++ b/mobile/api_relay.go @@ -28,7 +28,7 @@ func RelayEnoughPeers(topic string) string { 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 { return "", errWakuNodeNotReady } @@ -43,7 +43,7 @@ func relayPublish(msg pb.WakuMessage, pubsubTopic string, ms int) (string, error ctx = context.Background() } - hash, err := wakuNode.Relay().PublishToTopic(ctx, &msg, pubsubTopic) + hash, err := wakuNode.Relay().PublishToTopic(ctx, msg, pubsubTopic) return hexutil.Encode(hash), err } diff --git a/mobile/api_store.go b/mobile/api_store.go index e189c185..ac449973 100644 --- a/mobile/api_store.go +++ b/mobile/api_store.go @@ -4,8 +4,9 @@ import ( "C" "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/pb" ) import ( "context" @@ -21,15 +22,15 @@ type storePagingOptions struct { } type storeMessagesArgs struct { - Topic string `json:"pubsubTopic,omitempty"` - ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"` - StartTime int64 `json:"startTime,omitempty"` - EndTime int64 `json:"endTime,omitempty"` - PagingOptions storePagingOptions `json:"pagingOptions,omitempty"` + Topic string `json:"pubsubTopic,omitempty"` + ContentFilters []*pb.ContentFilter `json:"contentFilters,omitempty"` + StartTime int64 `json:"startTime,omitempty"` + EndTime int64 `json:"endTime,omitempty"` + PagingOptions storePagingOptions `json:"pagingOptions,omitempty"` } type storeMessagesReply struct { - Messages []*pb.WakuMessage `json:"messages,omitempty"` + Messages []*wpb.WakuMessage `json:"messages,omitempty"` PagingInfo storePagingOptions `json:"pagingInfo,omitempty"` Error string `json:"error,omitempty"` } diff --git a/mobile/encoding.go b/mobile/encoding.go index 79a5b97d..528d27ad 100644 --- a/mobile/encoding.go +++ b/mobile/encoding.go @@ -9,14 +9,14 @@ import ( "github.com/waku-org/go-waku/waku/v2/utils" ) -func wakuMessage(messageJSON string) (pb.WakuMessage, error) { - var msg pb.WakuMessage +func wakuMessage(messageJSON string) (*pb.WakuMessage, error) { + var msg *pb.WakuMessage err := json.Unmarshal([]byte(messageJSON), &msg) msg.Version = 0 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) if err != nil { return msg, err @@ -54,7 +54,7 @@ func wakuMessageSymmetricEncoding(messageJSON string, symmetricKey string, optio 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) if err != nil { return msg, err diff --git a/waku/persistence/postgres/migrations/bindata.go b/waku/persistence/postgres/migrations/bindata.go index 7651f0cd..e54604c8 100644 --- a/waku/persistence/postgres/migrations/bindata.go +++ b/waku/persistence/postgres/migrations/bindata.go @@ -88,7 +88,7 @@ func _1_messagesDownSql() (*asset, error) { 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}} return a, nil } @@ -108,7 +108,7 @@ func _1_messagesUpSql() (*asset, error) { 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}} return a, nil } @@ -128,7 +128,7 @@ func _2_messages_indexDownSql() (*asset, error) { 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}} return a, nil } @@ -148,7 +148,7 @@ func _2_messages_indexUpSql() (*asset, error) { 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}} return a, nil } @@ -168,7 +168,7 @@ func docGo() (*asset, error) { 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}} return a, nil } diff --git a/waku/persistence/sqlite/migrations/bindata.go b/waku/persistence/sqlite/migrations/bindata.go index 31d1b5d7..26c595bd 100644 --- a/waku/persistence/sqlite/migrations/bindata.go +++ b/waku/persistence/sqlite/migrations/bindata.go @@ -88,7 +88,7 @@ func _1_messagesDownSql() (*asset, error) { 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}} return a, nil } @@ -108,7 +108,7 @@ func _1_messagesUpSql() (*asset, error) { 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}} return a, nil } @@ -128,7 +128,7 @@ func _2_messages_indexDownSql() (*asset, error) { 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}} return a, nil } @@ -148,7 +148,7 @@ func _2_messages_indexUpSql() (*asset, error) { 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}} return a, nil } @@ -168,7 +168,7 @@ func docGo() (*asset, error) { 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}} return a, nil } diff --git a/waku/persistence/store.go b/waku/persistence/store.go index 00183752..d010ccda 100644 --- a/waku/persistence/store.go +++ b/waku/persistence/store.go @@ -9,7 +9,8 @@ import ( "time" "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/utils" "go.uber.org/zap" @@ -52,7 +53,7 @@ type StoredMessage struct { ID []byte PubsubTopic string ReceiverTime int64 - Message *pb.WakuMessage + Message *wpb.WakuMessage } // 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 } - msg := new(pb.WakuMessage) + msg := new(wpb.WakuMessage) msg.ContentTopic = contentTopic msg.Payload = payload msg.Timestamp = senderTimestamp diff --git a/waku/tools/tools.go b/waku/tools/tools.go index ed05ecbc..c7030d7f 100644 --- a/waku/tools/tools.go +++ b/waku/tools/tools.go @@ -5,5 +5,5 @@ package tools import ( - _ "github.com/gogo/protobuf/protoc-gen-gofast" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" ) diff --git a/waku/v2/protocol/envelope.go b/waku/v2/protocol/envelope.go index 72102ea6..837b560b 100644 --- a/waku/v2/protocol/envelope.go +++ b/waku/v2/protocol/envelope.go @@ -3,14 +3,15 @@ package protocol import ( "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 // and a hash used to identify a message based on the bytes of a WakuMessage // protobuffer type Envelope struct { - msg *pb.WakuMessage + msg *wpb.WakuMessage size int hash []byte index *pb.Index @@ -19,7 +20,7 @@ type Envelope struct { // NewEnvelope creates a new Envelope that contains 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 -func NewEnvelope(msg *pb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope { +func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *Envelope { messageHash, dataLen, _ := msg.Hash() hash := sha256.Sum256(append([]byte(msg.ContentTopic), msg.Payload...)) return &Envelope{ @@ -36,7 +37,7 @@ func NewEnvelope(msg *pb.WakuMessage, receiverTime int64, pubSubTopic string) *E } // Message returns the WakuMessage associated to an Envelope -func (e *Envelope) Message() *pb.WakuMessage { +func (e *Envelope) Message() *wpb.WakuMessage { return e.msg } diff --git a/waku/v2/protocol/filter/filter_subscribers.go b/waku/v2/protocol/filter/filter_subscribers.go index 94563a77..adfa669c 100644 --- a/waku/v2/protocol/filter/filter_subscribers.go +++ b/waku/v2/protocol/filter/filter_subscribers.go @@ -5,13 +5,13 @@ import ( "time" "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 { peer peer.ID 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 { diff --git a/waku/v2/protocol/filter/filter_subscribers_test.go b/waku/v2/protocol/filter/filter_subscribers_test.go index 4f6a2fb9..59853e45 100644 --- a/waku/v2/protocol/filter/filter_subscribers_test.go +++ b/waku/v2/protocol/filter/filter_subscribers_test.go @@ -7,7 +7,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/test" "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" @@ -30,7 +30,7 @@ func TestAppend(t *testing.T) { peerId := createPeerId(t) requestId := "request_1" contentTopic := "topic1" - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}}, @@ -46,7 +46,7 @@ func TestRemove(t *testing.T) { peerId := createPeerId(t) requestId := "request_1" contentTopic := "topic1" - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}}, @@ -64,7 +64,7 @@ func TestRemovePartial(t *testing.T) { requestId := "request_1" topic1 := "topic1" topic2 := "topic2" - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic1}, {ContentTopic: topic2}}, @@ -83,12 +83,12 @@ func TestRemoveDuplicateSubscriptions(t *testing.T) { topic := "topic" requestId1 := "request_1" requestId2 := "request_2" - request1 := pb.FilterRequest{ + request1 := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}}, } - request2 := pb.FilterRequest{ + request2 := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}}, @@ -108,12 +108,12 @@ func TestRemoveDuplicateSubscriptionsPartial(t *testing.T) { topic := "topic" requestId1 := "request_1" requestId2 := "request_2" - request1 := pb.FilterRequest{ + request1 := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}}, } - request2 := pb.FilterRequest{ + request2 := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: topic}}, @@ -132,7 +132,7 @@ func TestRemoveBogus(t *testing.T) { peerId := createPeerId(t) requestId := "request_1" contentTopic := "topic1" - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: true, Topic: TOPIC, ContentFilters: []*pb.FilterRequest_ContentFilter{{ContentTopic: contentTopic}}, diff --git a/waku/v2/protocol/filter/pb/generate.go b/waku/v2/protocol/filter/pb/generate.go new file mode 100644 index 00000000..56eb6863 --- /dev/null +++ b/waku/v2/protocol/filter/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/filter/pb/waku_filter.pb.go b/waku/v2/protocol/filter/pb/waku_filter.pb.go new file mode 100644 index 00000000..a26efdff --- /dev/null +++ b/waku/v2/protocol/filter/pb/waku_filter.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_filter.proto b/waku/v2/protocol/filter/pb/waku_filter.proto similarity index 100% rename from waku/v2/protocol/pb/waku_filter.proto rename to waku/v2/protocol/filter/pb/waku_filter.proto diff --git a/waku/v2/protocol/filter/waku_filter.go b/waku/v2/protocol/filter/waku_filter.go index eb54b8f1..0d17aa39 100644 --- a/waku/v2/protocol/filter/waku_filter.go +++ b/waku/v2/protocol/filter/waku_filter.go @@ -11,12 +11,13 @@ import ( "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" 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" 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/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/timesource" "go.opencensus.io/stats" @@ -116,7 +117,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) { filterRPCRequest := &pb.FilterRPC{} - reader := protoio.NewDelimitedReader(s, math.MaxInt32) + reader := pbio.NewDelimitedReader(s, math.MaxInt32) err := reader.ReadMsg(filterRPCRequest) if err != nil { @@ -139,7 +140,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) { // We're on a full node. // This is a filter request coming from a light node. 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 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 { - pushRPC := &pb.FilterRPC{RequestId: subscriber.requestId, Push: &pb.MessagePush{Messages: []*pb.WakuMessage{msg}}} +func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, msg *wpb.WakuMessage) error { + pushRPC := &pb.FilterRPC{RequestId: subscriber.requestId, Push: &pb.MessagePush{Messages: []*wpb.WakuMessage{msg}}} logger := wf.log.With(logging.HostID("peer", subscriber.peer)) // 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() - writer := protoio.NewDelimitedWriter(conn) + writer := pbio.NewDelimitedWriter(conn) err = writer.WriteMsg(pushRPC) if err != nil { logger.Error("pushing messages to peer", zap.Error(err)) @@ -268,7 +269,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil return } - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: true, Topic: filter.Topic, ContentFilters: contentFilters, @@ -285,8 +286,8 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil // This is the only successful path to subscription requestID := hex.EncodeToString(protocol.GenerateRequestId()) - writer := protoio.NewDelimitedWriter(conn) - filterRPC := &pb.FilterRPC{RequestId: requestID, Request: &request} + writer := pbio.NewDelimitedWriter(conn) + filterRPC := &pb.FilterRPC{RequestId: requestID, Request: request} wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC)) err = writer.WriteMsg(filterRPC) if err != nil { @@ -324,14 +325,14 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt contentFilters = append(contentFilters, &pb.FilterRequest_ContentFilter{ContentTopic: ct}) } - request := pb.FilterRequest{ + request := &pb.FilterRequest{ Subscribe: false, Topic: contentFilter.Topic, ContentFilters: contentFilters, } - writer := protoio.NewDelimitedWriter(conn) - filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: &request} + writer := pbio.NewDelimitedWriter(conn) + filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: request} err = writer.WriteMsg(filterRPC) if err != nil { return err diff --git a/waku/v2/protocol/filterv2/client.go b/waku/v2/protocol/filterv2/client.go index de384692..d792da9c 100644 --- a/waku/v2/protocol/filterv2/client.go +++ b/waku/v2/protocol/filterv2/client.go @@ -13,12 +13,13 @@ import ( "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" 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" 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/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" "go.opencensus.io/tag" "go.uber.org/zap" @@ -111,7 +112,7 @@ func (wf *WakuFilterLightnode) onRequest(ctx context.Context) func(s network.Str defer s.Close() 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{} 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) // Broadcasting message so it's stored @@ -149,8 +150,8 @@ func (wf *WakuFilterLightnode) request(ctx context.Context, params *FilterSubscr } defer conn.Close() - writer := protoio.NewDelimitedWriter(conn) - reader := protoio.NewDelimitedReader(conn, math.MaxInt32) + writer := pbio.NewDelimitedWriter(conn) + reader := pbio.NewDelimitedReader(conn, math.MaxInt32) request := &pb.FilterSubscribeRequest{ RequestId: hex.EncodeToString(params.requestId), diff --git a/waku/v2/protocol/filterv2/pb/generate.go b/waku/v2/protocol/filterv2/pb/generate.go new file mode 100644 index 00000000..bbc82cc5 --- /dev/null +++ b/waku/v2/protocol/filterv2/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/filterv2/pb/waku_filter_v2.pb.go b/waku/v2/protocol/filterv2/pb/waku_filter_v2.pb.go new file mode 100644 index 00000000..0bea8dbc --- /dev/null +++ b/waku/v2/protocol/filterv2/pb/waku_filter_v2.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_filter_v2.proto b/waku/v2/protocol/filterv2/pb/waku_filter_v2.proto similarity index 100% rename from waku/v2/protocol/pb/waku_filter_v2.proto rename to waku/v2/protocol/filterv2/pb/waku_filter_v2.proto diff --git a/waku/v2/protocol/filterv2/server.go b/waku/v2/protocol/filterv2/server.go index c5f85d07..761b52e0 100644 --- a/waku/v2/protocol/filterv2/server.go +++ b/waku/v2/protocol/filterv2/server.go @@ -11,13 +11,13 @@ import ( "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" 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" 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/protocol" "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" "go.opencensus.io/tag" "go.uber.org/zap" @@ -87,7 +87,7 @@ func (wf *WakuFilterFull) onRequest(ctx context.Context) func(s network.Stream) defer s.Close() 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{} err := reader.ReadMsg(subscribeRequest) @@ -125,7 +125,7 @@ func reply(s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequ response.StatusDesc = http.StatusText(statusCode) } - writer := protoio.NewDelimitedWriter(s) + writer := pbio.NewDelimitedWriter(s) err := writer.WriteMsg(response) if err != nil { 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() - writer := protoio.NewDelimitedWriter(conn) + writer := pbio.NewDelimitedWriter(conn) err = writer.WriteMsg(messagePush) if err != nil { logger.Error("pushing messages to peer", zap.Error(err)) diff --git a/waku/v2/protocol/lightpush/pb/generate.go b/waku/v2/protocol/lightpush/pb/generate.go new file mode 100644 index 00000000..5607e061 --- /dev/null +++ b/waku/v2/protocol/lightpush/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/lightpush/pb/waku_lightpush.pb.go b/waku/v2/protocol/lightpush/pb/waku_lightpush.pb.go new file mode 100644 index 00000000..68b32faa --- /dev/null +++ b/waku/v2/protocol/lightpush/pb/waku_lightpush.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_lightpush.proto b/waku/v2/protocol/lightpush/pb/waku_lightpush.proto similarity index 100% rename from waku/v2/protocol/pb/waku_lightpush.proto rename to waku/v2/protocol/lightpush/pb/waku_lightpush.proto diff --git a/waku/v2/protocol/lightpush/waku_lightpush.go b/waku/v2/protocol/lightpush/waku_lightpush.go index 1ec42904..6ef8186a 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush.go +++ b/waku/v2/protocol/lightpush/waku_lightpush.go @@ -9,11 +9,12 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/network" 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/waku/v2/metrics" "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" "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())) requestPushRPC := &pb.PushRPC{} - writer := protoio.NewDelimitedWriter(s) - reader := protoio.NewDelimitedReader(s, math.MaxInt32) + writer := pbio.NewDelimitedWriter(s) + reader := pbio.NewDelimitedReader(s, math.MaxInt32) err := reader.ReadMsg(requestPushRPC) 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} - writer := protoio.NewDelimitedWriter(connOpt) - reader := protoio.NewDelimitedReader(connOpt, math.MaxInt32) + writer := pbio.NewDelimitedWriter(connOpt) + reader := pbio.NewDelimitedReader(connOpt, math.MaxInt32) err = writer.WriteMsg(pushRequestRPC) 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 -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 { 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 -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...) } diff --git a/waku/v2/protocol/lightpush/waku_lightpush_test.go b/waku/v2/protocol/lightpush/waku_lightpush_test.go index 8c66b9fc..f9b2f9f3 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush_test.go +++ b/waku/v2/protocol/lightpush/waku_lightpush_test.go @@ -13,7 +13,7 @@ import ( "github.com/waku-org/go-waku/tests" 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/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/timesource" "github.com/waku-org/go-waku/waku/v2/utils" diff --git a/waku/v2/protocol/pb/generate.go b/waku/v2/protocol/pb/generate.go index b43c68d2..5ad36924 100644 --- a/waku/v2/protocol/pb/generate.go +++ b/waku/v2/protocol/pb/generate.go @@ -1,9 +1,3 @@ package pb -//go:generate protoc -I. --gofast_out=. ./waku_filter.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 +//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 diff --git a/waku/v2/protocol/pb/utils.go b/waku/v2/protocol/pb/utils.go index 51c1cef8..4e19483f 100644 --- a/waku/v2/protocol/pb/utils.go +++ b/waku/v2/protocol/pb/utils.go @@ -3,7 +3,7 @@ package pb import ( "crypto/sha256" - proto "github.com/golang/protobuf/proto" + proto "google.golang.org/protobuf/proto" ) // Hash calculates the hash of a waku message diff --git a/waku/v2/protocol/pb/waku_filter.pb.go b/waku/v2/protocol/pb/waku_filter.pb.go deleted file mode 100644 index 5be75ce0..00000000 --- a/waku/v2/protocol/pb/waku_filter.pb.go +++ /dev/null @@ -1,1110 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: waku_filter.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 FilterRequest struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FilterRequest) Reset() { *m = FilterRequest{} } -func (m *FilterRequest) String() string { return proto.CompactTextString(m) } -func (*FilterRequest) ProtoMessage() {} -func (*FilterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_79d5142e1da09ab0, []int{0} -} -func (m *FilterRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FilterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FilterRequest.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 *FilterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FilterRequest.Merge(m, src) -} -func (m *FilterRequest) XXX_Size() int { - return m.Size() -} -func (m *FilterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FilterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_FilterRequest proto.InternalMessageInfo - -func (m *FilterRequest) GetSubscribe() bool { - if m != nil { - return m.Subscribe - } - return false -} - -func (m *FilterRequest) GetTopic() string { - if m != nil { - return m.Topic - } - return "" -} - -func (m *FilterRequest) GetContentFilters() []*FilterRequest_ContentFilter { - if m != nil { - return m.ContentFilters - } - return nil -} - -type FilterRequest_ContentFilter struct { - ContentTopic string `protobuf:"bytes,1,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FilterRequest_ContentFilter) Reset() { *m = FilterRequest_ContentFilter{} } -func (m *FilterRequest_ContentFilter) String() string { return proto.CompactTextString(m) } -func (*FilterRequest_ContentFilter) ProtoMessage() {} -func (*FilterRequest_ContentFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_79d5142e1da09ab0, []int{0, 0} -} -func (m *FilterRequest_ContentFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FilterRequest_ContentFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FilterRequest_ContentFilter.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 *FilterRequest_ContentFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_FilterRequest_ContentFilter.Merge(m, src) -} -func (m *FilterRequest_ContentFilter) XXX_Size() int { - return m.Size() -} -func (m *FilterRequest_ContentFilter) XXX_DiscardUnknown() { - xxx_messageInfo_FilterRequest_ContentFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_FilterRequest_ContentFilter proto.InternalMessageInfo - -func (m *FilterRequest_ContentFilter) GetContentTopic() string { - if m != nil { - return m.ContentTopic - } - return "" -} - -type MessagePush struct { - Messages []*WakuMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessagePush) Reset() { *m = MessagePush{} } -func (m *MessagePush) String() string { return proto.CompactTextString(m) } -func (*MessagePush) ProtoMessage() {} -func (*MessagePush) Descriptor() ([]byte, []int) { - return fileDescriptor_79d5142e1da09ab0, []int{1} -} -func (m *MessagePush) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MessagePush) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MessagePush.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 *MessagePush) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessagePush.Merge(m, src) -} -func (m *MessagePush) XXX_Size() int { - return m.Size() -} -func (m *MessagePush) XXX_DiscardUnknown() { - xxx_messageInfo_MessagePush.DiscardUnknown(m) -} - -var xxx_messageInfo_MessagePush proto.InternalMessageInfo - -func (m *MessagePush) GetMessages() []*WakuMessage { - if m != nil { - return m.Messages - } - return nil -} - -type FilterRPC struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FilterRPC) Reset() { *m = FilterRPC{} } -func (m *FilterRPC) String() string { return proto.CompactTextString(m) } -func (*FilterRPC) ProtoMessage() {} -func (*FilterRPC) Descriptor() ([]byte, []int) { - return fileDescriptor_79d5142e1da09ab0, []int{2} -} -func (m *FilterRPC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FilterRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FilterRPC.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 *FilterRPC) XXX_Merge(src proto.Message) { - xxx_messageInfo_FilterRPC.Merge(m, src) -} -func (m *FilterRPC) XXX_Size() int { - return m.Size() -} -func (m *FilterRPC) XXX_DiscardUnknown() { - xxx_messageInfo_FilterRPC.DiscardUnknown(m) -} - -var xxx_messageInfo_FilterRPC proto.InternalMessageInfo - -func (m *FilterRPC) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -func (m *FilterRPC) GetRequest() *FilterRequest { - if m != nil { - return m.Request - } - return nil -} - -func (m *FilterRPC) GetPush() *MessagePush { - if m != nil { - return m.Push - } - return nil -} - -func init() { - proto.RegisterType((*FilterRequest)(nil), "pb.FilterRequest") - proto.RegisterType((*FilterRequest_ContentFilter)(nil), "pb.FilterRequest.ContentFilter") - proto.RegisterType((*MessagePush)(nil), "pb.MessagePush") - proto.RegisterType((*FilterRPC)(nil), "pb.FilterRPC") -} - -func init() { proto.RegisterFile("waku_filter.proto", fileDescriptor_79d5142e1da09ab0) } - -var fileDescriptor_79d5142e1da09ab0 = []byte{ - // 286 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x4f, 0xcc, 0x2e, - 0x8d, 0x4f, 0xcb, 0xcc, 0x29, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2a, - 0x48, 0x92, 0x12, 0x02, 0x0b, 0xe7, 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x42, 0xc4, 0x95, 0x0e, - 0x32, 0x72, 0xf1, 0xba, 0x81, 0x15, 0x06, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x08, 0xc9, 0x70, - 0x71, 0x16, 0x97, 0x26, 0x15, 0x27, 0x17, 0x65, 0x26, 0xa5, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, - 0x04, 0x21, 0x04, 0x84, 0x44, 0xb8, 0x58, 0x4b, 0xf2, 0x0b, 0x32, 0x93, 0x25, 0x98, 0x14, 0x18, - 0x35, 0x38, 0x83, 0x20, 0x1c, 0x21, 0x77, 0x2e, 0xbe, 0xe4, 0xfc, 0xbc, 0x92, 0xd4, 0xbc, 0x12, - 0x88, 0x59, 0xc5, 0x12, 0xcc, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xf2, 0x7a, 0x05, 0x49, 0x7a, 0x28, - 0xc6, 0xeb, 0x39, 0x23, 0xab, 0x0b, 0x42, 0xd3, 0x26, 0x65, 0xcc, 0xc5, 0x8b, 0xa2, 0x40, 0x48, - 0x89, 0x8b, 0x07, 0xaa, 0x24, 0x04, 0x6c, 0x2d, 0x23, 0xd8, 0x5a, 0x14, 0x31, 0x25, 0x2b, 0x2e, - 0x6e, 0x5f, 0x88, 0xa7, 0x02, 0x4a, 0x8b, 0x33, 0x84, 0xb4, 0xb9, 0x38, 0xa0, 0x7e, 0x2c, 0x96, - 0x60, 0x04, 0x3b, 0x83, 0x1f, 0xe4, 0x8c, 0xf0, 0xc4, 0xec, 0x52, 0xa8, 0xb2, 0x20, 0xb8, 0x02, - 0xa5, 0x6a, 0x2e, 0x4e, 0xa8, 0x53, 0x02, 0x9c, 0x41, 0x5e, 0x2f, 0x82, 0x38, 0xd3, 0x33, 0x05, - 0x6a, 0x13, 0x42, 0x40, 0x48, 0x9b, 0x8b, 0x1d, 0xca, 0x01, 0x7b, 0x9e, 0xdb, 0x48, 0x10, 0xc3, - 0x77, 0x41, 0x30, 0x15, 0x42, 0xca, 0x5c, 0x2c, 0x05, 0xa5, 0xc5, 0x19, 0x12, 0xcc, 0x60, 0x95, - 0x60, 0x07, 0x20, 0xb9, 0x31, 0x08, 0x2c, 0xe9, 0x24, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, - 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xce, 0x78, 0x2c, 0xc7, 0x90, 0xc4, 0x06, 0x8e, 0x15, 0x63, - 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x76, 0xcc, 0x97, 0xc2, 0x01, 0x00, 0x00, -} - -func (m *FilterRequest) 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 *FilterRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FilterRequest) 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.ContentFilters) > 0 { - for iNdEx := len(m.ContentFilters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContentFilters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuFilter(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Topic) > 0 { - i -= len(m.Topic) - copy(dAtA[i:], m.Topic) - i = encodeVarintWakuFilter(dAtA, i, uint64(len(m.Topic))) - i-- - dAtA[i] = 0x12 - } - if m.Subscribe { - i-- - if m.Subscribe { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *FilterRequest_ContentFilter) 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 *FilterRequest_ContentFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FilterRequest_ContentFilter) 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.ContentTopic) > 0 { - i -= len(m.ContentTopic) - copy(dAtA[i:], m.ContentTopic) - i = encodeVarintWakuFilter(dAtA, i, uint64(len(m.ContentTopic))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MessagePush) 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 *MessagePush) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MessagePush) 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.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuFilter(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *FilterRPC) 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 *FilterRPC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FilterRPC) 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.Push != nil { - { - size, err := m.Push.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuFilter(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Request != nil { - { - size, err := m.Request.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuFilter(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.RequestId) > 0 { - i -= len(m.RequestId) - copy(dAtA[i:], m.RequestId) - i = encodeVarintWakuFilter(dAtA, i, uint64(len(m.RequestId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintWakuFilter(dAtA []byte, offset int, v uint64) int { - offset -= sovWakuFilter(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *FilterRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Subscribe { - n += 2 - } - l = len(m.Topic) - if l > 0 { - n += 1 + l + sovWakuFilter(uint64(l)) - } - if len(m.ContentFilters) > 0 { - for _, e := range m.ContentFilters { - l = e.Size() - n += 1 + l + sovWakuFilter(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *FilterRequest_ContentFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContentTopic) - if l > 0 { - n += 1 + l + sovWakuFilter(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MessagePush) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovWakuFilter(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *FilterRPC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestId) - if l > 0 { - n += 1 + l + sovWakuFilter(uint64(l)) - } - if m.Request != nil { - l = m.Request.Size() - n += 1 + l + sovWakuFilter(uint64(l)) - } - if m.Push != nil { - l = m.Push.Size() - n += 1 + l + sovWakuFilter(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovWakuFilter(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWakuFilter(x uint64) (n int) { - return sovWakuFilter(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *FilterRequest) 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 ErrIntOverflowWakuFilter - } - 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: FilterRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscribe", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Subscribe = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - 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 ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Topic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentFilters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentFilters = append(m.ContentFilters, &FilterRequest_ContentFilter{}) - if err := m.ContentFilters[len(m.ContentFilters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilter(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilter - } - 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 *FilterRequest_ContentFilter) 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 ErrIntOverflowWakuFilter - } - 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: ContentFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContentFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentTopic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - 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 ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilter(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilter - } - 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 *MessagePush) 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 ErrIntOverflowWakuFilter - } - 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: MessagePush: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MessagePush: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &WakuMessage{}) - if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilter(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilter - } - 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 *FilterRPC) 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 ErrIntOverflowWakuFilter - } - 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: FilterRPC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterRPC: 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 ErrIntOverflowWakuFilter - } - 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 ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - 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 Request", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Request == nil { - m.Request = &FilterRequest{} - } - if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Push", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuFilter - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuFilter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Push == nil { - m.Push = &MessagePush{} - } - if err := m.Push.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilter(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilter - } - 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 skipWakuFilter(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, ErrIntOverflowWakuFilter - } - 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, ErrIntOverflowWakuFilter - } - 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, ErrIntOverflowWakuFilter - } - 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, ErrInvalidLengthWakuFilter - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWakuFilter - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWakuFilter - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthWakuFilter = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWakuFilter = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWakuFilter = fmt.Errorf("proto: unexpected end of group") -) diff --git a/waku/v2/protocol/pb/waku_filter_v2.pb.go b/waku/v2/protocol/pb/waku_filter_v2.pb.go deleted file mode 100644 index 75a84c97..00000000 --- a/waku/v2/protocol/pb/waku_filter_v2.pb.go +++ /dev/null @@ -1,1025 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: waku_filter_v2.proto - -// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/ - -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 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 -) - -var FilterSubscribeRequest_FilterSubscribeType_name = map[int32]string{ - 0: "SUBSCRIBER_PING", - 1: "SUBSCRIBE", - 2: "UNSUBSCRIBE", - 3: "UNSUBSCRIBE_ALL", -} - -var FilterSubscribeRequest_FilterSubscribeType_value = map[string]int32{ - "SUBSCRIBER_PING": 0, - "SUBSCRIBE": 1, - "UNSUBSCRIBE": 2, - "UNSUBSCRIBE_ALL": 3, -} - -func (x FilterSubscribeRequest_FilterSubscribeType) String() string { - return proto.EnumName(FilterSubscribeRequest_FilterSubscribeType_name, int32(x)) -} - -func (FilterSubscribeRequest_FilterSubscribeType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_22975a4bb50808e9, []int{0, 0} -} - -// Protocol identifier: /vac/waku/filter-subscribe/2.0.0-beta1 -type FilterSubscribeRequest struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FilterSubscribeRequest) Reset() { *m = FilterSubscribeRequest{} } -func (m *FilterSubscribeRequest) String() string { return proto.CompactTextString(m) } -func (*FilterSubscribeRequest) ProtoMessage() {} -func (*FilterSubscribeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_22975a4bb50808e9, []int{0} -} -func (m *FilterSubscribeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FilterSubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FilterSubscribeRequest.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 *FilterSubscribeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_FilterSubscribeRequest.Merge(m, src) -} -func (m *FilterSubscribeRequest) XXX_Size() int { - return m.Size() -} -func (m *FilterSubscribeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_FilterSubscribeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_FilterSubscribeRequest proto.InternalMessageInfo - -func (m *FilterSubscribeRequest) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -func (m *FilterSubscribeRequest) GetFilterSubscribeType() FilterSubscribeRequest_FilterSubscribeType { - if m != nil { - return m.FilterSubscribeType - } - return FilterSubscribeRequest_SUBSCRIBER_PING -} - -func (m *FilterSubscribeRequest) GetPubsubTopic() string { - if m != nil { - return m.PubsubTopic - } - return "" -} - -func (m *FilterSubscribeRequest) GetContentTopics() []string { - if m != nil { - return m.ContentTopics - } - return nil -} - -type FilterSubscribeResponse struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FilterSubscribeResponse) Reset() { *m = FilterSubscribeResponse{} } -func (m *FilterSubscribeResponse) String() string { return proto.CompactTextString(m) } -func (*FilterSubscribeResponse) ProtoMessage() {} -func (*FilterSubscribeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_22975a4bb50808e9, []int{1} -} -func (m *FilterSubscribeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FilterSubscribeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FilterSubscribeResponse.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 *FilterSubscribeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_FilterSubscribeResponse.Merge(m, src) -} -func (m *FilterSubscribeResponse) XXX_Size() int { - return m.Size() -} -func (m *FilterSubscribeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_FilterSubscribeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_FilterSubscribeResponse proto.InternalMessageInfo - -func (m *FilterSubscribeResponse) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -func (m *FilterSubscribeResponse) GetStatusCode() uint32 { - if m != nil { - return m.StatusCode - } - return 0 -} - -func (m *FilterSubscribeResponse) GetStatusDesc() string { - if m != nil { - return m.StatusDesc - } - return "" -} - -// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1 -type MessagePushV2 struct { - WakuMessage *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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MessagePushV2) Reset() { *m = MessagePushV2{} } -func (m *MessagePushV2) String() string { return proto.CompactTextString(m) } -func (*MessagePushV2) ProtoMessage() {} -func (*MessagePushV2) Descriptor() ([]byte, []int) { - return fileDescriptor_22975a4bb50808e9, []int{2} -} -func (m *MessagePushV2) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MessagePushV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MessagePushV2.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 *MessagePushV2) XXX_Merge(src proto.Message) { - xxx_messageInfo_MessagePushV2.Merge(m, src) -} -func (m *MessagePushV2) XXX_Size() int { - return m.Size() -} -func (m *MessagePushV2) XXX_DiscardUnknown() { - xxx_messageInfo_MessagePushV2.DiscardUnknown(m) -} - -var xxx_messageInfo_MessagePushV2 proto.InternalMessageInfo - -func (m *MessagePushV2) GetWakuMessage() *WakuMessage { - if m != nil { - return m.WakuMessage - } - return nil -} - -func (m *MessagePushV2) GetPubsubTopic() string { - if m != nil { - return m.PubsubTopic - } - return "" -} - -func init() { - proto.RegisterEnum("pb.FilterSubscribeRequest_FilterSubscribeType", FilterSubscribeRequest_FilterSubscribeType_name, FilterSubscribeRequest_FilterSubscribeType_value) - proto.RegisterType((*FilterSubscribeRequest)(nil), "pb.FilterSubscribeRequest") - proto.RegisterType((*FilterSubscribeResponse)(nil), "pb.FilterSubscribeResponse") - proto.RegisterType((*MessagePushV2)(nil), "pb.MessagePushV2") -} - -func init() { proto.RegisterFile("waku_filter_v2.proto", fileDescriptor_22975a4bb50808e9) } - -var fileDescriptor_22975a4bb50808e9 = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xdd, 0x6e, 0xda, 0x30, - 0x14, 0x80, 0x49, 0x90, 0x26, 0xe5, 0x84, 0x40, 0x64, 0xf6, 0x13, 0x4d, 0x5a, 0xc6, 0x22, 0x4d, - 0xe2, 0x2a, 0x17, 0xd9, 0x13, 0x0c, 0xf6, 0x23, 0x24, 0x86, 0x90, 0x81, 0xed, 0xd2, 0x8a, 0x13, - 0xb3, 0x45, 0xac, 0xc4, 0x8d, 0xed, 0x22, 0xfa, 0x24, 0x7d, 0xa2, 0xaa, 0x97, 0x7d, 0x84, 0x8a, - 0xbe, 0x48, 0x85, 0x93, 0x16, 0xd4, 0x20, 0xf5, 0x2e, 0xf9, 0xfc, 0x9d, 0x73, 0x7c, 0xce, 0x31, - 0xbc, 0xde, 0xc4, 0x2b, 0x45, 0x96, 0xd9, 0x7f, 0xc9, 0x0a, 0x72, 0x11, 0x85, 0xbc, 0xc8, 0x65, - 0x8e, 0x4c, 0x4e, 0xdf, 0x23, 0x7d, 0x72, 0xc6, 0x84, 0x88, 0xff, 0xb2, 0x92, 0x07, 0xd7, 0x26, - 0xbc, 0xfd, 0xa1, 0xdd, 0x99, 0xa2, 0x22, 0x29, 0x32, 0xca, 0x30, 0x3b, 0x57, 0x4c, 0x48, 0xf4, - 0x01, 0xa0, 0x28, 0x3f, 0x49, 0x96, 0x7a, 0x46, 0xcf, 0xe8, 0x5b, 0xd8, 0xaa, 0xc8, 0x28, 0x45, - 0x14, 0xde, 0x54, 0x45, 0xc4, 0x63, 0x24, 0x91, 0x5b, 0xce, 0x3c, 0xb3, 0x67, 0xf4, 0xdb, 0x51, - 0x18, 0x72, 0x1a, 0x9e, 0xce, 0xfc, 0x1c, 0xcf, 0xb7, 0x9c, 0xe1, 0xee, 0xb2, 0x0e, 0xd1, 0x27, - 0x68, 0x71, 0x45, 0x85, 0xa2, 0x44, 0xe6, 0x3c, 0x4b, 0x3c, 0xd0, 0x97, 0xb0, 0x4b, 0x36, 0xdf, - 0x23, 0xf4, 0x19, 0xda, 0x49, 0xbe, 0x96, 0x6c, 0x2d, 0x4b, 0x47, 0x78, 0x76, 0xaf, 0xd9, 0xb7, - 0xb0, 0x53, 0x51, 0x6d, 0x89, 0x80, 0x40, 0xf7, 0x44, 0x55, 0xd4, 0x85, 0xce, 0x6c, 0x31, 0x98, - 0x0d, 0xf1, 0x68, 0xf0, 0x1d, 0x93, 0xe9, 0x68, 0xf2, 0xd3, 0x6d, 0x20, 0x07, 0xac, 0x27, 0xe8, - 0x1a, 0xa8, 0x03, 0xf6, 0x62, 0x72, 0x00, 0xe6, 0x3e, 0xe8, 0x08, 0x90, 0xaf, 0xe3, 0xb1, 0xdb, - 0x0c, 0x2e, 0xe1, 0x5d, 0xad, 0x5b, 0xc1, 0xf3, 0xb5, 0x60, 0x2f, 0x0d, 0xf2, 0x23, 0xd8, 0x42, - 0xc6, 0x52, 0x09, 0x92, 0xe4, 0x29, 0xd3, 0x3d, 0x3a, 0x18, 0x4a, 0x34, 0xcc, 0x53, 0x76, 0x24, - 0xa4, 0x4c, 0x24, 0x9e, 0xad, 0x13, 0x54, 0xc2, 0x37, 0x26, 0x92, 0x60, 0x09, 0xce, 0xaf, 0x72, - 0xab, 0x53, 0x25, 0xfe, 0xfd, 0x8e, 0x50, 0x04, 0xad, 0xe3, 0x5d, 0xeb, 0x9a, 0x76, 0xd4, 0xd9, - 0xaf, 0xe4, 0x4f, 0xbc, 0x52, 0x95, 0x8c, 0xed, 0xcd, 0xe1, 0xa7, 0x36, 0x6b, 0xb3, 0x36, 0xeb, - 0x81, 0x7b, 0xb3, 0xf3, 0x8d, 0xdb, 0x9d, 0x6f, 0xdc, 0xed, 0x7c, 0xe3, 0xea, 0xde, 0x6f, 0xd0, - 0x57, 0xfa, 0x15, 0x7d, 0x79, 0x08, 0x00, 0x00, 0xff, 0xff, 0xae, 0xd4, 0x6f, 0xea, 0x75, 0x02, - 0x00, 0x00, -} - -func (m *FilterSubscribeRequest) 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 *FilterSubscribeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FilterSubscribeRequest) 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.ContentTopics) > 0 { - for iNdEx := len(m.ContentTopics) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContentTopics[iNdEx]) - copy(dAtA[i:], m.ContentTopics[iNdEx]) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.ContentTopics[iNdEx]))) - i-- - dAtA[i] = 0x5a - } - } - if len(m.PubsubTopic) > 0 { - i -= len(m.PubsubTopic) - copy(dAtA[i:], m.PubsubTopic) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.PubsubTopic))) - i-- - dAtA[i] = 0x52 - } - if m.FilterSubscribeType != 0 { - i = encodeVarintWakuFilterV2(dAtA, i, uint64(m.FilterSubscribeType)) - i-- - dAtA[i] = 0x10 - } - if len(m.RequestId) > 0 { - i -= len(m.RequestId) - copy(dAtA[i:], m.RequestId) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.RequestId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FilterSubscribeResponse) 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 *FilterSubscribeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FilterSubscribeResponse) 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.StatusDesc) > 0 { - i -= len(m.StatusDesc) - copy(dAtA[i:], m.StatusDesc) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.StatusDesc))) - i-- - dAtA[i] = 0x5a - } - if m.StatusCode != 0 { - i = encodeVarintWakuFilterV2(dAtA, i, uint64(m.StatusCode)) - i-- - dAtA[i] = 0x50 - } - if len(m.RequestId) > 0 { - i -= len(m.RequestId) - copy(dAtA[i:], m.RequestId) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.RequestId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MessagePushV2) 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 *MessagePushV2) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MessagePushV2) 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.PubsubTopic) > 0 { - i -= len(m.PubsubTopic) - copy(dAtA[i:], m.PubsubTopic) - i = encodeVarintWakuFilterV2(dAtA, i, uint64(len(m.PubsubTopic))) - i-- - dAtA[i] = 0x12 - } - if m.WakuMessage != nil { - { - size, err := m.WakuMessage.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuFilterV2(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintWakuFilterV2(dAtA []byte, offset int, v uint64) int { - offset -= sovWakuFilterV2(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *FilterSubscribeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestId) - if l > 0 { - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - if m.FilterSubscribeType != 0 { - n += 1 + sovWakuFilterV2(uint64(m.FilterSubscribeType)) - } - l = len(m.PubsubTopic) - if l > 0 { - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - if len(m.ContentTopics) > 0 { - for _, s := range m.ContentTopics { - l = len(s) - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *FilterSubscribeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestId) - if l > 0 { - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - if m.StatusCode != 0 { - n += 1 + sovWakuFilterV2(uint64(m.StatusCode)) - } - l = len(m.StatusDesc) - if l > 0 { - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *MessagePushV2) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.WakuMessage != nil { - l = m.WakuMessage.Size() - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - l = len(m.PubsubTopic) - if l > 0 { - n += 1 + l + sovWakuFilterV2(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovWakuFilterV2(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWakuFilterV2(x uint64) (n int) { - return sovWakuFilterV2(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *FilterSubscribeRequest) 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 ErrIntOverflowWakuFilterV2 - } - 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: FilterSubscribeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterSubscribeRequest: 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 ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FilterSubscribeType", wireType) - } - m.FilterSubscribeType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilterV2 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FilterSubscribeType |= FilterSubscribeRequest_FilterSubscribeType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - 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 ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubsubTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentTopics", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentTopics = append(m.ContentTopics, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilterV2(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilterV2 - } - 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 *FilterSubscribeResponse) 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 ErrIntOverflowWakuFilterV2 - } - 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: FilterSubscribeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FilterSubscribeResponse: 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 ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusCode", wireType) - } - m.StatusCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilterV2 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StatusCode |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusDesc", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StatusDesc = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilterV2(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilterV2 - } - 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 *MessagePushV2) 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 ErrIntOverflowWakuFilterV2 - } - 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: MessagePushV2: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MessagePushV2: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WakuMessage", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuFilterV2 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.WakuMessage == nil { - m.WakuMessage = &WakuMessage{} - } - if err := m.WakuMessage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowWakuFilterV2 - } - 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 ErrInvalidLengthWakuFilterV2 - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuFilterV2 - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubsubTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuFilterV2(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuFilterV2 - } - 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 skipWakuFilterV2(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, ErrIntOverflowWakuFilterV2 - } - 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, ErrIntOverflowWakuFilterV2 - } - 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, ErrIntOverflowWakuFilterV2 - } - 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, ErrInvalidLengthWakuFilterV2 - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWakuFilterV2 - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWakuFilterV2 - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthWakuFilterV2 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWakuFilterV2 = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWakuFilterV2 = fmt.Errorf("proto: unexpected end of group") -) diff --git a/waku/v2/protocol/pb/waku_lightpush.pb.go b/waku/v2/protocol/pb/waku_lightpush.pb.go deleted file mode 100644 index 3068f1e5..00000000 --- a/waku/v2/protocol/pb/waku_lightpush.pb.go +++ /dev/null @@ -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") -) diff --git a/waku/v2/protocol/pb/waku_message.pb.go b/waku/v2/protocol/pb/waku_message.pb.go index aae4ce96..ec6d6a18 100644 --- a/waku/v2/protocol/pb/waku_message.pb.go +++ b/waku/v2/protocol/pb/waku_message.pb.go @@ -1,1067 +1,315 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.21.12 // source: waku_message.proto package pb import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// 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 +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 RateLimitProof struct { - Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` - MerkleRoot []byte `protobuf:"bytes,2,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` - Epoch []byte `protobuf:"bytes,3,opt,name=epoch,proto3" json:"epoch,omitempty"` - ShareX []byte `protobuf:"bytes,4,opt,name=share_x,json=shareX,proto3" json:"share_x,omitempty"` - ShareY []byte `protobuf:"bytes,5,opt,name=share_y,json=shareY,proto3" json:"share_y,omitempty"` - Nullifier []byte `protobuf:"bytes,6,opt,name=nullifier,proto3" json:"nullifier,omitempty"` - RlnIdentifier []byte `protobuf:"bytes,7,opt,name=rln_identifier,json=rlnIdentifier,proto3" json:"rln_identifier,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` + MerkleRoot []byte `protobuf:"bytes,2,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + Epoch []byte `protobuf:"bytes,3,opt,name=epoch,proto3" json:"epoch,omitempty"` + ShareX []byte `protobuf:"bytes,4,opt,name=share_x,json=shareX,proto3" json:"share_x,omitempty"` + ShareY []byte `protobuf:"bytes,5,opt,name=share_y,json=shareY,proto3" json:"share_y,omitempty"` + Nullifier []byte `protobuf:"bytes,6,opt,name=nullifier,proto3" json:"nullifier,omitempty"` + RlnIdentifier []byte `protobuf:"bytes,7,opt,name=rln_identifier,json=rlnIdentifier,proto3" json:"rln_identifier,omitempty"` } -func (m *RateLimitProof) Reset() { *m = RateLimitProof{} } -func (m *RateLimitProof) String() string { return proto.CompactTextString(m) } -func (*RateLimitProof) ProtoMessage() {} -func (*RateLimitProof) Descriptor() ([]byte, []int) { - return fileDescriptor_6f0a20862b3bf714, []int{0} +func (x *RateLimitProof) Reset() { + *x = RateLimitProof{} + if protoimpl.UnsafeEnabled { + mi := &file_waku_message_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RateLimitProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *RateLimitProof) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RateLimitProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RateLimitProof.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*RateLimitProof) ProtoMessage() {} + +func (x *RateLimitProof) ProtoReflect() protoreflect.Message { + mi := &file_waku_message_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *RateLimitProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_RateLimitProof.Merge(m, src) -} -func (m *RateLimitProof) XXX_Size() int { - return m.Size() -} -func (m *RateLimitProof) XXX_DiscardUnknown() { - xxx_messageInfo_RateLimitProof.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_RateLimitProof proto.InternalMessageInfo +// Deprecated: Use RateLimitProof.ProtoReflect.Descriptor instead. +func (*RateLimitProof) Descriptor() ([]byte, []int) { + return file_waku_message_proto_rawDescGZIP(), []int{0} +} -func (m *RateLimitProof) GetProof() []byte { - if m != nil { - return m.Proof +func (x *RateLimitProof) GetProof() []byte { + if x != nil { + return x.Proof } return nil } -func (m *RateLimitProof) GetMerkleRoot() []byte { - if m != nil { - return m.MerkleRoot +func (x *RateLimitProof) GetMerkleRoot() []byte { + if x != nil { + return x.MerkleRoot } return nil } -func (m *RateLimitProof) GetEpoch() []byte { - if m != nil { - return m.Epoch +func (x *RateLimitProof) GetEpoch() []byte { + if x != nil { + return x.Epoch } return nil } -func (m *RateLimitProof) GetShareX() []byte { - if m != nil { - return m.ShareX +func (x *RateLimitProof) GetShareX() []byte { + if x != nil { + return x.ShareX } return nil } -func (m *RateLimitProof) GetShareY() []byte { - if m != nil { - return m.ShareY +func (x *RateLimitProof) GetShareY() []byte { + if x != nil { + return x.ShareY } return nil } -func (m *RateLimitProof) GetNullifier() []byte { - if m != nil { - return m.Nullifier +func (x *RateLimitProof) GetNullifier() []byte { + if x != nil { + return x.Nullifier } return nil } -func (m *RateLimitProof) GetRlnIdentifier() []byte { - if m != nil { - return m.RlnIdentifier +func (x *RateLimitProof) GetRlnIdentifier() []byte { + if x != nil { + return x.RlnIdentifier } return nil } type WakuMessage struct { - Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` - ContentTopic string `protobuf:"bytes,2,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"` - Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - Timestamp int64 `protobuf:"zigzag64,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - RateLimitProof *RateLimitProof `protobuf:"bytes,21,opt,name=rate_limit_proof,json=rateLimitProof,proto3" json:"rate_limit_proof,omitempty"` - Ephemeral bool `protobuf:"varint,31,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + ContentTopic string `protobuf:"bytes,2,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"` + Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + Timestamp int64 `protobuf:"zigzag64,10,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + RateLimitProof *RateLimitProof `protobuf:"bytes,21,opt,name=rate_limit_proof,json=rateLimitProof,proto3" json:"rate_limit_proof,omitempty"` + Ephemeral bool `protobuf:"varint,31,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` } -func (m *WakuMessage) Reset() { *m = WakuMessage{} } -func (m *WakuMessage) String() string { return proto.CompactTextString(m) } -func (*WakuMessage) ProtoMessage() {} -func (*WakuMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_6f0a20862b3bf714, []int{1} -} -func (m *WakuMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WakuMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WakuMessage.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 (x *WakuMessage) Reset() { + *x = WakuMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_waku_message_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *WakuMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_WakuMessage.Merge(m, src) -} -func (m *WakuMessage) XXX_Size() int { - return m.Size() -} -func (m *WakuMessage) XXX_DiscardUnknown() { - xxx_messageInfo_WakuMessage.DiscardUnknown(m) + +func (x *WakuMessage) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_WakuMessage proto.InternalMessageInfo +func (*WakuMessage) ProtoMessage() {} -func (m *WakuMessage) GetPayload() []byte { - if m != nil { - return m.Payload +func (x *WakuMessage) ProtoReflect() protoreflect.Message { + mi := &file_waku_message_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 WakuMessage.ProtoReflect.Descriptor instead. +func (*WakuMessage) Descriptor() ([]byte, []int) { + return file_waku_message_proto_rawDescGZIP(), []int{1} +} + +func (x *WakuMessage) GetPayload() []byte { + if x != nil { + return x.Payload } return nil } -func (m *WakuMessage) GetContentTopic() string { - if m != nil { - return m.ContentTopic +func (x *WakuMessage) GetContentTopic() string { + if x != nil { + return x.ContentTopic } return "" } -func (m *WakuMessage) GetVersion() uint32 { - if m != nil { - return m.Version +func (x *WakuMessage) GetVersion() uint32 { + if x != nil { + return x.Version } return 0 } -func (m *WakuMessage) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *WakuMessage) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *WakuMessage) GetRateLimitProof() *RateLimitProof { - if m != nil { - return m.RateLimitProof +func (x *WakuMessage) GetRateLimitProof() *RateLimitProof { + if x != nil { + return x.RateLimitProof } return nil } -func (m *WakuMessage) GetEphemeral() bool { - if m != nil { - return m.Ephemeral +func (x *WakuMessage) GetEphemeral() bool { + if x != nil { + return x.Ephemeral } return false } -func init() { - proto.RegisterType((*RateLimitProof)(nil), "pb.RateLimitProof") - proto.RegisterType((*WakuMessage)(nil), "pb.WakuMessage") -} +var File_waku_message_proto protoreflect.FileDescriptor -func init() { proto.RegisterFile("waku_message.proto", fileDescriptor_6f0a20862b3bf714) } - -var fileDescriptor_6f0a20862b3bf714 = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xcf, 0x4a, 0x33, 0x31, - 0x14, 0xc5, 0xbf, 0xf4, 0xb3, 0xad, 0xbd, 0xfd, 0x43, 0x09, 0x8a, 0x59, 0x94, 0xe9, 0x50, 0x10, - 0x66, 0xd5, 0x85, 0x6e, 0x5d, 0xb9, 0x13, 0x14, 0x24, 0x08, 0xea, 0x6a, 0x48, 0xdb, 0x5b, 0x1b, - 0x9a, 0x49, 0x42, 0x26, 0x55, 0xfb, 0x26, 0x3e, 0x92, 0x4b, 0x17, 0xee, 0x95, 0xfa, 0x22, 0x32, - 0x19, 0xeb, 0xd8, 0x5d, 0xce, 0xef, 0xdc, 0x0b, 0x39, 0xe7, 0x02, 0x7d, 0x12, 0xcb, 0x55, 0x9a, - 0x61, 0x9e, 0x8b, 0x07, 0x1c, 0x5b, 0x67, 0xbc, 0xa1, 0x35, 0x3b, 0x19, 0xbd, 0x13, 0xe8, 0x71, - 0xe1, 0xf1, 0x52, 0x66, 0xd2, 0x5f, 0x3b, 0x63, 0xe6, 0xf4, 0x00, 0xea, 0xb6, 0x78, 0x30, 0x12, - 0x93, 0xa4, 0xc3, 0x4b, 0x41, 0x87, 0xd0, 0xce, 0xd0, 0x2d, 0x15, 0xa6, 0xce, 0x18, 0xcf, 0x6a, - 0xc1, 0x83, 0x12, 0x71, 0x63, 0x7c, 0xb1, 0x86, 0xd6, 0x4c, 0x17, 0xec, 0x7f, 0xb9, 0x16, 0x04, - 0x3d, 0x82, 0x66, 0xbe, 0x10, 0x0e, 0xd3, 0x67, 0xb6, 0x17, 0x78, 0x23, 0xc8, 0xbb, 0xca, 0x58, - 0xb3, 0xfa, 0x1f, 0xe3, 0x9e, 0x0e, 0xa0, 0xa5, 0x57, 0x4a, 0xc9, 0xb9, 0x44, 0xc7, 0x1a, 0xc1, - 0xaa, 0x00, 0x3d, 0x86, 0x9e, 0x53, 0x3a, 0x95, 0x33, 0xd4, 0xbe, 0x1c, 0x69, 0x86, 0x91, 0xae, - 0x53, 0xfa, 0xe2, 0x17, 0x8e, 0x3e, 0x08, 0xb4, 0x6f, 0xc5, 0x72, 0x75, 0x55, 0x06, 0xa6, 0x0c, - 0x9a, 0x56, 0xac, 0x95, 0x11, 0xb3, 0x9f, 0x54, 0x5b, 0x49, 0x47, 0xd0, 0x99, 0x1a, 0xed, 0x51, - 0xfb, 0x1b, 0x63, 0xe5, 0x34, 0x04, 0x6b, 0xf1, 0x1d, 0x56, 0x6c, 0x3f, 0xa2, 0xcb, 0xa5, 0xd1, - 0x21, 0x5c, 0x97, 0x6f, 0x65, 0xf1, 0x59, 0x2f, 0x33, 0xcc, 0xbd, 0xc8, 0x2c, 0x83, 0x98, 0x24, - 0x94, 0x57, 0x80, 0x9e, 0x41, 0xdf, 0x09, 0x8f, 0xa9, 0x2a, 0xca, 0x4d, 0xcb, 0x52, 0x0f, 0x63, - 0x92, 0xb4, 0x4f, 0xe8, 0xd8, 0x4e, 0xc6, 0xbb, 0xbd, 0xf3, 0x9e, 0xdb, 0xbd, 0xc3, 0x00, 0x5a, - 0x68, 0x17, 0x98, 0xa1, 0x13, 0x8a, 0x0d, 0x63, 0x92, 0xec, 0xf3, 0x0a, 0x9c, 0xf7, 0x5f, 0x37, - 0x11, 0x79, 0xdb, 0x44, 0xe4, 0x73, 0x13, 0x91, 0x97, 0xaf, 0xe8, 0xdf, 0xa4, 0x11, 0xae, 0x7a, - 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xc1, 0xf3, 0x87, 0xeb, 0x01, 0x00, 0x00, -} - -func (m *RateLimitProof) 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 *RateLimitProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RateLimitProof) 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.RlnIdentifier) > 0 { - i -= len(m.RlnIdentifier) - copy(dAtA[i:], m.RlnIdentifier) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.RlnIdentifier))) - i-- - dAtA[i] = 0x3a - } - if len(m.Nullifier) > 0 { - i -= len(m.Nullifier) - copy(dAtA[i:], m.Nullifier) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.Nullifier))) - i-- - dAtA[i] = 0x32 - } - if len(m.ShareY) > 0 { - i -= len(m.ShareY) - copy(dAtA[i:], m.ShareY) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.ShareY))) - i-- - dAtA[i] = 0x2a - } - if len(m.ShareX) > 0 { - i -= len(m.ShareX) - copy(dAtA[i:], m.ShareX) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.ShareX))) - i-- - dAtA[i] = 0x22 - } - if len(m.Epoch) > 0 { - i -= len(m.Epoch) - copy(dAtA[i:], m.Epoch) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.Epoch))) - i-- - dAtA[i] = 0x1a - } - if len(m.MerkleRoot) > 0 { - i -= len(m.MerkleRoot) - copy(dAtA[i:], m.MerkleRoot) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.MerkleRoot))) - i-- - dAtA[i] = 0x12 - } - if len(m.Proof) > 0 { - i -= len(m.Proof) - copy(dAtA[i:], m.Proof) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.Proof))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WakuMessage) 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 *WakuMessage) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WakuMessage) 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.Ephemeral { - i-- - if m.Ephemeral { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xf8 - } - if m.RateLimitProof != nil { - { - size, err := m.RateLimitProof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuMessage(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - if m.Timestamp != 0 { - i = encodeVarintWakuMessage(dAtA, i, uint64((uint64(m.Timestamp)<<1)^uint64((m.Timestamp>>63)))) - i-- - dAtA[i] = 0x50 - } - if m.Version != 0 { - i = encodeVarintWakuMessage(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x18 - } - if len(m.ContentTopic) > 0 { - i -= len(m.ContentTopic) - copy(dAtA[i:], m.ContentTopic) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.ContentTopic))) - i-- - dAtA[i] = 0x12 - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintWakuMessage(dAtA []byte, offset int, v uint64) int { - offset -= sovWakuMessage(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *RateLimitProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Proof) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.MerkleRoot) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.Epoch) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.ShareX) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.ShareY) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.Nullifier) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.RlnIdentifier) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *WakuMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - l = len(m.ContentTopic) - if l > 0 { - n += 1 + l + sovWakuMessage(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovWakuMessage(uint64(m.Version)) - } - if m.Timestamp != 0 { - n += 1 + sozWakuMessage(uint64(m.Timestamp)) - } - if m.RateLimitProof != nil { - l = m.RateLimitProof.Size() - n += 2 + l + sovWakuMessage(uint64(l)) - } - if m.Ephemeral { - n += 3 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovWakuMessage(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWakuMessage(x uint64) (n int) { - return sovWakuMessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RateLimitProof) 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 ErrIntOverflowWakuMessage - } - 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: RateLimitProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RateLimitProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) - if m.Proof == nil { - m.Proof = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MerkleRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MerkleRoot = append(m.MerkleRoot[:0], dAtA[iNdEx:postIndex]...) - if m.MerkleRoot == nil { - m.MerkleRoot = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Epoch = append(m.Epoch[:0], dAtA[iNdEx:postIndex]...) - if m.Epoch == nil { - m.Epoch = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShareX", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ShareX = append(m.ShareX[:0], dAtA[iNdEx:postIndex]...) - if m.ShareX == nil { - m.ShareX = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShareY", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ShareY = append(m.ShareY[:0], dAtA[iNdEx:postIndex]...) - if m.ShareY == nil { - m.ShareY = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nullifier", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Nullifier = append(m.Nullifier[:0], dAtA[iNdEx:postIndex]...) - if m.Nullifier == nil { - m.Nullifier = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RlnIdentifier", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RlnIdentifier = append(m.RlnIdentifier[:0], dAtA[iNdEx:postIndex]...) - if m.RlnIdentifier == nil { - m.RlnIdentifier = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuMessage - } - 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 *WakuMessage) 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 ErrIntOverflowWakuMessage - } - 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: WakuMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WakuMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentTopic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - 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 ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.Timestamp = int64(v) - case 21: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RateLimitProof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuMessage - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuMessage - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RateLimitProof == nil { - m.RateLimitProof = &RateLimitProof{} - } - if err := m.RateLimitProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 31: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ephemeral", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ephemeral = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipWakuMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuMessage - } - 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 skipWakuMessage(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, ErrIntOverflowWakuMessage - } - 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, ErrIntOverflowWakuMessage - } - 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, ErrIntOverflowWakuMessage - } - 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, ErrInvalidLengthWakuMessage - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWakuMessage - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWakuMessage - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF +var file_waku_message_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xd4, 0x01, 0x0a, 0x0e, 0x52, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x6f, + 0x66, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, + 0x6f, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x5f, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x58, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x79, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x59, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x75, + 0x6c, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x6e, + 0x75, 0x6c, 0x6c, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x6c, 0x6e, 0x5f, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0d, 0x72, 0x6c, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, + 0xdf, 0x01, 0x0a, 0x0b, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x12, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x3c, 0x0a, 0x10, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x52, 0x0e, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, + 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, + 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - ErrInvalidLengthWakuMessage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWakuMessage = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWakuMessage = fmt.Errorf("proto: unexpected end of group") + file_waku_message_proto_rawDescOnce sync.Once + file_waku_message_proto_rawDescData = file_waku_message_proto_rawDesc ) + +func file_waku_message_proto_rawDescGZIP() []byte { + file_waku_message_proto_rawDescOnce.Do(func() { + file_waku_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_message_proto_rawDescData) + }) + return file_waku_message_proto_rawDescData +} + +var file_waku_message_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_waku_message_proto_goTypes = []interface{}{ + (*RateLimitProof)(nil), // 0: pb.RateLimitProof + (*WakuMessage)(nil), // 1: pb.WakuMessage +} +var file_waku_message_proto_depIdxs = []int32{ + 0, // 0: pb.WakuMessage.rate_limit_proof:type_name -> pb.RateLimitProof + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_waku_message_proto_init() } +func file_waku_message_proto_init() { + if File_waku_message_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_waku_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RateLimitProof); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_waku_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WakuMessage); 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_message_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_waku_message_proto_goTypes, + DependencyIndexes: file_waku_message_proto_depIdxs, + MessageInfos: file_waku_message_proto_msgTypes, + }.Build() + File_waku_message_proto = out.File + file_waku_message_proto_rawDesc = nil + file_waku_message_proto_goTypes = nil + file_waku_message_proto_depIdxs = nil +} diff --git a/waku/v2/protocol/pb/waku_peer_exchange.pb.go b/waku/v2/protocol/pb/waku_peer_exchange.pb.go deleted file mode 100644 index 0dae3226..00000000 --- a/waku/v2/protocol/pb/waku_peer_exchange.pb.go +++ /dev/null @@ -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") -) diff --git a/waku/v2/protocol/pb/waku_store.pb.go b/waku/v2/protocol/pb/waku_store.pb.go deleted file mode 100644 index 43511dc3..00000000 --- a/waku/v2/protocol/pb/waku_store.pb.go +++ /dev/null @@ -1,1935 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: waku_store.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 PagingInfo_Direction int32 - -const ( - PagingInfo_BACKWARD PagingInfo_Direction = 0 - PagingInfo_FORWARD PagingInfo_Direction = 1 -) - -var PagingInfo_Direction_name = map[int32]string{ - 0: "BACKWARD", - 1: "FORWARD", -} - -var PagingInfo_Direction_value = map[string]int32{ - "BACKWARD": 0, - "FORWARD": 1, -} - -func (x PagingInfo_Direction) String() string { - return proto.EnumName(PagingInfo_Direction_name, int32(x)) -} - -func (PagingInfo_Direction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{1, 0} -} - -type HistoryResponse_Error int32 - -const ( - HistoryResponse_NONE HistoryResponse_Error = 0 - HistoryResponse_INVALID_CURSOR HistoryResponse_Error = 1 -) - -var HistoryResponse_Error_name = map[int32]string{ - 0: "NONE", - 1: "INVALID_CURSOR", -} - -var HistoryResponse_Error_value = map[string]int32{ - "NONE": 0, - "INVALID_CURSOR": 1, -} - -func (x HistoryResponse_Error) String() string { - return proto.EnumName(HistoryResponse_Error_name, int32(x)) -} - -func (HistoryResponse_Error) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{4, 0} -} - -type Index struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Index) Reset() { *m = Index{} } -func (m *Index) String() string { return proto.CompactTextString(m) } -func (*Index) ProtoMessage() {} -func (*Index) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{0} -} -func (m *Index) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Index.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 *Index) XXX_Merge(src proto.Message) { - xxx_messageInfo_Index.Merge(m, src) -} -func (m *Index) XXX_Size() int { - return m.Size() -} -func (m *Index) XXX_DiscardUnknown() { - xxx_messageInfo_Index.DiscardUnknown(m) -} - -var xxx_messageInfo_Index proto.InternalMessageInfo - -func (m *Index) GetDigest() []byte { - if m != nil { - return m.Digest - } - return nil -} - -func (m *Index) GetReceiverTime() int64 { - if m != nil { - return m.ReceiverTime - } - return 0 -} - -func (m *Index) GetSenderTime() int64 { - if m != nil { - return m.SenderTime - } - return 0 -} - -func (m *Index) GetPubsubTopic() string { - if m != nil { - return m.PubsubTopic - } - return "" -} - -type PagingInfo struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PagingInfo) Reset() { *m = PagingInfo{} } -func (m *PagingInfo) String() string { return proto.CompactTextString(m) } -func (*PagingInfo) ProtoMessage() {} -func (*PagingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{1} -} -func (m *PagingInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PagingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PagingInfo.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 *PagingInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_PagingInfo.Merge(m, src) -} -func (m *PagingInfo) XXX_Size() int { - return m.Size() -} -func (m *PagingInfo) XXX_DiscardUnknown() { - xxx_messageInfo_PagingInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_PagingInfo proto.InternalMessageInfo - -func (m *PagingInfo) GetPageSize() uint64 { - if m != nil { - return m.PageSize - } - return 0 -} - -func (m *PagingInfo) GetCursor() *Index { - if m != nil { - return m.Cursor - } - return nil -} - -func (m *PagingInfo) GetDirection() PagingInfo_Direction { - if m != nil { - return m.Direction - } - return PagingInfo_BACKWARD -} - -type ContentFilter struct { - ContentTopic string `protobuf:"bytes,1,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContentFilter) Reset() { *m = ContentFilter{} } -func (m *ContentFilter) String() string { return proto.CompactTextString(m) } -func (*ContentFilter) ProtoMessage() {} -func (*ContentFilter) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{2} -} -func (m *ContentFilter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ContentFilter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ContentFilter.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 *ContentFilter) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContentFilter.Merge(m, src) -} -func (m *ContentFilter) XXX_Size() int { - return m.Size() -} -func (m *ContentFilter) XXX_DiscardUnknown() { - xxx_messageInfo_ContentFilter.DiscardUnknown(m) -} - -var xxx_messageInfo_ContentFilter proto.InternalMessageInfo - -func (m *ContentFilter) GetContentTopic() string { - if m != nil { - return m.ContentTopic - } - return "" -} - -type HistoryQuery struct { - 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"` - StartTime int64 `protobuf:"zigzag64,5,opt,name=startTime,proto3" json:"startTime,omitempty"` - EndTime int64 `protobuf:"zigzag64,6,opt,name=endTime,proto3" json:"endTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistoryQuery) Reset() { *m = HistoryQuery{} } -func (m *HistoryQuery) String() string { return proto.CompactTextString(m) } -func (*HistoryQuery) ProtoMessage() {} -func (*HistoryQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{3} -} -func (m *HistoryQuery) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HistoryQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoryQuery.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 *HistoryQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoryQuery.Merge(m, src) -} -func (m *HistoryQuery) XXX_Size() int { - return m.Size() -} -func (m *HistoryQuery) XXX_DiscardUnknown() { - xxx_messageInfo_HistoryQuery.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoryQuery proto.InternalMessageInfo - -func (m *HistoryQuery) GetPubsubTopic() string { - if m != nil { - return m.PubsubTopic - } - return "" -} - -func (m *HistoryQuery) GetContentFilters() []*ContentFilter { - if m != nil { - return m.ContentFilters - } - return nil -} - -func (m *HistoryQuery) GetPagingInfo() *PagingInfo { - if m != nil { - return m.PagingInfo - } - return nil -} - -func (m *HistoryQuery) GetStartTime() int64 { - if m != nil { - return m.StartTime - } - return 0 -} - -func (m *HistoryQuery) GetEndTime() int64 { - if m != nil { - return m.EndTime - } - return 0 -} - -type HistoryResponse struct { - // the first field is reserved for future use - Messages []*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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistoryResponse) Reset() { *m = HistoryResponse{} } -func (m *HistoryResponse) String() string { return proto.CompactTextString(m) } -func (*HistoryResponse) ProtoMessage() {} -func (*HistoryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{4} -} -func (m *HistoryResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoryResponse.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 *HistoryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoryResponse.Merge(m, src) -} -func (m *HistoryResponse) XXX_Size() int { - return m.Size() -} -func (m *HistoryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HistoryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoryResponse proto.InternalMessageInfo - -func (m *HistoryResponse) GetMessages() []*WakuMessage { - if m != nil { - return m.Messages - } - return nil -} - -func (m *HistoryResponse) GetPagingInfo() *PagingInfo { - if m != nil { - return m.PagingInfo - } - return nil -} - -func (m *HistoryResponse) GetError() HistoryResponse_Error { - if m != nil { - return m.Error - } - return HistoryResponse_NONE -} - -type HistoryRPC struct { - 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"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HistoryRPC) Reset() { *m = HistoryRPC{} } -func (m *HistoryRPC) String() string { return proto.CompactTextString(m) } -func (*HistoryRPC) ProtoMessage() {} -func (*HistoryRPC) Descriptor() ([]byte, []int) { - return fileDescriptor_ca6891f77a46e680, []int{5} -} -func (m *HistoryRPC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HistoryRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoryRPC.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 *HistoryRPC) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoryRPC.Merge(m, src) -} -func (m *HistoryRPC) XXX_Size() int { - return m.Size() -} -func (m *HistoryRPC) XXX_DiscardUnknown() { - xxx_messageInfo_HistoryRPC.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoryRPC proto.InternalMessageInfo - -func (m *HistoryRPC) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -func (m *HistoryRPC) GetQuery() *HistoryQuery { - if m != nil { - return m.Query - } - return nil -} - -func (m *HistoryRPC) GetResponse() *HistoryResponse { - if m != nil { - return m.Response - } - return nil -} - -func init() { - proto.RegisterEnum("pb.PagingInfo_Direction", PagingInfo_Direction_name, PagingInfo_Direction_value) - proto.RegisterEnum("pb.HistoryResponse_Error", HistoryResponse_Error_name, HistoryResponse_Error_value) - proto.RegisterType((*Index)(nil), "pb.Index") - proto.RegisterType((*PagingInfo)(nil), "pb.PagingInfo") - proto.RegisterType((*ContentFilter)(nil), "pb.ContentFilter") - proto.RegisterType((*HistoryQuery)(nil), "pb.HistoryQuery") - proto.RegisterType((*HistoryResponse)(nil), "pb.HistoryResponse") - proto.RegisterType((*HistoryRPC)(nil), "pb.HistoryRPC") -} - -func init() { proto.RegisterFile("waku_store.proto", fileDescriptor_ca6891f77a46e680) } - -var fileDescriptor_ca6891f77a46e680 = []byte{ - // 543 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xdf, 0x6e, 0xd3, 0x4c, - 0x10, 0xc5, 0xbb, 0x49, 0x93, 0xc6, 0x93, 0x7c, 0xa9, 0xbf, 0x41, 0x42, 0xa6, 0x82, 0x28, 0x58, - 0xa2, 0x8a, 0x84, 0xe4, 0x4a, 0xa9, 0x84, 0xc4, 0x65, 0x9a, 0xb4, 0x22, 0x02, 0x92, 0xb2, 0x2d, - 0xf4, 0x32, 0x72, 0xec, 0x21, 0x5a, 0x95, 0xda, 0xee, 0xae, 0x0d, 0x94, 0x6b, 0x78, 0x07, 0xde, - 0x81, 0xf7, 0x40, 0x5c, 0x22, 0xf1, 0x02, 0x28, 0xbc, 0x08, 0xf2, 0x66, 0xf3, 0x17, 0x24, 0x2e, - 0xe7, 0xcc, 0x91, 0xe7, 0x77, 0x66, 0xd6, 0x60, 0xbf, 0xf3, 0x2f, 0xb3, 0x91, 0x4a, 0x63, 0x49, - 0x5e, 0x22, 0xe3, 0x34, 0xc6, 0x42, 0x32, 0xde, 0x43, 0xad, 0x5e, 0x91, 0x52, 0xfe, 0xc4, 0xe8, - 0xee, 0x27, 0x06, 0xa5, 0x7e, 0x14, 0xd2, 0x7b, 0xbc, 0x0d, 0xe5, 0x50, 0x4c, 0x48, 0xa5, 0x0e, - 0x6b, 0xb2, 0x56, 0x8d, 0x9b, 0x0a, 0x5d, 0xa8, 0x49, 0x0a, 0x48, 0xbc, 0x25, 0x79, 0x2e, 0xae, - 0xc8, 0x29, 0x34, 0x59, 0x0b, 0xf9, 0x9a, 0x86, 0x0d, 0x00, 0x45, 0x51, 0x68, 0x1c, 0x45, 0xed, - 0x58, 0x51, 0xb0, 0x09, 0xd5, 0x24, 0x1b, 0xab, 0x6c, 0x7c, 0x1e, 0x27, 0x22, 0x70, 0xb6, 0x9b, - 0xac, 0x65, 0xf1, 0x55, 0xc9, 0xfd, 0xc2, 0x00, 0x4e, 0xfd, 0x89, 0x88, 0x26, 0xfd, 0xe8, 0x75, - 0x8c, 0x7b, 0x50, 0x49, 0xfc, 0x09, 0x9d, 0x89, 0x0f, 0xa4, 0x71, 0xb6, 0xf9, 0xa2, 0xc6, 0xfb, - 0x50, 0x0e, 0x32, 0xa9, 0x62, 0xa9, 0x51, 0xaa, 0x6d, 0xcb, 0x4b, 0xc6, 0x9e, 0xce, 0xc0, 0x4d, - 0x03, 0x1f, 0x81, 0x15, 0x0a, 0x49, 0x41, 0x2a, 0xe2, 0x48, 0xe3, 0xd4, 0xdb, 0x4e, 0xee, 0x5a, - 0x4e, 0xf0, 0x7a, 0xf3, 0x3e, 0x5f, 0x5a, 0xdd, 0x7d, 0xb0, 0x16, 0x3a, 0xd6, 0xa0, 0x72, 0xd4, - 0xe9, 0x3e, 0xbd, 0xe8, 0xf0, 0x9e, 0xbd, 0x85, 0x55, 0xd8, 0x39, 0x19, 0x72, 0x5d, 0x30, 0xf7, - 0x10, 0xfe, 0xeb, 0xc6, 0x51, 0x4a, 0x51, 0x7a, 0x22, 0xde, 0xa4, 0x24, 0xf3, 0x25, 0x05, 0x33, - 0x61, 0x96, 0x90, 0xe9, 0x84, 0x6b, 0x9a, 0xfb, 0x83, 0x41, 0xed, 0x89, 0xc8, 0x8f, 0x72, 0xf3, - 0x22, 0x23, 0x79, 0xb3, 0xb9, 0x95, 0xc2, 0x1f, 0x5b, 0xc1, 0xc7, 0x50, 0x0f, 0x56, 0xe7, 0x28, - 0xa7, 0xd8, 0x2c, 0xb6, 0xaa, 0xed, 0xff, 0xf3, 0x30, 0x6b, 0x04, 0x7c, 0xc3, 0x88, 0x1e, 0x40, - 0xb2, 0x48, 0xab, 0x37, 0x5e, 0x6d, 0xd7, 0xd7, 0x77, 0xc0, 0x57, 0x1c, 0x78, 0x17, 0x2c, 0x95, - 0xfa, 0x32, 0xd5, 0x17, 0x2c, 0xe9, 0x0b, 0x2e, 0x05, 0x74, 0x60, 0x87, 0xa2, 0x50, 0xf7, 0xca, - 0xba, 0x37, 0x2f, 0xdd, 0xaf, 0x0c, 0x76, 0x4d, 0x2a, 0x4e, 0x2a, 0x89, 0x23, 0x45, 0xf8, 0x10, - 0x2a, 0xe6, 0x95, 0x29, 0xa7, 0xa0, 0x81, 0x77, 0xf3, 0xc9, 0x17, 0xfe, 0x65, 0xf6, 0x7c, 0xa6, - 0xf3, 0x85, 0x61, 0x03, 0xb4, 0xf8, 0x4f, 0xd0, 0x03, 0x28, 0x91, 0x94, 0xb1, 0xd4, 0x99, 0xea, - 0xed, 0x3b, 0xb9, 0x75, 0x03, 0xc0, 0x3b, 0xce, 0x0d, 0x7c, 0xe6, 0x73, 0x1f, 0x40, 0x49, 0xd7, - 0x58, 0x81, 0xed, 0xc1, 0x70, 0x70, 0x6c, 0x6f, 0x21, 0x42, 0xbd, 0x3f, 0x78, 0xd5, 0x79, 0xd6, - 0xef, 0x8d, 0xba, 0x2f, 0xf9, 0xd9, 0x90, 0xdb, 0xcc, 0xfd, 0xc8, 0x00, 0xe6, 0xdf, 0x39, 0xed, - 0xe2, 0x3d, 0x00, 0x49, 0xd7, 0x19, 0xa9, 0x74, 0x24, 0x42, 0x73, 0x4f, 0xcb, 0x28, 0xfd, 0x10, - 0xf7, 0xa1, 0x74, 0x9d, 0x1f, 0xd1, 0xbc, 0x41, 0x7b, 0x85, 0x42, 0x1f, 0x97, 0xcf, 0xda, 0x78, - 0x00, 0x15, 0x69, 0xa8, 0x4c, 0xb6, 0x5b, 0x7f, 0x01, 0xe6, 0x0b, 0xd3, 0x91, 0xfd, 0x6d, 0xda, - 0x60, 0xdf, 0xa7, 0x0d, 0xf6, 0x73, 0xda, 0x60, 0x9f, 0x7f, 0x35, 0xb6, 0xc6, 0x65, 0xfd, 0xa7, - 0x1e, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x33, 0xe0, 0xf4, 0x43, 0xd5, 0x03, 0x00, 0x00, -} - -func (m *Index) 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 *Index) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Index) 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.PubsubTopic) > 0 { - i -= len(m.PubsubTopic) - copy(dAtA[i:], m.PubsubTopic) - i = encodeVarintWakuStore(dAtA, i, uint64(len(m.PubsubTopic))) - i-- - dAtA[i] = 0x22 - } - if m.SenderTime != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.SenderTime)<<1)^uint64((m.SenderTime>>63)))) - i-- - dAtA[i] = 0x18 - } - if m.ReceiverTime != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.ReceiverTime)<<1)^uint64((m.ReceiverTime>>63)))) - i-- - dAtA[i] = 0x10 - } - if len(m.Digest) > 0 { - i -= len(m.Digest) - copy(dAtA[i:], m.Digest) - i = encodeVarintWakuStore(dAtA, i, uint64(len(m.Digest))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PagingInfo) 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 *PagingInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PagingInfo) 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.Direction != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64(m.Direction)) - i-- - dAtA[i] = 0x18 - } - if m.Cursor != nil { - { - size, err := m.Cursor.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PageSize != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64(m.PageSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ContentFilter) 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 *ContentFilter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContentFilter) 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.ContentTopic) > 0 { - i -= len(m.ContentTopic) - copy(dAtA[i:], m.ContentTopic) - i = encodeVarintWakuStore(dAtA, i, uint64(len(m.ContentTopic))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HistoryQuery) 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 *HistoryQuery) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoryQuery) 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.EndTime != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.EndTime)<<1)^uint64((m.EndTime>>63)))) - i-- - dAtA[i] = 0x30 - } - if m.StartTime != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64((uint64(m.StartTime)<<1)^uint64((m.StartTime>>63)))) - i-- - dAtA[i] = 0x28 - } - if m.PagingInfo != nil { - { - size, err := m.PagingInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.ContentFilters) > 0 { - for iNdEx := len(m.ContentFilters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContentFilters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.PubsubTopic) > 0 { - i -= len(m.PubsubTopic) - copy(dAtA[i:], m.PubsubTopic) - i = encodeVarintWakuStore(dAtA, i, uint64(len(m.PubsubTopic))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} - -func (m *HistoryResponse) 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 *HistoryResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoryResponse) 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.Error != 0 { - i = encodeVarintWakuStore(dAtA, i, uint64(m.Error)) - i-- - dAtA[i] = 0x20 - } - if m.PagingInfo != nil { - { - size, err := m.PagingInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - -func (m *HistoryRPC) 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 *HistoryRPC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoryRPC) 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 = encodeVarintWakuStore(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 = encodeVarintWakuStore(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.RequestId) > 0 { - i -= len(m.RequestId) - copy(dAtA[i:], m.RequestId) - i = encodeVarintWakuStore(dAtA, i, uint64(len(m.RequestId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintWakuStore(dAtA []byte, offset int, v uint64) int { - offset -= sovWakuStore(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Index) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Digest) - if l > 0 { - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.ReceiverTime != 0 { - n += 1 + sozWakuStore(uint64(m.ReceiverTime)) - } - if m.SenderTime != 0 { - n += 1 + sozWakuStore(uint64(m.SenderTime)) - } - l = len(m.PubsubTopic) - if l > 0 { - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PagingInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PageSize != 0 { - n += 1 + sovWakuStore(uint64(m.PageSize)) - } - if m.Cursor != nil { - l = m.Cursor.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.Direction != 0 { - n += 1 + sovWakuStore(uint64(m.Direction)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ContentFilter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContentTopic) - if l > 0 { - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HistoryQuery) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PubsubTopic) - if l > 0 { - n += 1 + l + sovWakuStore(uint64(l)) - } - if len(m.ContentFilters) > 0 { - for _, e := range m.ContentFilters { - l = e.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - } - if m.PagingInfo != nil { - l = m.PagingInfo.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.StartTime != 0 { - n += 1 + sozWakuStore(uint64(m.StartTime)) - } - if m.EndTime != 0 { - n += 1 + sozWakuStore(uint64(m.EndTime)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HistoryResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - } - if m.PagingInfo != nil { - l = m.PagingInfo.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.Error != 0 { - n += 1 + sovWakuStore(uint64(m.Error)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HistoryRPC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestId) - if l > 0 { - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.Query != nil { - l = m.Query.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.Response != nil { - l = m.Response.Size() - n += 1 + l + sovWakuStore(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovWakuStore(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWakuStore(x uint64) (n int) { - return sovWakuStore(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Index) 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 ErrIntOverflowWakuStore - } - 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: Index: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Index: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Digest = append(m.Digest[:0], dAtA[iNdEx:postIndex]...) - if m.Digest == nil { - m.Digest = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiverTime", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.ReceiverTime = int64(v) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SenderTime", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.SenderTime = int64(v) - case 4: - 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 ErrIntOverflowWakuStore - } - 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 ErrInvalidLengthWakuStore - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubsubTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 *PagingInfo) 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 ErrIntOverflowWakuStore - } - 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: PagingInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PagingInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageSize", wireType) - } - m.PageSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageSize |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cursor", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Cursor == nil { - m.Cursor = &Index{} - } - if err := m.Cursor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Direction", wireType) - } - m.Direction = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Direction |= PagingInfo_Direction(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 *ContentFilter) 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 ErrIntOverflowWakuStore - } - 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: ContentFilter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContentFilter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentTopic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - 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 ErrInvalidLengthWakuStore - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 *HistoryQuery) 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 ErrIntOverflowWakuStore - } - 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: HistoryQuery: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoryQuery: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - 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 ErrIntOverflowWakuStore - } - 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 ErrInvalidLengthWakuStore - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubsubTopic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContentFilters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContentFilters = append(m.ContentFilters, &ContentFilter{}) - if err := m.ContentFilters[len(m.ContentFilters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PagingInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PagingInfo == nil { - m.PagingInfo = &PagingInfo{} - } - if err := m.PagingInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.StartTime = int64(v) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) - m.EndTime = int64(v) - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 *HistoryResponse) 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 ErrIntOverflowWakuStore - } - 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: HistoryResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &WakuMessage{}) - if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PagingInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PagingInfo == nil { - m.PagingInfo = &PagingInfo{} - } - if err := m.PagingInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - m.Error = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Error |= HistoryResponse_Error(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 *HistoryRPC) 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 ErrIntOverflowWakuStore - } - 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: HistoryRPC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoryRPC: 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 ErrIntOverflowWakuStore - } - 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 ErrInvalidLengthWakuStore - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - 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 ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Query == nil { - m.Query = &HistoryQuery{} - } - 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 ErrIntOverflowWakuStore - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWakuStore - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWakuStore - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Response == nil { - m.Response = &HistoryResponse{} - } - if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWakuStore(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthWakuStore - } - 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 skipWakuStore(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, ErrIntOverflowWakuStore - } - 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, ErrIntOverflowWakuStore - } - 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, ErrIntOverflowWakuStore - } - 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, ErrInvalidLengthWakuStore - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWakuStore - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWakuStore - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthWakuStore = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWakuStore = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWakuStore = fmt.Errorf("proto: unexpected end of group") -) diff --git a/waku/v2/protocol/pb/waku_swap.pb.go b/waku/v2/protocol/pb/waku_swap.pb.go deleted file mode 100644 index d48b31f1..00000000 --- a/waku/v2/protocol/pb/waku_swap.pb.go +++ /dev/null @@ -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") -) diff --git a/waku/v2/protocol/peer_exchange/pb/generate.go b/waku/v2/protocol/peer_exchange/pb/generate.go new file mode 100644 index 00000000..60eab4a5 --- /dev/null +++ b/waku/v2/protocol/peer_exchange/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/peer_exchange/pb/waku_peer_exchange.pb.go b/waku/v2/protocol/peer_exchange/pb/waku_peer_exchange.pb.go new file mode 100644 index 00000000..ce37e0ab --- /dev/null +++ b/waku/v2/protocol/peer_exchange/pb/waku_peer_exchange.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_peer_exchange.proto b/waku/v2/protocol/peer_exchange/pb/waku_peer_exchange.proto similarity index 100% rename from waku/v2/protocol/pb/waku_peer_exchange.proto rename to waku/v2/protocol/peer_exchange/pb/waku_peer_exchange.proto diff --git a/waku/v2/protocol/peer_exchange/waku_peer_exchange.go b/waku/v2/protocol/peer_exchange/waku_peer_exchange.go index ef00fe5f..3d6230ad 100644 --- a/waku/v2/protocol/peer_exchange/waku_peer_exchange.go +++ b/waku/v2/protocol/peer_exchange/waku_peer_exchange.go @@ -19,12 +19,12 @@ import ( "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" 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/waku/v2/discv5" "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/pb" + "github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb" "github.com/waku-org/go-waku/waku/v2/utils" "go.uber.org/zap" ) @@ -146,7 +146,7 @@ func (wakuPX *WakuPeerExchange) onRequest(ctx context.Context) func(s network.St defer s.Close() logger := wakuPX.log.With(logging.HostID("peer", s.Conn().RemotePeer())) requestRPC := &pb.PeerExchangeRPC{} - reader := protoio.NewDelimitedReader(s, math.MaxInt32) + reader := pbio.NewDelimitedReader(s, math.MaxInt32) err := reader.ReadMsg(requestRPC) if err != nil { logger.Error("reading request", zap.Error(err)) @@ -229,7 +229,7 @@ func (wakuPX *WakuPeerExchange) sendPeerExchangeRPCToPeer(ctx context.Context, r } defer connOpt.Close() - writer := protoio.NewDelimitedWriter(connOpt) + writer := pbio.NewDelimitedWriter(connOpt) err = writer.WriteMsg(rpc) if err != nil { logger.Error("writing response", zap.Error(err)) diff --git a/waku/v2/protocol/relay/waku_relay.go b/waku/v2/protocol/relay/waku_relay.go index a29a6f89..149c87b9 100644 --- a/waku/v2/protocol/relay/waku_relay.go +++ b/waku/v2/protocol/relay/waku_relay.go @@ -8,12 +8,12 @@ import ( "fmt" "sync" - proto "github.com/golang/protobuf/proto" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/protocol" "go.opencensus.io/stats" "go.opencensus.io/tag" "go.uber.org/zap" + proto "google.golang.org/protobuf/proto" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" diff --git a/waku/v2/protocol/rln/waku_rln_relay.go b/waku/v2/protocol/rln/waku_rln_relay.go index cf160148..da724e69 100644 --- a/waku/v2/protocol/rln/waku_rln_relay.go +++ b/waku/v2/protocol/rln/waku_rln_relay.go @@ -12,7 +12,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" - proto "github.com/golang/protobuf/proto" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/peer" "github.com/waku-org/go-waku/waku/v2/protocol/pb" @@ -21,6 +20,7 @@ import ( "github.com/waku-org/go-waku/waku/v2/utils" r "github.com/waku-org/go-zerokit-rln/rln" "go.uber.org/zap" + proto "google.golang.org/protobuf/proto" ) // the maximum clock difference between peers in seconds diff --git a/waku/v2/protocol/store/pb/generate.go b/waku/v2/protocol/store/pb/generate.go new file mode 100644 index 00000000..1c793f9f --- /dev/null +++ b/waku/v2/protocol/store/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/store/pb/waku_store.pb.go b/waku/v2/protocol/store/pb/waku_store.pb.go new file mode 100644 index 00000000..5a4b1817 --- /dev/null +++ b/waku/v2/protocol/store/pb/waku_store.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_store.proto b/waku/v2/protocol/store/pb/waku_store.proto similarity index 100% rename from waku/v2/protocol/pb/waku_store.proto rename to waku/v2/protocol/store/pb/waku_store.proto diff --git a/waku/v2/protocol/store/waku_store_client.go b/waku/v2/protocol/store/waku_store_client.go index 6f63f459..61c01637 100644 --- a/waku/v2/protocol/store/waku_store_client.go +++ b/waku/v2/protocol/store/waku_store_client.go @@ -7,13 +7,14 @@ import ( "math" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-msgio/protoio" + "github.com/libp2p/go-msgio/pbio" "go.uber.org/zap" "github.com/waku-org/go-waku/logging" "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/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" ) @@ -27,7 +28,7 @@ type Query struct { // Result represents a valid response from a store node type Result struct { started bool - Messages []*pb.WakuMessage + Messages []*wpb.WakuMessage store Store query *pb.HistoryQuery cursor *pb.Index @@ -71,14 +72,14 @@ func (r *Result) Next(ctx context.Context) (bool, error) { return true, nil } -func (r *Result) GetMessages() []*pb.WakuMessage { +func (r *Result) GetMessages() []*wpb.WakuMessage { if !r.started { return nil } return r.Messages } -type criteriaFN = func(msg *pb.WakuMessage) (bool, error) +type criteriaFN = func(msg *wpb.WakuMessage) (bool, error) type HistoryRequestParameters struct { 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)} - writer := protoio.NewDelimitedWriter(connOpt) - reader := protoio.NewDelimitedReader(connOpt, math.MaxInt32) + writer := pbio.NewDelimitedWriter(connOpt) + reader := pbio.NewDelimitedReader(connOpt, math.MaxInt32) err = writer.WriteMsg(historyRequest) 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 -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 { 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{ store: store, started: true, - Messages: []*pb.WakuMessage{}, + Messages: []*wpb.WakuMessage{}, cursor: nil, query: r.query, peerId: r.PeerID(), diff --git a/waku/v2/protocol/store/waku_store_pagination_test.go b/waku/v2/protocol/store/waku_store_pagination_test.go index 0d53f4e8..73e54e46 100644 --- a/waku/v2/protocol/store/waku_store_pagination_test.go +++ b/waku/v2/protocol/store/waku_store_pagination_test.go @@ -6,12 +6,14 @@ import ( "github.com/stretchr/testify/require" "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" + 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" + "google.golang.org/protobuf/proto" ) func TestIndexComputation(t *testing.T) { - msg := &pb.WakuMessage{ + msg := &wpb.WakuMessage{ Payload: []byte{1, 2, 3}, Timestamp: utils.GetUnixEpoch(), } @@ -22,14 +24,14 @@ func TestIndexComputation(t *testing.T) { require.NotZero(t, idx.Digest) require.Len(t, idx.Digest, 32) - msg1 := &pb.WakuMessage{ + msg1 := &wpb.WakuMessage{ Payload: []byte{1, 2, 3}, Timestamp: 123, ContentTopic: "/waku/2/default-content/proto", } idx1 := protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), "test").Index() - msg2 := &pb.WakuMessage{ + msg2 := &wpb.WakuMessage{ Payload: []byte{1, 2, 3}, Timestamp: 123, ContentTopic: "/waku/2/default-content/proto", @@ -43,7 +45,7 @@ func createSampleList(s int) []*protocol.Envelope { var result []*protocol.Envelope for i := 0; i < s; i++ { msg := - &pb.WakuMessage{ + &wpb.WakuMessage{ Payload: []byte{byte(i)}, Timestamp: int64(i), } @@ -65,7 +67,8 @@ func TestForwardPagination(t *testing.T) { messages, newPagingInfo, err := findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db) require.NoError(t, err) 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) // 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) require.NoError(t, err) 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) // 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) require.NoError(t, err) 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) // test for an empty msgList @@ -96,7 +100,8 @@ func TestForwardPagination(t *testing.T) { messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db) require.NoError(t, err) 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) // 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) // 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} _, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db) require.ErrorIs(t, err, persistence.ErrInvalidCursor) @@ -145,7 +150,8 @@ func TestBackwardPagination(t *testing.T) { require.NoError(t, err) 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) // 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) require.NoError(t, err) 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) // 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) require.NoError(t, err) require.Len(t, messages, 10) - require.Equal(t, msgList[0].Message(), messages[0]) - require.Equal(t, msgList[9].Message(), messages[9]) + require.True(t, proto.Equal(msgList[0].Message(), messages[0])) + require.True(t, proto.Equal(msgList[9].Message(), messages[9])) require.Nil(t, newPagingInfo.Cursor) // test for an empty msgList @@ -179,7 +186,8 @@ func TestBackwardPagination(t *testing.T) { messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db) require.NoError(t, err) 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) // 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) // 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} _, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db) require.ErrorIs(t, err, persistence.ErrInvalidCursor) diff --git a/waku/v2/protocol/store/waku_store_persistence_test.go b/waku/v2/protocol/store/waku_store_persistence_test.go index 2d66312e..9fcb5eeb 100644 --- a/waku/v2/protocol/store/waku_store_persistence_test.go +++ b/waku/v2/protocol/store/waku_store_persistence_test.go @@ -8,6 +8,7 @@ import ( "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/utils" + "google.golang.org/protobuf/proto" ) func TestStorePersistence(t *testing.T) { @@ -39,7 +40,7 @@ func TestStorePersistence(t *testing.T) { allMsgs, err := db.GetAll() require.NoError(t, err) 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 err = s1.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), defaultPubSubTopic)) diff --git a/waku/v2/protocol/store/waku_store_protocol.go b/waku/v2/protocol/store/waku_store_protocol.go index 0b15fabf..b1e2d5e0 100644 --- a/waku/v2/protocol/store/waku_store_protocol.go +++ b/waku/v2/protocol/store/waku_store_protocol.go @@ -9,21 +9,22 @@ import ( "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-msgio/protoio" + "github.com/libp2p/go-msgio/pbio" "go.uber.org/zap" "github.com/waku-org/go-waku/logging" "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/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" ) // MaxTimeVariance is the maximum duration in the future allowed for a message timestamp 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 { query.PagingInfo = &pb.PagingInfo{ Direction: pb.PagingInfo_FORWARD, @@ -47,7 +48,7 @@ func findMessages(query *pb.HistoryQuery, msgProvider MessageProvider) ([]*pb.Wa return nil, &pb.PagingInfo{Cursor: nil}, nil } - resultMessages := make([]*pb.WakuMessage, len(queryResult)) + resultMessages := make([]*wpb.WakuMessage, len(queryResult)) for i := range queryResult { resultMessages[i] = queryResult[i].Message } @@ -86,7 +87,7 @@ type MessageProvider interface { type Store interface { Start(ctx context.Context) 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) Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error) 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())) historyRPCRequest := &pb.HistoryRPC{} - writer := protoio.NewDelimitedWriter(s) - reader := protoio.NewDelimitedReader(s, math.MaxInt32) + writer := pbio.NewDelimitedWriter(s) + reader := pbio.NewDelimitedReader(s, math.MaxInt32) err := reader.ReadMsg(historyRPCRequest) if err != nil { @@ -246,7 +247,7 @@ func (store *WakuStore) Stop() { 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 // 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() close(resultChan) - var messages []*pb.WakuMessage + var messages []*wpb.WakuMessage hasResults := false for result := range resultChan { hasResults = true diff --git a/waku/v2/protocol/store/waku_store_query_test.go b/waku/v2/protocol/store/waku_store_query_test.go index 690404c3..4342f2ab 100644 --- a/waku/v2/protocol/store/waku_store_query_test.go +++ b/waku/v2/protocol/store/waku_store_query_test.go @@ -6,7 +6,10 @@ import ( "github.com/stretchr/testify/require" "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/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/utils" ) @@ -31,7 +34,7 @@ func TestStoreQuery(t *testing.T) { }) 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) { @@ -62,9 +65,8 @@ func TestStoreQueryMultipleContentFilters(t *testing.T) { }) require.Len(t, response.Messages, 2) - require.Contains(t, response.Messages, msg1) - require.Contains(t, response.Messages, msg3) - require.NotContains(t, response.Messages, msg2) + require.True(t, proto.Equal(response.Messages[0], msg1)) + require.True(t, proto.Equal(response.Messages[1], msg3)) } func TestStoreQueryPubsubTopicFilter(t *testing.T) { @@ -96,7 +98,7 @@ func TestStoreQueryPubsubTopicFilter(t *testing.T) { }) 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) { @@ -142,9 +144,9 @@ func TestStoreQueryPubsubTopicAllMessages(t *testing.T) { }) require.Len(t, response.Messages, 3) - require.Contains(t, response.Messages, msg1) - require.Contains(t, response.Messages, msg2) - require.Contains(t, response.Messages, msg3) + require.True(t, proto.Equal(response.Messages[0], msg1)) + require.True(t, proto.Equal(response.Messages[1], msg2)) + require.True(t, proto.Equal(response.Messages[2], msg3)) } func TestStoreQueryForwardPagination(t *testing.T) { @@ -177,7 +179,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) { s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger()) for i := 0; i < 10; i++ { - msg := &pb.WakuMessage{ + msg := &wpb.WakuMessage{ Payload: []byte{byte(i)}, ContentTopic: topic1, Version: 0, @@ -203,7 +205,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) { func TestTemporalHistoryQueries(t *testing.T) { s := NewWakuStore(nil, nil, MemoryDB(t), timesource.NewDefaultClock(), utils.Logger()) - var messages []*pb.WakuMessage + var messages []*wpb.WakuMessage for i := 0; i < 10; i++ { contentTopic := "1" if i%2 == 0 { diff --git a/waku/v2/protocol/swap/pb/generate.go b/waku/v2/protocol/swap/pb/generate.go new file mode 100644 index 00000000..2b517b2c --- /dev/null +++ b/waku/v2/protocol/swap/pb/generate.go @@ -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 diff --git a/waku/v2/protocol/swap/pb/waku_swap.pb.go b/waku/v2/protocol/swap/pb/waku_swap.pb.go new file mode 100644 index 00000000..c7509906 --- /dev/null +++ b/waku/v2/protocol/swap/pb/waku_swap.pb.go @@ -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 +} diff --git a/waku/v2/protocol/pb/waku_swap.proto b/waku/v2/protocol/swap/pb/waku_swap.proto similarity index 100% rename from waku/v2/protocol/pb/waku_swap.proto rename to waku/v2/protocol/swap/pb/waku_swap.proto diff --git a/waku/v2/rpc/filter.go b/waku/v2/rpc/filter.go index dbebbbcd..7e573e28 100644 --- a/waku/v2/rpc/filter.go +++ b/waku/v2/rpc/filter.go @@ -8,7 +8,8 @@ import ( "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/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" ) @@ -16,7 +17,7 @@ type FilterService struct { node *node.WakuNode log *zap.Logger - messages map[string][]*pb.WakuMessage + messages map[string][]*wpb.WakuMessage cacheCapacity int messagesMutex sync.RWMutex @@ -24,8 +25,8 @@ type FilterService struct { } type FilterContentArgs struct { - Topic string `json:"topic,omitempty"` - ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"` + Topic string `json:"topic,omitempty"` + ContentFilters []*pb.FilterRequest_ContentFilter `json:"contentFilters,omitempty"` } type ContentTopicArgs struct { @@ -37,7 +38,7 @@ func NewFilterService(node *node.WakuNode, cacheCapacity int, log *zap.Logger) * node: node, log: log.Named("filter"), cacheCapacity: cacheCapacity, - messages: make(map[string][]*pb.WakuMessage), + messages: make(map[string][]*wpb.WakuMessage), } s.runner = newRunnerService(node.Broadcaster(), s.addEnvelope) return s @@ -91,7 +92,7 @@ func (f *FilterService) PostV1Subscription(req *http.Request, args *FilterConten return err } for _, contentFilter := range args.ContentFilters { - f.messages[contentFilter.ContentTopic] = make([]*pb.WakuMessage, 0) + f.messages[contentFilter.ContentTopic] = make([]*wpb.WakuMessage, 0) } *reply = true @@ -125,6 +126,6 @@ func (f *FilterService) GetV1Messages(req *http.Request, args *ContentTopicArgs, *reply = f.messages[args.ContentTopic] - f.messages[args.ContentTopic] = make([]*pb.WakuMessage, 0) + f.messages[args.ContentTopic] = make([]*wpb.WakuMessage, 0) return nil } diff --git a/waku/v2/rpc/filter_test.go b/waku/v2/rpc/filter_test.go index dc1d5077..84fceb2c 100644 --- a/waku/v2/rpc/filter_test.go +++ b/waku/v2/rpc/filter_test.go @@ -13,7 +13,8 @@ import ( 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/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/timesource" "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)) 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 err = d.PostV1Subscription( @@ -117,7 +118,7 @@ func TestFilterGetV1Messages(t *testing.T) { // Wait for the dial to complete 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( makeRequest(t), args, @@ -131,7 +132,7 @@ func TestFilterGetV1Messages(t *testing.T) { _, err = serviceA.node.Relay().PublishToTopic( context.Background(), - &pb.WakuMessage{ContentTopic: "ct"}, + &wpb.WakuMessage{ContentTopic: "ct"}, testTopic, ) require.NoError(t, err) diff --git a/waku/v2/rpc/store.go b/waku/v2/rpc/store.go index c2a29e6f..df0bb0ec 100644 --- a/waku/v2/rpc/store.go +++ b/waku/v2/rpc/store.go @@ -4,8 +4,9 @@ import ( "net/http" "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/pb" "go.uber.org/zap" ) @@ -33,7 +34,7 @@ type StoreMessagesArgs struct { } type StoreMessagesReply struct { - Messages []*pb.WakuMessage `json:"messages,omitempty"` + Messages []*wpb.WakuMessage `json:"messages,omitempty"` PagingInfo StorePagingOptions `json:"pagingInfo,omitempty"` Error string `json:"error,omitempty"` }