mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-07 08:23:06 +00:00
chore: use waku-org/waku-proto repository for protobuffer definitions (#828)
This commit is contained in:
parent
3226def4cf
commit
150ade6f33
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "libs/waku-rln-contract"]
|
||||
path = libs/waku-rln-contract
|
||||
url = https://github.com/waku-org/waku-rln-contract.git
|
||||
[submodule "waku/v2/protocol/waku-proto"]
|
||||
path = waku/v2/protocol/waku-proto
|
||||
url = git@github.com:waku-org/waku-proto.git
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/libp2p/go-libp2p/core/peer"
|
||||
"github.com/waku-org/go-waku/logging"
|
||||
"github.com/waku-org/go-waku/waku/v2/node"
|
||||
"github.com/waku-org/go-waku/waku/v2/peermanager"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||
@ -241,7 +242,7 @@ func (s *FilterService) unsubscribeGetMessage(result *filter.WakuFilterPushResul
|
||||
ind := 0
|
||||
for _, entry := range result.Errors() {
|
||||
if entry.Err != nil {
|
||||
s.log.Error("can't unsubscribe for ", zap.String("peer", entry.PeerID.String()), zap.Error(entry.Err))
|
||||
s.log.Error("can't unsubscribe", logging.HostID("peer", entry.PeerID), zap.Error(entry.Err))
|
||||
if ind != 0 {
|
||||
peerIds += ", "
|
||||
}
|
||||
|
||||
@ -387,7 +387,6 @@ func genMessage(pubsubTopic, contentTopic string) *protocol.Envelope {
|
||||
&pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: contentTopic,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
},
|
||||
0,
|
||||
|
||||
@ -49,7 +49,6 @@ func TestLightpushMessagev1(t *testing.T) {
|
||||
Message: &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "abc",
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
},
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import (
|
||||
"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/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func makeRelayService(t *testing.T, mux *chi.Mux) *RelayService {
|
||||
@ -38,7 +39,6 @@ func TestPostV1Message(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "abc",
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
msgJSONBytes, err := json.Marshal(msg)
|
||||
@ -70,16 +70,16 @@ func TestRelaySubscription(t *testing.T) {
|
||||
require.Equal(t, "true", rr.Body.String())
|
||||
|
||||
// Test max messages in subscription
|
||||
now := utils.GetUnixEpoch()
|
||||
now := *utils.GetUnixEpoch()
|
||||
_, err = r.node.Relay().Publish(context.Background(),
|
||||
tests.CreateWakuMessage("test", now+1), relay.WithPubSubTopic("test"))
|
||||
tests.CreateWakuMessage("test", proto.Int64(now+1)), relay.WithPubSubTopic("test"))
|
||||
require.NoError(t, err)
|
||||
_, err = r.node.Relay().Publish(context.Background(),
|
||||
tests.CreateWakuMessage("test", now+2), relay.WithPubSubTopic("test"))
|
||||
tests.CreateWakuMessage("test", proto.Int64(now+2)), relay.WithPubSubTopic("test"))
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = r.node.Relay().Publish(context.Background(),
|
||||
tests.CreateWakuMessage("test", now+3), relay.WithPubSubTopic("test"))
|
||||
tests.CreateWakuMessage("test", proto.Int64(now+3)), relay.WithPubSubTopic("test"))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Wait for the messages to be processed
|
||||
@ -130,7 +130,6 @@ func TestRelayGetV1Messages(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "test",
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
msgJsonBytes, err := json.Marshal(msg)
|
||||
@ -168,7 +167,6 @@ func TestPostAutoV1Message(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "/toychat/1/huilong/proto",
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
msgJSONBytes, err := json.Marshal(msg)
|
||||
@ -201,9 +199,9 @@ func TestRelayAutoSubUnsub(t *testing.T) {
|
||||
require.Equal(t, "true", rr.Body.String())
|
||||
|
||||
// Test publishing messages after subscription
|
||||
now := utils.GetUnixEpoch()
|
||||
now := *utils.GetUnixEpoch()
|
||||
_, err = r.node.Relay().Publish(context.Background(),
|
||||
tests.CreateWakuMessage(cTopic1, now+1))
|
||||
tests.CreateWakuMessage(cTopic1, proto.Int64(now+1)))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Wait for the messages to be processed
|
||||
@ -267,7 +265,6 @@ func TestRelayGetV1AutoMessages(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: cTopic1,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
msgJsonBytes, err := json.Marshal(msg)
|
||||
|
||||
@ -39,7 +39,7 @@ type HistoryCursor struct {
|
||||
type StoreWakuMessage struct {
|
||||
Payload []byte `json:"payload"`
|
||||
ContentTopic string `json:"content_topic"`
|
||||
Version int32 `json:"version"`
|
||||
Version uint32 `json:"version"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Meta []byte `json:"meta"`
|
||||
}
|
||||
@ -83,18 +83,20 @@ func getStoreParams(r *http.Request) (multiaddr.Multiaddr, *store.Query, []store
|
||||
|
||||
startTimeStr := r.URL.Query().Get("startTime")
|
||||
if startTimeStr != "" {
|
||||
query.StartTime, err = strconv.ParseInt(startTimeStr, 10, 64)
|
||||
startTime, err := strconv.ParseInt(startTimeStr, 10, 64)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
query.StartTime = &startTime
|
||||
}
|
||||
|
||||
endTimeStr := r.URL.Query().Get("endTime")
|
||||
if endTimeStr != "" {
|
||||
query.EndTime, err = strconv.ParseInt(endTimeStr, 10, 64)
|
||||
endTime, err := strconv.ParseInt(endTimeStr, 10, 64)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
query.EndTime = &endTime
|
||||
}
|
||||
|
||||
var cursor *pb.Index
|
||||
@ -178,8 +180,8 @@ func toStoreResponse(result *store.Result) StoreResponse {
|
||||
response.Messages = append(response.Messages, StoreWakuMessage{
|
||||
Payload: m.Payload,
|
||||
ContentTopic: m.ContentTopic,
|
||||
Version: int32(m.Version),
|
||||
Timestamp: m.Timestamp,
|
||||
Version: m.GetVersion(),
|
||||
Timestamp: m.GetTimestamp(),
|
||||
Meta: m.Meta,
|
||||
})
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ 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/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestGetMessages(t *testing.T) {
|
||||
@ -32,14 +33,14 @@ func TestGetMessages(t *testing.T) {
|
||||
topic1 := "1"
|
||||
pubsubTopic1 := "topic1"
|
||||
|
||||
now := utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, now+1)
|
||||
msg2 := tests.CreateWakuMessage(topic1, now+2)
|
||||
msg3 := tests.CreateWakuMessage(topic1, now+3)
|
||||
now := *utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, proto.Int64(now+1))
|
||||
msg2 := tests.CreateWakuMessage(topic1, proto.Int64(now+2))
|
||||
msg3 := tests.CreateWakuMessage(topic1, proto.Int64(now+3))
|
||||
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
|
||||
n1HostInfo, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", node1.Host().ID().Pretty()))
|
||||
n1Addr := node1.ListenAddresses()[0].Encapsulate(n1HostInfo)
|
||||
|
||||
@ -33,10 +33,12 @@ func TestV1Peers(t *testing.T) {
|
||||
port, err := tests.FindFreePort(t, "", 5)
|
||||
require.NoError(t, err)
|
||||
|
||||
broadcaster := relay.NewBroadcaster(10)
|
||||
require.NoError(t, broadcaster.Start(context.Background()))
|
||||
|
||||
host, err := tests.MakeHost(context.Background(), port, rand.Reader)
|
||||
require.NoError(t, err)
|
||||
bcast := relay.NewBroadcaster(10)
|
||||
relay := relay.NewWakuRelay(bcast, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
relay.SetHost(host)
|
||||
err = relay.Start(context.Background())
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -125,7 +125,13 @@ func (f *FilterService) GetV1Messages(req *http.Request, args *ContentTopicArgs,
|
||||
}
|
||||
|
||||
for i := range f.messages[args.ContentTopic] {
|
||||
*reply = append(*reply, ProtoToRPC(f.messages[args.ContentTopic][i]))
|
||||
msg := f.messages[args.ContentTopic][i]
|
||||
rpcMsg, err := ProtoToRPC(msg)
|
||||
if err != nil {
|
||||
f.log.Warn("could not include message in response", zap.Error(err))
|
||||
} else {
|
||||
*reply = append(*reply, rpcMsg)
|
||||
}
|
||||
}
|
||||
|
||||
f.messages[args.ContentTopic] = make([]*wpb.WakuMessage, 0)
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/waku-org/go-waku/cmd/waku/server"
|
||||
"github.com/waku-org/go-waku/logging"
|
||||
"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/relay"
|
||||
@ -69,7 +70,10 @@ func (r *RelayService) PostV1Message(req *http.Request, args *RelayMessageArgs,
|
||||
topic = args.Topic
|
||||
}
|
||||
|
||||
msg := args.Message.toProto()
|
||||
msg, err := args.Message.toProto()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = server.AppendRLNProof(r.node, msg); err != nil {
|
||||
return err
|
||||
@ -117,10 +121,9 @@ func (r *RelayService) DeleteV1AutoSubscription(req *http.Request, args *TopicsA
|
||||
|
||||
// PostV1AutoMessage is invoked when the json rpc request uses the post_waku_v2_relay_v1_auto_message
|
||||
func (r *RelayService) PostV1AutoMessage(req *http.Request, args *RelayAutoMessageArgs, reply *SuccessReply) error {
|
||||
var err error
|
||||
msg := args.Message.toProto()
|
||||
if msg == nil {
|
||||
err := fmt.Errorf("invalid message format received")
|
||||
msg, err := args.Message.toProto()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("invalid message format received: %w", err)
|
||||
r.log.Error("publishing message", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
@ -148,7 +151,12 @@ func (r *RelayService) GetV1AutoMessages(req *http.Request, args *TopicArgs, rep
|
||||
}
|
||||
select {
|
||||
case msg := <-sub.Ch:
|
||||
*reply = append(*reply, ProtoToRPC(msg.Message()))
|
||||
rpcMsg, err := ProtoToRPC(msg.Message())
|
||||
if err != nil {
|
||||
r.log.Warn("could not include message in response", logging.HexString("hash", msg.Hash()), zap.Error(err))
|
||||
} else {
|
||||
*reply = append(*reply, rpcMsg)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -200,7 +208,10 @@ func (r *RelayService) GetV1Messages(req *http.Request, args *TopicArgs, reply *
|
||||
}
|
||||
select {
|
||||
case msg := <-sub.Ch:
|
||||
*reply = append(*reply, ProtoToRPC(msg.Message()))
|
||||
m, err := ProtoToRPC(msg.Message())
|
||||
if err == nil {
|
||||
*reply = append(*reply, m)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@ -31,14 +31,16 @@ func TestPostV1Message(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "abc",
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
|
||||
err := d.PostV1Message(
|
||||
rpcWakuMsg, err := ProtoToRPC(msg)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = d.PostV1Message(
|
||||
makeRequest(t),
|
||||
&RelayMessageArgs{
|
||||
Message: ProtoToRPC(msg),
|
||||
Message: rpcWakuMsg,
|
||||
},
|
||||
&reply,
|
||||
)
|
||||
@ -95,6 +97,17 @@ func TestRelayGetV1Messages(t *testing.T) {
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
args := &TopicsArgs{Topics: []string{"test"}}
|
||||
|
||||
// Subscribe A to topic
|
||||
err = serviceA.PostV1Subscription(
|
||||
makeRequest(t),
|
||||
args,
|
||||
&reply,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
require.True(t, reply)
|
||||
|
||||
// Subscribe B to topic
|
||||
err = serviceB.PostV1Subscription(
|
||||
makeRequest(t),
|
||||
args,
|
||||
@ -106,14 +119,17 @@ func TestRelayGetV1Messages(t *testing.T) {
|
||||
// Wait for the subscription to be started
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
rpcWakuMsg, err := ProtoToRPC(&pb.WakuMessage{
|
||||
Payload: []byte("test"),
|
||||
ContentTopic: "test",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
err = serviceA.PostV1Message(
|
||||
makeRequest(t),
|
||||
&RelayMessageArgs{
|
||||
Topic: "test",
|
||||
Message: ProtoToRPC(&pb.WakuMessage{
|
||||
Payload: []byte("test"),
|
||||
ContentTopic: "testContentTopic",
|
||||
}),
|
||||
Topic: "test",
|
||||
Message: rpcWakuMsg,
|
||||
},
|
||||
&reply,
|
||||
)
|
||||
|
||||
@ -27,8 +27,8 @@ type StorePagingOptions struct {
|
||||
type StoreMessagesArgs struct {
|
||||
Topic string `json:"pubsubTopic,omitempty"`
|
||||
ContentFilters []string `json:"contentFilters,omitempty"`
|
||||
StartTime int64 `json:"startTime,omitempty"`
|
||||
EndTime int64 `json:"endTime,omitempty"`
|
||||
StartTime *int64 `json:"startTime,omitempty"`
|
||||
EndTime *int64 `json:"endTime,omitempty"`
|
||||
PagingOptions StorePagingOptions `json:"pagingOptions,omitempty"`
|
||||
}
|
||||
|
||||
@ -63,7 +63,11 @@ func (s *StoreService) GetV1Messages(req *http.Request, args *StoreMessagesArgs,
|
||||
|
||||
reply.Messages = make([]*RPCWakuMessage, len(res.Messages))
|
||||
for i := range res.Messages {
|
||||
reply.Messages[i] = ProtoToRPC(res.Messages[i])
|
||||
msg, err := ProtoToRPC(res.Messages[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reply.Messages[i] = msg
|
||||
}
|
||||
|
||||
reply.PagingInfo = StorePagingOptions{
|
||||
|
||||
@ -20,9 +20,11 @@ func makeRequest(t *testing.T) *http.Request {
|
||||
func TestBase64Encoding(t *testing.T) {
|
||||
input := "Hello World"
|
||||
|
||||
rpcMsg := ProtoToRPC(&pb.WakuMessage{
|
||||
Payload: []byte(input),
|
||||
rpcMsg, err := ProtoToRPC(&pb.WakuMessage{
|
||||
Payload: []byte(input),
|
||||
ContentTopic: "test",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
jsonBytes, err := json.Marshal(rpcMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
rlnpb "github.com/waku-org/go-waku/waku/v2/protocol/rln/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type RateLimitProof struct {
|
||||
@ -23,49 +28,59 @@ type RPCWakuMessage struct {
|
||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||
}
|
||||
|
||||
func ProtoToRPC(input *pb.WakuMessage) *RPCWakuMessage {
|
||||
func ProtoToRPC(input *pb.WakuMessage) (*RPCWakuMessage, error) {
|
||||
if input == nil {
|
||||
return nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if err := input.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rpcWakuMsg := &RPCWakuMessage{
|
||||
Payload: input.Payload,
|
||||
ContentTopic: input.ContentTopic,
|
||||
Version: input.Version,
|
||||
Timestamp: input.Timestamp,
|
||||
Ephemeral: input.Ephemeral,
|
||||
Version: input.GetVersion(),
|
||||
Timestamp: input.GetTimestamp(),
|
||||
Ephemeral: input.GetEphemeral(),
|
||||
}
|
||||
|
||||
if input.RateLimitProof != nil {
|
||||
rateLimitProof := &rlnpb.RateLimitProof{}
|
||||
err := proto.Unmarshal(input.RateLimitProof, rateLimitProof)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rpcWakuMsg.RateLimitProof = &RateLimitProof{
|
||||
Proof: input.RateLimitProof.Proof,
|
||||
MerkleRoot: input.RateLimitProof.MerkleRoot,
|
||||
Epoch: input.RateLimitProof.Epoch,
|
||||
ShareX: input.RateLimitProof.ShareX,
|
||||
ShareY: input.RateLimitProof.ShareY,
|
||||
Nullifier: input.RateLimitProof.Nullifier,
|
||||
RlnIdentifier: input.RateLimitProof.RlnIdentifier,
|
||||
Proof: rateLimitProof.Proof,
|
||||
MerkleRoot: rateLimitProof.MerkleRoot,
|
||||
Epoch: rateLimitProof.Epoch,
|
||||
ShareX: rateLimitProof.ShareX,
|
||||
ShareY: rateLimitProof.ShareY,
|
||||
Nullifier: rateLimitProof.Nullifier,
|
||||
RlnIdentifier: rateLimitProof.RlnIdentifier,
|
||||
}
|
||||
}
|
||||
|
||||
return rpcWakuMsg
|
||||
return rpcWakuMsg, nil
|
||||
}
|
||||
|
||||
func (r *RPCWakuMessage) toProto() *pb.WakuMessage {
|
||||
func (r *RPCWakuMessage) toProto() (*pb.WakuMessage, error) {
|
||||
if r == nil {
|
||||
return nil
|
||||
return nil, errors.New("wakumessage is missing")
|
||||
}
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: r.Payload,
|
||||
ContentTopic: r.ContentTopic,
|
||||
Version: r.Version,
|
||||
Timestamp: r.Timestamp,
|
||||
Ephemeral: r.Ephemeral,
|
||||
Version: proto.Uint32(r.Version),
|
||||
Timestamp: proto.Int64(r.Timestamp),
|
||||
Ephemeral: proto.Bool(r.Ephemeral),
|
||||
}
|
||||
|
||||
if r.RateLimitProof != nil {
|
||||
msg.RateLimitProof = &pb.RateLimitProof{
|
||||
rateLimitProof := &rlnpb.RateLimitProof{
|
||||
Proof: r.RateLimitProof.Proof,
|
||||
MerkleRoot: r.RateLimitProof.MerkleRoot,
|
||||
Epoch: r.RateLimitProof.Epoch,
|
||||
@ -74,7 +89,14 @@ func (r *RPCWakuMessage) toProto() *pb.WakuMessage {
|
||||
Nullifier: r.RateLimitProof.Nullifier,
|
||||
RlnIdentifier: r.RateLimitProof.RlnIdentifier,
|
||||
}
|
||||
|
||||
b, err := proto.Marshal(rateLimitProof)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
msg.RateLimitProof = b
|
||||
}
|
||||
|
||||
return msg
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var log = utils.Logger().Named("basic2")
|
||||
@ -84,7 +85,6 @@ func randomHex(n int) (string, error) {
|
||||
|
||||
func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, msgContent string) {
|
||||
var version uint32 = 0
|
||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
||||
|
||||
p := new(payload.Payload)
|
||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||
@ -98,9 +98,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, ms
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
Version: proto.Uint32(version),
|
||||
ContentTopic: contentTopic,
|
||||
Timestamp: timestamp,
|
||||
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||
}
|
||||
|
||||
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
||||
|
||||
@ -20,9 +20,9 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
|
||||
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||
wrln "github.com/waku-org/go-waku/waku/v2/protocol/rln"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"github.com/waku-org/go-zerokit-rln/rln"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@ -302,7 +302,7 @@ func (c *Chat) publish(ctx context.Context, message string) error {
|
||||
|
||||
wakuMsg := &wpb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
Version: proto.Uint32(version),
|
||||
ContentTopic: options.ContentTopic,
|
||||
Timestamp: timestamp,
|
||||
}
|
||||
@ -315,7 +315,12 @@ func (c *Chat) publish(ctx context.Context, message string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
c.ui.InfoMessage(fmt.Sprintf("RLN Epoch: %d", rln.BytesToEpoch(wakuMsg.RateLimitProof.Epoch).Uint64()))
|
||||
rateLimitProof, err := wrln.BytesToRateLimitProof(wakuMsg.RateLimitProof)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.ui.InfoMessage(fmt.Sprintf("RLN Epoch: %d", rateLimitProof.Epoch.Uint64()))
|
||||
}
|
||||
|
||||
if c.options.LightPush.Enable {
|
||||
@ -402,7 +407,7 @@ func (c *Chat) retrieveHistory(connectionWg *sync.WaitGroup) {
|
||||
c.ui.InfoMessage("0 historic messages available")
|
||||
} else {
|
||||
for _, msg := range response.Messages {
|
||||
c.C <- protocol.NewEnvelope(msg, msg.Timestamp, relay.DefaultWakuTopic)
|
||||
c.C <- protocol.NewEnvelope(msg, msg.GetTimestamp(), relay.DefaultWakuTopic)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import (
|
||||
"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/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var log = logging.Logger("filter2")
|
||||
@ -144,7 +145,6 @@ func randomHex(n int) (string, error) {
|
||||
|
||||
func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||
var version uint32 = 0
|
||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
||||
|
||||
p := new(payload.Payload)
|
||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||
@ -154,9 +154,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
Version: proto.Uint32(version),
|
||||
ContentTopic: contentTopic,
|
||||
Timestamp: timestamp,
|
||||
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||
}
|
||||
|
||||
_, err := wakuNode.Relay().Publish(ctx, msg, relay.WithPubSubTopic(pubSubTopic.String()))
|
||||
|
||||
@ -186,7 +186,7 @@ func writeLoop(ctx context.Context, wakuNode *node.WakuNode, pairingObj *noise.P
|
||||
continue
|
||||
}
|
||||
|
||||
msg.Timestamp = wakuNode.Timesource().Now().UnixNano()
|
||||
msg.Timestamp = utils.GetUnixEpoch(wakuNode.Timesource())
|
||||
|
||||
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
||||
if err != nil {
|
||||
|
||||
@ -20,6 +20,7 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var log = utils.Logger().Named("rln")
|
||||
@ -105,7 +106,6 @@ func randomHex(n int) (string, error) {
|
||||
|
||||
func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||
var version uint32 = 0
|
||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
||||
|
||||
p := new(payload.Payload)
|
||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||
@ -119,9 +119,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
Version: proto.Uint32(version),
|
||||
ContentTopic: contentTopic.String(),
|
||||
Timestamp: timestamp,
|
||||
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||
}
|
||||
|
||||
err = wakuNode.RLNRelay().AppendRLNProof(msg, wakuNode.Timesource().Now())
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/payload"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func wakuMessage(messageJSON string) (*pb.WakuMessage, error) {
|
||||
@ -26,7 +27,7 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload := payload.Payload{
|
||||
msgPayload := payload.Payload{
|
||||
Data: msg.Payload,
|
||||
Key: &payload.KeyInfo{
|
||||
Kind: payload.Symmetric,
|
||||
@ -38,7 +39,7 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload.Key.SymKey = keyBytes
|
||||
msgPayload.Key.SymKey = keyBytes
|
||||
|
||||
if optionalSigningKey != "" {
|
||||
signingKeyBytes, err := utils.DecodeHexString(optionalSigningKey)
|
||||
@ -46,14 +47,14 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||
msgPayload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
msg.Version = 1
|
||||
msg.Payload, err = payload.Encode(1)
|
||||
msg.Version = proto.Uint32(payload.V1Encryption)
|
||||
msg.Payload, err = msgPayload.Encode(1)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -72,7 +73,7 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload := payload.Payload{
|
||||
msgPayload := payload.Payload{
|
||||
Data: msg.Payload,
|
||||
Key: &payload.KeyInfo{
|
||||
Kind: payload.Asymmetric,
|
||||
@ -84,7 +85,7 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload.Key.PubKey, err = unmarshalPubkey(keyBytes)
|
||||
msgPayload.Key.PubKey, err = unmarshalPubkey(keyBytes)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -95,14 +96,14 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
||||
return "", err
|
||||
}
|
||||
|
||||
payload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||
msgPayload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
msg.Version = 1
|
||||
msg.Payload, err = payload.Encode(1)
|
||||
msg.Version = proto.Uint32(payload.V1Encryption)
|
||||
msg.Payload, err = msgPayload.Encode(payload.V1Encryption)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -148,11 +149,11 @@ func DecodeSymmetric(messageJSON string, symmetricKey string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if msg.Version == 0 {
|
||||
if msg.GetVersion() == payload.Unencrypted {
|
||||
return marshalJSON(v0Response{
|
||||
Data: msg.Payload,
|
||||
})
|
||||
} else if msg.Version > 1 {
|
||||
} else if msg.GetVersion() != payload.V1Encryption {
|
||||
return "", errors.New("unsupported wakumessage version")
|
||||
}
|
||||
|
||||
@ -190,11 +191,11 @@ func DecodeAsymmetric(messageJSON string, privateKey string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if msg.Version == 0 {
|
||||
if msg.GetVersion() == payload.Unencrypted {
|
||||
return marshalJSON(v0Response{
|
||||
Data: msg.Payload,
|
||||
})
|
||||
} else if msg.Version > 1 {
|
||||
} else if msg.GetVersion() != payload.V1Encryption {
|
||||
return "", errors.New("unsupported wakumessage version")
|
||||
}
|
||||
|
||||
|
||||
@ -22,11 +22,11 @@ type storePagingOptions struct {
|
||||
}
|
||||
|
||||
type storeMessagesArgs struct {
|
||||
Topic string `json:"pubsubTopic,omitempty"`
|
||||
ContentTopics []string `json:"contentTopics,omitempty"`
|
||||
StartTime int64 `json:"startTime,omitempty"`
|
||||
EndTime int64 `json:"endTime,omitempty"`
|
||||
PagingOptions storePagingOptions `json:"pagingOptions,omitempty"`
|
||||
Topic string `json:"pubsubTopic,omitempty"`
|
||||
ContentTopics []string `json:"contentTopics,omitempty"`
|
||||
StartTime *int64 `json:"startTime,omitempty"`
|
||||
EndTime *int64 `json:"endTime,omitempty"`
|
||||
PagingOptions *storePagingOptions `json:"pagingOptions,omitempty"`
|
||||
}
|
||||
|
||||
type storeMessagesReply struct {
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/waku-org/go-waku/waku/v2/node"
|
||||
"github.com/waku-org/go-waku/waku/v2/payload"
|
||||
@ -67,7 +68,7 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) erro
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
Version: version,
|
||||
Version: proto.Uint32(version),
|
||||
ContentTopic: contentTopic,
|
||||
Timestamp: timestamp,
|
||||
}
|
||||
|
||||
@ -131,14 +131,14 @@ func MakeHost(ctx context.Context, port int, randomness io.Reader) (host.Host, e
|
||||
}
|
||||
|
||||
// CreateWakuMessage creates a WakuMessage protobuffer with default values and a custom contenttopic and timestamp
|
||||
func CreateWakuMessage(contentTopic string, timestamp int64, optionalPayload ...string) *pb.WakuMessage {
|
||||
func CreateWakuMessage(contentTopic string, timestamp *int64, optionalPayload ...string) *pb.WakuMessage {
|
||||
var payload []byte
|
||||
if len(optionalPayload) > 0 {
|
||||
payload = []byte(optionalPayload[0])
|
||||
} else {
|
||||
payload = []byte{1, 2, 3}
|
||||
}
|
||||
return &pb.WakuMessage{Payload: payload, ContentTopic: contentTopic, Version: 0, Timestamp: timestamp}
|
||||
return &pb.WakuMessage{Payload: payload, ContentTopic: contentTopic, Timestamp: timestamp}
|
||||
}
|
||||
|
||||
// RandomHex returns a random hex string of n bytes
|
||||
|
||||
@ -92,7 +92,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -112,7 +112,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 452, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -132,7 +132,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -152,7 +152,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -172,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x4b, 0xc0, 0x7d, 0x4f, 0xac, 0xc4, 0x75, 0x59, 0xcc, 0xfc, 0x1a, 0x6c, 0x18, 0x81, 0x29, 0x24, 0x33, 0x3, 0x10, 0x39, 0xd0, 0x67, 0x28, 0xa0, 0xe0, 0xfd, 0x36, 0x91, 0x25, 0x37, 0x83}}
|
||||
return a, nil
|
||||
}
|
||||
@ -192,7 +192,7 @@ func _3_rendezvousUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 181, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 181, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5c, 0xb8, 0x4f, 0x88, 0xe9, 0xc6, 0xc, 0xbb, 0x2e, 0x56, 0xa2, 0xcd, 0x9, 0xfa, 0x33, 0x94, 0xd7, 0x73, 0xc1, 0xa, 0xc5, 0x69, 0xfb, 0x9f, 0x75, 0xdb, 0x75, 0x58, 0x20, 0x5e, 0xf, 0x14}}
|
||||
return a, nil
|
||||
}
|
||||
@ -212,7 +212,7 @@ func _4_signed_peer_recordDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 166, mode: os.FileMode(0664), modTime: time.Unix(1685640630, 0)}
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 166, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9c, 0x4b, 0x6c, 0x4d, 0xe5, 0x90, 0x9e, 0xd5, 0xf9, 0x86, 0xe5, 0x23, 0xe2, 0xd, 0xbe, 0x3c, 0x28, 0x8f, 0x68, 0x8e, 0x8e, 0xe9, 0xc5, 0xf4, 0x60, 0x9b, 0xc7, 0x40, 0xca, 0x30, 0xb6, 0x9e}}
|
||||
return a, nil
|
||||
}
|
||||
@ -232,7 +232,7 @@ func _4_signed_peer_recordUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 178, mode: os.FileMode(0664), modTime: time.Unix(1685640560, 0)}
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 178, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xa7, 0xfe, 0xfc, 0xdb, 0xd4, 0xad, 0x54, 0xb7, 0x67, 0xb, 0x97, 0x2a, 0xc5, 0x88, 0xc7, 0xe3, 0x49, 0x33, 0xa3, 0x13, 0x7e, 0xb4, 0x6a, 0x15, 0xf3, 0x6b, 0x7e, 0xc5, 0xb6, 0x38, 0x5f}}
|
||||
return a, nil
|
||||
}
|
||||
@ -252,7 +252,7 @@ func docGo() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
|
||||
@ -92,7 +92,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -112,7 +112,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 464, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -132,7 +132,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -152,7 +152,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(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
@ -172,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1678392960, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.down.sql", size: 65, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x4b, 0xc0, 0x7d, 0x4f, 0xac, 0xc4, 0x75, 0x59, 0xcc, 0xfc, 0x1a, 0x6c, 0x18, 0x81, 0x29, 0x24, 0x33, 0x3, 0x10, 0x39, 0xd0, 0x67, 0x28, 0xa0, 0xe0, 0xfd, 0x36, 0x91, 0x25, 0x37, 0x83}}
|
||||
return a, nil
|
||||
}
|
||||
@ -192,7 +192,7 @@ func _3_rendezvousUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 204, mode: os.FileMode(0664), modTime: time.Unix(1685637353, 0)}
|
||||
info := bindataFileInfo{name: "3_rendezvous.up.sql", size: 204, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0x9e, 0xd1, 0xde, 0xd4, 0xd3, 0x7, 0xc8, 0x7e, 0xa8, 0x54, 0xb5, 0xb3, 0xa1, 0x3c, 0x56, 0xd5, 0xcd, 0x61, 0xed, 0x9c, 0x82, 0x57, 0x24, 0x1f, 0x42, 0x98, 0xf4, 0x33, 0xa4, 0xc0, 0x16}}
|
||||
return a, nil
|
||||
}
|
||||
@ -212,7 +212,7 @@ func _4_signed_peer_recordDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 186, mode: os.FileMode(0664), modTime: time.Unix(1685637492, 0)}
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.down.sql", size: 186, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3c, 0x8b, 0xe8, 0x6a, 0xb6, 0x92, 0xff, 0x78, 0x83, 0xdb, 0x5d, 0x67, 0x93, 0x4b, 0xe3, 0xb3, 0x16, 0x9e, 0x22, 0x9e, 0xd4, 0xcb, 0xcc, 0x10, 0xf2, 0xa9, 0xa, 0x3c, 0xef, 0x80, 0xe0, 0x13}}
|
||||
return a, nil
|
||||
}
|
||||
@ -232,7 +232,7 @@ func _4_signed_peer_recordUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 197, mode: os.FileMode(0664), modTime: time.Unix(1685637465, 0)}
|
||||
info := bindataFileInfo{name: "4_signed_peer_record.up.sql", size: 197, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xf9, 0xc2, 0x12, 0xe0, 0xbd, 0x3d, 0xc9, 0x37, 0xb9, 0xfe, 0xa0, 0xda, 0x92, 0x99, 0xa8, 0x3a, 0x46, 0x7a, 0x3a, 0x26, 0xc, 0x63, 0x1c, 0x9a, 0x87, 0xce, 0x26, 0x7c, 0x9e, 0x87, 0x28}}
|
||||
return a, nil
|
||||
}
|
||||
@ -252,7 +252,7 @@ func docGo() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1673044753, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1693425598, 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
|
||||
}
|
||||
|
||||
@ -14,8 +14,8 @@ import (
|
||||
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"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// MessageProvider is an interface that provides access to store/retrieve messages from a persistence store.
|
||||
@ -212,7 +212,7 @@ func (d *DBStore) cleanOlderRecords(ctx context.Context) error {
|
||||
if d.maxDuration > 0 {
|
||||
start := time.Now()
|
||||
sqlStmt := `DELETE FROM message WHERE receiverTimestamp < $1`
|
||||
_, err := d.db.Exec(sqlStmt, utils.GetUnixEpochFrom(d.timesource.Now().Add(-d.maxDuration)))
|
||||
_, err := d.db.Exec(sqlStmt, d.timesource.Now().Add(-d.maxDuration).UnixNano())
|
||||
if err != nil {
|
||||
d.metrics.RecordError(retPolicyFailure)
|
||||
return err
|
||||
@ -287,11 +287,11 @@ func (d *DBStore) Validate(env *protocol.Envelope) error {
|
||||
lowerBound := n.Add(-MaxTimeVariance)
|
||||
|
||||
// Ensure that messages don't "jump" to the front of the queue with future timestamps
|
||||
if env.Message().Timestamp > upperBound.UnixNano() {
|
||||
if env.Message().GetTimestamp() > upperBound.UnixNano() {
|
||||
return ErrFutureMessage
|
||||
}
|
||||
|
||||
if env.Message().Timestamp < lowerBound.UnixNano() {
|
||||
if env.Message().GetTimestamp() < lowerBound.UnixNano() {
|
||||
return ErrMessageTooOld
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ func (d *DBStore) Put(env *protocol.Envelope) error {
|
||||
dbKey := NewDBKey(uint64(cursor.SenderTime), uint64(cursor.ReceiverTime), env.PubsubTopic(), env.Index().Digest)
|
||||
|
||||
start := time.Now()
|
||||
_, err = stmt.Exec(dbKey.Bytes(), cursor.ReceiverTime, env.Message().Timestamp, env.Message().ContentTopic, env.PubsubTopic(), env.Message().Payload, env.Message().Version)
|
||||
_, err = stmt.Exec(dbKey.Bytes(), cursor.ReceiverTime, env.Message().GetTimestamp(), env.Message().ContentTopic, env.PubsubTopic(), env.Message().Payload, env.Message().GetVersion())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -361,15 +361,17 @@ func (d *DBStore) handleQueryCursor(query *pb.HistoryQuery, paramCnt *int, condi
|
||||
parameters = append(parameters, timeDBKey.Bytes())
|
||||
}
|
||||
|
||||
if query.StartTime != 0 {
|
||||
startTime := query.GetStartTime()
|
||||
if startTime != 0 {
|
||||
if !usesCursor || query.PagingInfo.Direction == pb.PagingInfo_BACKWARD {
|
||||
handleTimeParam(query.StartTime, ">=")
|
||||
handleTimeParam(startTime, ">=")
|
||||
}
|
||||
}
|
||||
|
||||
if query.EndTime != 0 {
|
||||
endTime := query.GetEndTime()
|
||||
if endTime != 0 {
|
||||
if !usesCursor || query.PagingInfo.Direction == pb.PagingInfo_FORWARD {
|
||||
handleTimeParam(query.EndTime+1, "<")
|
||||
handleTimeParam(endTime+1, "<")
|
||||
}
|
||||
}
|
||||
return conditions, parameters, nil
|
||||
@ -564,8 +566,14 @@ func (d *DBStore) GetStoredMessage(row *sql.Rows) (StoredMessage, error) {
|
||||
msg := new(wpb.WakuMessage)
|
||||
msg.ContentTopic = contentTopic
|
||||
msg.Payload = payload
|
||||
msg.Timestamp = senderTimestamp
|
||||
msg.Version = version
|
||||
|
||||
if senderTimestamp != 0 {
|
||||
msg.Timestamp = proto.Int64(senderTimestamp)
|
||||
}
|
||||
|
||||
if version > 0 {
|
||||
msg.Version = proto.Uint32(version)
|
||||
}
|
||||
|
||||
record := StoredMessage{
|
||||
ID: id,
|
||||
|
||||
@ -25,13 +25,14 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/store"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func createTestMsg(version uint32) *pb.WakuMessage {
|
||||
message := new(pb.WakuMessage)
|
||||
message.Payload = []byte{0, 1, 2}
|
||||
message.Version = version
|
||||
message.Timestamp = 123456
|
||||
message.Version = proto.Uint32(version)
|
||||
message.Timestamp = proto.Int64(123456)
|
||||
message.ContentTopic = "abc"
|
||||
return message
|
||||
}
|
||||
@ -207,7 +208,7 @@ func Test500(t *testing.T) {
|
||||
for i := 1; i <= maxMsgs; i++ {
|
||||
msg := createTestMsg(0)
|
||||
msg.Payload = int2Bytes(i)
|
||||
msg.Timestamp = int64(i)
|
||||
msg.Timestamp = proto.Int64(int64(i))
|
||||
if _, err := wakuNode2.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic()); err != nil {
|
||||
require.Fail(t, "Could not publish all messages")
|
||||
}
|
||||
|
||||
@ -25,6 +25,9 @@ const (
|
||||
None KeyKind = "None"
|
||||
)
|
||||
|
||||
const Unencrypted = 0
|
||||
const V1Encryption = 1
|
||||
|
||||
// Payload contains the data of the message to encode
|
||||
type Payload struct {
|
||||
Data []byte // Raw message payload
|
||||
@ -94,7 +97,7 @@ func EncodeWakuMessage(message *pb.WakuMessage, keyInfo *KeyInfo) error {
|
||||
Key: keyInfo,
|
||||
}
|
||||
|
||||
encodedBytes, err := payload.Encode(message.Version)
|
||||
encodedBytes, err := payload.Encode(message.GetVersion())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -106,7 +109,7 @@ func EncodeWakuMessage(message *pb.WakuMessage, keyInfo *KeyInfo) error {
|
||||
// DecodePayload decodes a WakuMessage depending on the version parameter.
|
||||
// 0 for raw unencrypted data, and 1 for using WakuV1 decoding
|
||||
func DecodePayload(message *pb.WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, error) {
|
||||
switch message.Version {
|
||||
switch message.GetVersion() {
|
||||
case uint32(0):
|
||||
return &DecodedPayload{Data: message.Payload}, nil
|
||||
case uint32(1):
|
||||
|
||||
@ -7,13 +7,14 @@ import (
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func createTestMsg(version uint32) *pb.WakuMessage {
|
||||
message := new(pb.WakuMessage)
|
||||
message.Payload = []byte{0, 1, 2}
|
||||
message.Version = version
|
||||
message.Timestamp = 123456
|
||||
message.Version = proto.Uint32(version)
|
||||
message.Timestamp = proto.Int64(123456)
|
||||
return message
|
||||
}
|
||||
|
||||
@ -35,8 +36,8 @@ func TestEncodeDecodePayload(t *testing.T) {
|
||||
|
||||
message := new(pb.WakuMessage)
|
||||
message.Payload = encodedPayload
|
||||
message.Version = version
|
||||
message.Timestamp = 123456
|
||||
message.Version = proto.Uint32(version)
|
||||
message.Timestamp = proto.Int64(123456)
|
||||
|
||||
decodedPayload, err := DecodePayload(message, keyInfo)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -27,7 +27,7 @@ func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *
|
||||
index: &pb.Index{
|
||||
Digest: digest[:],
|
||||
ReceiverTime: receiverTime,
|
||||
SenderTime: msg.Timestamp,
|
||||
SenderTime: msg.GetTimestamp(),
|
||||
PubsubTopic: pubSubTopic,
|
||||
},
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
func TestEnvelope(t *testing.T) {
|
||||
e := NewEnvelope(
|
||||
&pb.WakuMessage{ContentTopic: "ContentTopic"},
|
||||
utils.GetUnixEpoch(),
|
||||
*utils.GetUnixEpoch(),
|
||||
"test",
|
||||
)
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ func (wf *WakuFilterLightNode) onRequest(ctx context.Context) func(network.Strea
|
||||
|
||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||
|
||||
messagePush := &pb.MessagePushV2{}
|
||||
messagePush := &pb.MessagePush{}
|
||||
err := reader.ReadMsg(messagePush)
|
||||
if err != nil {
|
||||
logger.Error("reading message push", zap.Error(err))
|
||||
@ -261,7 +261,11 @@ func (wf *WakuFilterLightNode) request(ctx context.Context, params *FilterSubscr
|
||||
|
||||
if filterSubscribeResponse.StatusCode != http.StatusOK {
|
||||
wf.metrics.RecordError(errorResponse)
|
||||
err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.StatusDesc)
|
||||
errMessage := ""
|
||||
if filterSubscribeResponse.StatusDesc != nil {
|
||||
errMessage = *filterSubscribeResponse.StatusDesc
|
||||
}
|
||||
err := NewFilterError(int(filterSubscribeResponse.StatusCode), errMessage)
|
||||
return &err
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ func (wf *WakuFilterLightNode) incorrectSubscribeRequest(ctx context.Context, pa
|
||||
|
||||
if filterSubscribeResponse.StatusCode != http.StatusOK {
|
||||
wf.metrics.RecordError(errorResponse)
|
||||
err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.StatusDesc)
|
||||
err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.GetStatusDesc())
|
||||
return &err
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.23.4
|
||||
// source: waku_filter_v2.proto
|
||||
// protoc v4.24.4
|
||||
// source: filter.proto
|
||||
|
||||
// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/
|
||||
|
||||
@ -59,11 +59,11 @@ func (x FilterSubscribeRequest_FilterSubscribeType) String() string {
|
||||
}
|
||||
|
||||
func (FilterSubscribeRequest_FilterSubscribeType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_waku_filter_v2_proto_enumTypes[0].Descriptor()
|
||||
return file_filter_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (FilterSubscribeRequest_FilterSubscribeType) Type() protoreflect.EnumType {
|
||||
return &file_waku_filter_v2_proto_enumTypes[0]
|
||||
return &file_filter_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x FilterSubscribeRequest_FilterSubscribeType) Number() protoreflect.EnumNumber {
|
||||
@ -72,7 +72,7 @@ func (x FilterSubscribeRequest_FilterSubscribeType) Number() protoreflect.EnumNu
|
||||
|
||||
// Deprecated: Use FilterSubscribeRequest_FilterSubscribeType.Descriptor instead.
|
||||
func (FilterSubscribeRequest_FilterSubscribeType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_waku_filter_v2_proto_rawDescGZIP(), []int{0, 0}
|
||||
return file_filter_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
// Protocol identifier: /vac/waku/filter-subscribe/2.0.0-beta1
|
||||
@ -82,7 +82,7 @@ type FilterSubscribeRequest struct {
|
||||
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"`
|
||||
FilterSubscribeType FilterSubscribeRequest_FilterSubscribeType `protobuf:"varint,2,opt,name=filter_subscribe_type,json=filterSubscribeType,proto3,enum=waku.filter.v2.FilterSubscribeRequest_FilterSubscribeType" json:"filter_subscribe_type,omitempty"`
|
||||
// Filter criteria
|
||||
PubsubTopic *string `protobuf:"bytes,10,opt,name=pubsub_topic,json=pubsubTopic,proto3,oneof" json:"pubsub_topic,omitempty"`
|
||||
ContentTopics []string `protobuf:"bytes,11,rep,name=content_topics,json=contentTopics,proto3" json:"content_topics,omitempty"`
|
||||
@ -91,7 +91,7 @@ type FilterSubscribeRequest struct {
|
||||
func (x *FilterSubscribeRequest) Reset() {
|
||||
*x = FilterSubscribeRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[0]
|
||||
mi := &file_filter_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -104,7 +104,7 @@ func (x *FilterSubscribeRequest) String() string {
|
||||
func (*FilterSubscribeRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FilterSubscribeRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[0]
|
||||
mi := &file_filter_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -117,7 +117,7 @@ func (x *FilterSubscribeRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use FilterSubscribeRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FilterSubscribeRequest) Descriptor() ([]byte, []int) {
|
||||
return file_waku_filter_v2_proto_rawDescGZIP(), []int{0}
|
||||
return file_filter_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FilterSubscribeRequest) GetRequestId() string {
|
||||
@ -153,15 +153,15 @@ type FilterSubscribeResponse struct {
|
||||
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"`
|
||||
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,oneof" json:"status_desc,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FilterSubscribeResponse) Reset() {
|
||||
*x = FilterSubscribeResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[1]
|
||||
mi := &file_filter_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -174,7 +174,7 @@ func (x *FilterSubscribeResponse) String() string {
|
||||
func (*FilterSubscribeResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FilterSubscribeResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[1]
|
||||
mi := &file_filter_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -187,7 +187,7 @@ func (x *FilterSubscribeResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use FilterSubscribeResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FilterSubscribeResponse) Descriptor() ([]byte, []int) {
|
||||
return file_waku_filter_v2_proto_rawDescGZIP(), []int{1}
|
||||
return file_filter_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *FilterSubscribeResponse) GetRequestId() string {
|
||||
@ -205,14 +205,14 @@ func (x *FilterSubscribeResponse) GetStatusCode() uint32 {
|
||||
}
|
||||
|
||||
func (x *FilterSubscribeResponse) GetStatusDesc() string {
|
||||
if x != nil {
|
||||
return x.StatusDesc
|
||||
if x != nil && x.StatusDesc != nil {
|
||||
return *x.StatusDesc
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1
|
||||
type MessagePushV2 struct {
|
||||
type MessagePush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@ -221,23 +221,23 @@ type MessagePushV2 struct {
|
||||
PubsubTopic *string `protobuf:"bytes,2,opt,name=pubsub_topic,json=pubsubTopic,proto3,oneof" json:"pubsub_topic,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MessagePushV2) Reset() {
|
||||
*x = MessagePushV2{}
|
||||
func (x *MessagePush) Reset() {
|
||||
*x = MessagePush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[2]
|
||||
mi := &file_filter_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MessagePushV2) String() string {
|
||||
func (x *MessagePush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MessagePushV2) ProtoMessage() {}
|
||||
func (*MessagePush) ProtoMessage() {}
|
||||
|
||||
func (x *MessagePushV2) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_filter_v2_proto_msgTypes[2]
|
||||
func (x *MessagePush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_filter_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -248,95 +248,99 @@ func (x *MessagePushV2) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MessagePushV2.ProtoReflect.Descriptor instead.
|
||||
func (*MessagePushV2) Descriptor() ([]byte, []int) {
|
||||
return file_waku_filter_v2_proto_rawDescGZIP(), []int{2}
|
||||
// Deprecated: Use MessagePush.ProtoReflect.Descriptor instead.
|
||||
func (*MessagePush) Descriptor() ([]byte, []int) {
|
||||
return file_filter_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *MessagePushV2) GetWakuMessage() *pb.WakuMessage {
|
||||
func (x *MessagePush) GetWakuMessage() *pb.WakuMessage {
|
||||
if x != nil {
|
||||
return x.WakuMessage
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *MessagePushV2) GetPubsubTopic() string {
|
||||
func (x *MessagePush) GetPubsubTopic() string {
|
||||
if x != nil && x.PubsubTopic != nil {
|
||||
return *x.PubsubTopic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_waku_filter_v2_proto protoreflect.FileDescriptor
|
||||
var File_filter_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, 0xdc,
|
||||
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, 0x26, 0x0a, 0x0c,
|
||||
0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x0a, 0x20, 0x01,
|
||||
0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69,
|
||||
0x63, 0x88, 0x01, 0x01, 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, 0x42, 0x0f, 0x0a, 0x0d,
|
||||
0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 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,
|
||||
var file_filter_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e,
|
||||
0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x1a, 0x1d,
|
||||
0x77, 0x61, 0x6b, 0x75, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 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, 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, 0x7c, 0x0a, 0x0d, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x56, 0x32, 0x12, 0x32, 0x0a, 0x0c, 0x77, 0x61,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x6e, 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, 0x3a, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66, 0x69,
|
||||
0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 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, 0x26, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73, 0x75,
|
||||
0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
|
||||
0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x88, 0x01, 0x01, 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, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x75, 0x62, 0x73,
|
||||
0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, 0x8f, 0x01, 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, 0x24, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64,
|
||||
0x65, 0x73, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x44, 0x65, 0x73, 0x63, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x22, 0x87, 0x01, 0x0a, 0x0b, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x3f, 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, 0x26,
|
||||
0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f,
|
||||
0x70, 0x69, 0x63, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75,
|
||||
0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x32, 0x1c, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e,
|
||||
0x76, 0x31, 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, 0x26, 0x0a, 0x0c, 0x70,
|
||||
0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63,
|
||||
0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74,
|
||||
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
|
||||
file_filter_proto_rawDescOnce sync.Once
|
||||
file_filter_proto_rawDescData = file_filter_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)
|
||||
func file_filter_proto_rawDescGZIP() []byte {
|
||||
file_filter_proto_rawDescOnce.Do(func() {
|
||||
file_filter_proto_rawDescData = protoimpl.X.CompressGZIP(file_filter_proto_rawDescData)
|
||||
})
|
||||
return file_waku_filter_v2_proto_rawDescData
|
||||
return file_filter_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_filter_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_filter_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_filter_proto_goTypes = []interface{}{
|
||||
(FilterSubscribeRequest_FilterSubscribeType)(0), // 0: waku.filter.v2.FilterSubscribeRequest.FilterSubscribeType
|
||||
(*FilterSubscribeRequest)(nil), // 1: waku.filter.v2.FilterSubscribeRequest
|
||||
(*FilterSubscribeResponse)(nil), // 2: waku.filter.v2.FilterSubscribeResponse
|
||||
(*MessagePush)(nil), // 3: waku.filter.v2.MessagePush
|
||||
(*pb.WakuMessage)(nil), // 4: waku.message.v1.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
|
||||
var file_filter_proto_depIdxs = []int32{
|
||||
0, // 0: waku.filter.v2.FilterSubscribeRequest.filter_subscribe_type:type_name -> waku.filter.v2.FilterSubscribeRequest.FilterSubscribeType
|
||||
4, // 1: waku.filter.v2.MessagePush.waku_message:type_name -> waku.message.v1.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
|
||||
@ -344,13 +348,13 @@ var file_waku_filter_v2_proto_depIdxs = []int32{
|
||||
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 {
|
||||
func init() { file_filter_proto_init() }
|
||||
func file_filter_proto_init() {
|
||||
if File_filter_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_waku_filter_v2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_filter_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FilterSubscribeRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -362,7 +366,7 @@ func file_waku_filter_v2_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_waku_filter_v2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_filter_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FilterSubscribeResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -374,8 +378,8 @@ func file_waku_filter_v2_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_waku_filter_v2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MessagePushV2); i {
|
||||
file_filter_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MessagePush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -387,25 +391,26 @@ func file_waku_filter_v2_proto_init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
file_waku_filter_v2_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
file_waku_filter_v2_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
file_filter_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
file_filter_proto_msgTypes[1].OneofWrappers = []interface{}{}
|
||||
file_filter_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_waku_filter_v2_proto_rawDesc,
|
||||
RawDescriptor: file_filter_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,
|
||||
GoTypes: file_filter_proto_goTypes,
|
||||
DependencyIndexes: file_filter_proto_depIdxs,
|
||||
EnumInfos: file_filter_proto_enumTypes,
|
||||
MessageInfos: file_filter_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
|
||||
File_filter_proto = out.File
|
||||
file_filter_proto_rawDesc = nil
|
||||
file_filter_proto_goTypes = nil
|
||||
file_filter_proto_depIdxs = nil
|
||||
}
|
||||
@ -1,3 +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/filter/pb --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_filter_v2.proto
|
||||
//go:generate protoc -I./../../waku-proto/waku/filter/v2/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mfilter.proto=github.com/waku-org/go-waku/waku/v2/protocol/filter/pb --go_opt=Mwaku/message/v1/message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./../../waku-proto/waku/filter/v2/filter.proto
|
||||
|
||||
@ -52,7 +52,7 @@ func (x *FilterSubscribeResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *MessagePushV2) Validate() error {
|
||||
func (x *MessagePush) Validate() error {
|
||||
if x.WakuMessage == nil {
|
||||
return errMissingMessage
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ func TestValidateResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateMessagePush(t *testing.T) {
|
||||
msgPush := &MessagePushV2{}
|
||||
msgPush := &MessagePush{}
|
||||
require.ErrorIs(t, msgPush.Validate(), errMissingMessage)
|
||||
msgPush.WakuMessage = &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/
|
||||
package pb;
|
||||
|
||||
import "waku_message.proto";
|
||||
|
||||
|
||||
// Protocol identifier: /vac/waku/filter-subscribe/2.0.0-beta1
|
||||
message FilterSubscribeRequest {
|
||||
enum FilterSubscribeType {
|
||||
SUBSCRIBER_PING = 0;
|
||||
SUBSCRIBE = 1;
|
||||
UNSUBSCRIBE = 2;
|
||||
UNSUBSCRIBE_ALL = 3;
|
||||
}
|
||||
|
||||
string request_id = 1;
|
||||
FilterSubscribeType filter_subscribe_type = 2;
|
||||
|
||||
// Filter criteria
|
||||
optional string pubsub_topic = 10;
|
||||
repeated string content_topics = 11;
|
||||
}
|
||||
|
||||
message FilterSubscribeResponse {
|
||||
string request_id = 1;
|
||||
uint32 status_code = 10;
|
||||
string status_desc = 11;
|
||||
}
|
||||
|
||||
// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1
|
||||
message MessagePushV2 {
|
||||
WakuMessage waku_message = 1;
|
||||
optional string pubsub_topic = 2;
|
||||
}
|
||||
@ -136,9 +136,10 @@ func (wf *WakuFilterFullNode) reply(ctx context.Context, stream network.Stream,
|
||||
}
|
||||
|
||||
if len(description) != 0 {
|
||||
response.StatusDesc = description[0]
|
||||
response.StatusDesc = &description[0]
|
||||
} else {
|
||||
response.StatusDesc = http.StatusText(statusCode)
|
||||
desc := http.StatusText(statusCode)
|
||||
response.StatusDesc = &desc
|
||||
}
|
||||
|
||||
writer := pbio.NewDelimitedWriter(stream)
|
||||
@ -256,7 +257,7 @@ func (wf *WakuFilterFullNode) pushMessage(ctx context.Context, peerID peer.ID, e
|
||||
zap.String("contentTopic", env.Message().ContentTopic),
|
||||
)
|
||||
pubSubTopic := env.PubsubTopic()
|
||||
messagePush := &pb.MessagePushV2{
|
||||
messagePush := &pb.MessagePush{
|
||||
PubsubTopic: &pubSubTopic,
|
||||
WakuMessage: env.Message(),
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
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
|
||||
//go:generate mv ./../../waku-proto/waku/filter/v2beta1/filter.proto ./../../waku-proto/waku/filter/v2beta1/legacy_filter.proto
|
||||
//go:generate protoc -I./../../waku-proto/waku/filter/v2beta1/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mlegacy_filter.proto=github.com/waku-org/go-waku/waku/v2/protocol/legacy_filter/pb --go_opt=Mwaku/message/v1/message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./../../waku-proto/waku/filter/v2beta1/legacy_filter.proto
|
||||
//go:generate mv ./../../waku-proto/waku/filter/v2beta1/legacy_filter.proto ./../../waku-proto/waku/filter/v2beta1/filter.proto
|
||||
|
||||
394
waku/v2/protocol/legacy_filter/pb/legacy_filter.pb.go
Normal file
394
waku/v2/protocol/legacy_filter/pb/legacy_filter.pb.go
Normal file
@ -0,0 +1,394 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: legacy_filter.proto
|
||||
|
||||
// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/
|
||||
// Protocol identifier: /vac/waku/filter/2.0.0-beta1
|
||||
|
||||
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=content_filters,json=contentFilters,proto3" json:"content_filters,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FilterRequest) Reset() {
|
||||
*x = FilterRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_legacy_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_legacy_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_legacy_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_legacy_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_legacy_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_legacy_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=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
Request *FilterRequest `protobuf:"bytes,2,opt,name=request,proto3,oneof" json:"request,omitempty"`
|
||||
Push *MessagePush `protobuf:"bytes,3,opt,name=push,proto3,oneof" json:"push,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FilterRpc) Reset() {
|
||||
*x = FilterRpc{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_legacy_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_legacy_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_legacy_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=content_topic,json=contentTopic,proto3" json:"content_topic,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FilterRequest_ContentFilter) Reset() {
|
||||
*x = FilterRequest_ContentFilter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_legacy_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_legacy_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_legacy_filter_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *FilterRequest_ContentFilter) GetContentTopic() string {
|
||||
if x != nil {
|
||||
return x.ContentTopic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_legacy_filter_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_legacy_filter_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66, 0x69, 0x6c, 0x74,
|
||||
0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x1d, 0x77, 0x61, 0x6b, 0x75,
|
||||
0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd4, 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,
|
||||
0x59, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65,
|
||||
0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e,
|
||||
0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 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, 0x34, 0x0a, 0x0d, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 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, 0x47, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12,
|
||||
0x38, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52,
|
||||
0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0xbd, 0x01, 0x0a, 0x09, 0x46, 0x69,
|
||||
0x6c, 0x74, 0x65, 0x72, 0x52, 0x70, 0x63, 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, 0x41, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66,
|
||||
0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x69,
|
||||
0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x72,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x04, 0x70, 0x75, 0x73,
|
||||
0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66,
|
||||
0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x48, 0x01, 0x52, 0x04, 0x70, 0x75, 0x73,
|
||||
0x68, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x75, 0x73, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_legacy_filter_proto_rawDescOnce sync.Once
|
||||
file_legacy_filter_proto_rawDescData = file_legacy_filter_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_legacy_filter_proto_rawDescGZIP() []byte {
|
||||
file_legacy_filter_proto_rawDescOnce.Do(func() {
|
||||
file_legacy_filter_proto_rawDescData = protoimpl.X.CompressGZIP(file_legacy_filter_proto_rawDescData)
|
||||
})
|
||||
return file_legacy_filter_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_legacy_filter_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_legacy_filter_proto_goTypes = []interface{}{
|
||||
(*FilterRequest)(nil), // 0: waku.filter.v2beta1.FilterRequest
|
||||
(*MessagePush)(nil), // 1: waku.filter.v2beta1.MessagePush
|
||||
(*FilterRpc)(nil), // 2: waku.filter.v2beta1.FilterRpc
|
||||
(*FilterRequest_ContentFilter)(nil), // 3: waku.filter.v2beta1.FilterRequest.ContentFilter
|
||||
(*pb.WakuMessage)(nil), // 4: waku.message.v1.WakuMessage
|
||||
}
|
||||
var file_legacy_filter_proto_depIdxs = []int32{
|
||||
3, // 0: waku.filter.v2beta1.FilterRequest.content_filters:type_name -> waku.filter.v2beta1.FilterRequest.ContentFilter
|
||||
4, // 1: waku.filter.v2beta1.MessagePush.messages:type_name -> waku.message.v1.WakuMessage
|
||||
0, // 2: waku.filter.v2beta1.FilterRpc.request:type_name -> waku.filter.v2beta1.FilterRequest
|
||||
1, // 3: waku.filter.v2beta1.FilterRpc.push:type_name -> waku.filter.v2beta1.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_legacy_filter_proto_init() }
|
||||
func file_legacy_filter_proto_init() {
|
||||
if File_legacy_filter_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_legacy_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_legacy_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_legacy_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_legacy_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
|
||||
}
|
||||
}
|
||||
}
|
||||
file_legacy_filter_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_legacy_filter_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_legacy_filter_proto_goTypes,
|
||||
DependencyIndexes: file_legacy_filter_proto_depIdxs,
|
||||
MessageInfos: file_legacy_filter_proto_msgTypes,
|
||||
}.Build()
|
||||
File_legacy_filter_proto = out.File
|
||||
file_legacy_filter_proto_rawDesc = nil
|
||||
file_legacy_filter_proto_goTypes = nil
|
||||
file_legacy_filter_proto_depIdxs = nil
|
||||
}
|
||||
@ -1,381 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
import "waku_message.proto";
|
||||
|
||||
message FilterRequest {
|
||||
bool subscribe = 1;
|
||||
string topic = 2;
|
||||
repeated ContentFilter contentFilters = 3;
|
||||
|
||||
message ContentFilter {
|
||||
string contentTopic = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message MessagePush {
|
||||
repeated WakuMessage messages = 1;
|
||||
}
|
||||
|
||||
message FilterRPC {
|
||||
string requestId = 1;
|
||||
FilterRequest request = 2;
|
||||
MessagePush push = 3;
|
||||
}
|
||||
@ -109,7 +109,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(network.Stream) {
|
||||
peerID := stream.Conn().RemotePeer()
|
||||
logger := wf.log.With(logging.HostID("peer", peerID))
|
||||
|
||||
filterRPCRequest := &pb.FilterRPC{}
|
||||
filterRPCRequest := &pb.FilterRpc{}
|
||||
|
||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||
|
||||
@ -166,7 +166,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(network.Stream) {
|
||||
}
|
||||
|
||||
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}}}
|
||||
pushRPC := &pb.FilterRpc{RequestId: subscriber.requestID, Push: &pb.MessagePush{Messages: []*wpb.WakuMessage{msg}}}
|
||||
logger := wf.log.With(logging.HostID("peer", subscriber.peer))
|
||||
|
||||
stream, err := wf.h.NewStream(ctx, subscriber.peer, FilterID_v20beta1)
|
||||
@ -288,7 +288,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil
|
||||
requestID := hex.EncodeToString(protocol.GenerateRequestID())
|
||||
|
||||
writer := pbio.NewDelimitedWriter(stream)
|
||||
filterRPC := &pb.FilterRPC{RequestId: requestID, Request: request}
|
||||
filterRPC := &pb.FilterRpc{RequestId: requestID, Request: request}
|
||||
wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC))
|
||||
err = writer.WriteMsg(filterRPC)
|
||||
if err != nil {
|
||||
@ -332,7 +332,7 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt
|
||||
}
|
||||
|
||||
writer := pbio.NewDelimitedWriter(stream)
|
||||
filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: request}
|
||||
filterRPC := &pb.FilterRpc{RequestId: hex.EncodeToString(id), Request: request}
|
||||
err = writer.WriteMsg(filterRPC)
|
||||
if err != nil {
|
||||
wf.metrics.RecordError(writeRequestFailure)
|
||||
|
||||
@ -1,3 +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
|
||||
//go:generate protoc -I./../../waku-proto/waku/lightpush/v2beta1/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mlightpush.proto=github.com/waku-org/go-waku/waku/v2/protocol/lightpush/pb --go_opt=Mwaku/message/v1/message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./../../waku-proto/waku/lightpush/v2beta1/lightpush.proto
|
||||
|
||||
328
waku/v2/protocol/lightpush/pb/lightpush.pb.go
Normal file
328
waku/v2/protocol/lightpush/pb/lightpush.pb.go
Normal file
@ -0,0 +1,328 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: lightpush.proto
|
||||
|
||||
// 19/WAKU2-LIGHTPUSH rfc: https://rfc.vac.dev/spec/19/
|
||||
// Protocol identifier: /vac/waku/lightpush/2.0.0-beta1
|
||||
|
||||
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_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_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_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"`
|
||||
Info *string `protobuf:"bytes,2,opt,name=info,proto3,oneof" json:"info,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PushResponse) Reset() {
|
||||
*x = PushResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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 && x.Info != 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"`
|
||||
Request *PushRequest `protobuf:"bytes,2,opt,name=request,proto3,oneof" json:"request,omitempty"`
|
||||
Response *PushResponse `protobuf:"bytes,3,opt,name=response,proto3,oneof" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PushRpc) Reset() {
|
||||
*x = PushRpc{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_lightpush_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PushRpc) GetRequestId() string {
|
||||
if x != nil {
|
||||
return x.RequestId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PushRpc) GetRequest() *PushRequest {
|
||||
if x != nil {
|
||||
return x.Request
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PushRpc) GetResponse() *PushResponse {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_lightpush_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_lightpush_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x16, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x70, 0x75, 0x73,
|
||||
0x68, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x1d, 0x77, 0x61, 0x6b, 0x75, 0x2f,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 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, 0x36, 0x0a, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x61,
|
||||
0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61,
|
||||
0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x22, 0x4f, 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, 0x17, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48,
|
||||
0x00, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x69,
|
||||
0x6e, 0x66, 0x6f, 0x22, 0xcc, 0x01, 0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x52, 0x70, 0x63, 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, 0x42,
|
||||
0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x23, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x70, 0x75, 0x73, 0x68,
|
||||
0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88,
|
||||
0x01, 0x01, 0x12, 0x45, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6c, 0x69, 0x67, 0x68,
|
||||
0x74, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x75,
|
||||
0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x01, 0x52, 0x08, 0x72, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x72, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_lightpush_proto_rawDescOnce sync.Once
|
||||
file_lightpush_proto_rawDescData = file_lightpush_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_lightpush_proto_rawDescGZIP() []byte {
|
||||
file_lightpush_proto_rawDescOnce.Do(func() {
|
||||
file_lightpush_proto_rawDescData = protoimpl.X.CompressGZIP(file_lightpush_proto_rawDescData)
|
||||
})
|
||||
return file_lightpush_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_lightpush_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_lightpush_proto_goTypes = []interface{}{
|
||||
(*PushRequest)(nil), // 0: waku.lightpush.v2beta1.PushRequest
|
||||
(*PushResponse)(nil), // 1: waku.lightpush.v2beta1.PushResponse
|
||||
(*PushRpc)(nil), // 2: waku.lightpush.v2beta1.PushRpc
|
||||
(*pb.WakuMessage)(nil), // 3: waku.message.v1.WakuMessage
|
||||
}
|
||||
var file_lightpush_proto_depIdxs = []int32{
|
||||
3, // 0: waku.lightpush.v2beta1.PushRequest.message:type_name -> waku.message.v1.WakuMessage
|
||||
0, // 1: waku.lightpush.v2beta1.PushRpc.request:type_name -> waku.lightpush.v2beta1.PushRequest
|
||||
1, // 2: waku.lightpush.v2beta1.PushRpc.response:type_name -> waku.lightpush.v2beta1.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_lightpush_proto_init() }
|
||||
func file_lightpush_proto_init() {
|
||||
if File_lightpush_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_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_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_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
|
||||
}
|
||||
}
|
||||
}
|
||||
file_lightpush_proto_msgTypes[1].OneofWrappers = []interface{}{}
|
||||
file_lightpush_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_lightpush_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_lightpush_proto_goTypes,
|
||||
DependencyIndexes: file_lightpush_proto_depIdxs,
|
||||
MessageInfos: file_lightpush_proto_msgTypes,
|
||||
}.Build()
|
||||
File_lightpush_proto = out.File
|
||||
file_lightpush_proto_rawDesc = nil
|
||||
file_lightpush_proto_goTypes = nil
|
||||
file_lightpush_proto_depIdxs = nil
|
||||
}
|
||||
@ -11,27 +11,27 @@ var (
|
||||
errMissingResponse = errors.New("missing Response field")
|
||||
)
|
||||
|
||||
func (x *PushRPC) ValidateRequest() error {
|
||||
func (x *PushRpc) ValidateRequest() error {
|
||||
if x.RequestId == "" {
|
||||
return errMissingRequestID
|
||||
}
|
||||
|
||||
if x.Query == nil {
|
||||
if x.Request == nil {
|
||||
return errMissingQuery
|
||||
}
|
||||
|
||||
if x.Query.PubsubTopic == "" {
|
||||
if x.Request.PubsubTopic == "" {
|
||||
return errMissingPubsubTopic
|
||||
}
|
||||
|
||||
if x.Query.Message == nil {
|
||||
if x.Request.Message == nil {
|
||||
return errMissingMessage
|
||||
}
|
||||
|
||||
return x.Query.Message.Validate()
|
||||
return x.Request.Message.Validate()
|
||||
}
|
||||
|
||||
func (x *PushRPC) ValidateResponse(requestID string) error {
|
||||
func (x *PushRpc) ValidateResponse(requestID string) error {
|
||||
if x.RequestId == "" {
|
||||
return errMissingRequestID
|
||||
}
|
||||
|
||||
@ -8,15 +8,15 @@ import (
|
||||
)
|
||||
|
||||
func TestValidateRequest(t *testing.T) {
|
||||
request := PushRPC{}
|
||||
request := PushRpc{}
|
||||
require.ErrorIs(t, request.ValidateRequest(), errMissingRequestID)
|
||||
request.RequestId = "test"
|
||||
require.ErrorIs(t, request.ValidateRequest(), errMissingQuery)
|
||||
request.Query = &PushRequest{}
|
||||
request.Request = &PushRequest{}
|
||||
require.ErrorIs(t, request.ValidateRequest(), errMissingPubsubTopic)
|
||||
request.Query.PubsubTopic = "test"
|
||||
request.Request.PubsubTopic = "test"
|
||||
require.ErrorIs(t, request.ValidateRequest(), errMissingMessage)
|
||||
request.Query.Message = &pb.WakuMessage{
|
||||
request.Request.Message = &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: "test",
|
||||
}
|
||||
@ -24,7 +24,7 @@ func TestValidateRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateResponse(t *testing.T) {
|
||||
response := PushRPC{}
|
||||
response := PushRpc{}
|
||||
require.ErrorIs(t, response.ValidateResponse("test"), errMissingRequestID)
|
||||
response.RequestId = "test1"
|
||||
require.ErrorIs(t, response.ValidateResponse("test"), errRequestIDMismatch)
|
||||
|
||||
@ -1,316 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
import "waku_message.proto";
|
||||
|
||||
message PushRequest {
|
||||
string pubsub_topic = 1;
|
||||
WakuMessage message = 2;
|
||||
}
|
||||
|
||||
message PushResponse {
|
||||
bool is_success = 1;
|
||||
// Error messages, etc
|
||||
string info = 2;
|
||||
}
|
||||
|
||||
message PushRPC {
|
||||
string request_id = 1;
|
||||
PushRequest query = 2;
|
||||
PushResponse response = 3;
|
||||
}
|
||||
@ -85,7 +85,7 @@ func (wakuLP *WakuLightPush) relayIsNotAvailable() bool {
|
||||
func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream) {
|
||||
return func(stream network.Stream) {
|
||||
logger := wakuLP.log.With(logging.HostID("peer", stream.Conn().RemotePeer()))
|
||||
requestPushRPC := &pb.PushRPC{}
|
||||
requestPushRPC := &pb.PushRpc{}
|
||||
|
||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||
|
||||
@ -99,13 +99,14 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
||||
return
|
||||
}
|
||||
|
||||
responsePushRPC := &pb.PushRPC{
|
||||
responsePushRPC := &pb.PushRpc{
|
||||
RequestId: requestPushRPC.RequestId,
|
||||
Response: &pb.PushResponse{},
|
||||
}
|
||||
|
||||
if err := requestPushRPC.ValidateRequest(); err != nil {
|
||||
responsePushRPC.Response.Info = err.Error()
|
||||
responseMsg := err.Error()
|
||||
responsePushRPC.Response.Info = &responseMsg
|
||||
wakuLP.metrics.RecordError(requestBodyFailure)
|
||||
wakuLP.reply(stream, responsePushRPC, logger)
|
||||
return
|
||||
@ -115,8 +116,8 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
||||
|
||||
logger.Info("push request")
|
||||
|
||||
pubSubTopic := requestPushRPC.Query.PubsubTopic
|
||||
message := requestPushRPC.Query.Message
|
||||
pubSubTopic := requestPushRPC.Request.PubsubTopic
|
||||
message := requestPushRPC.Request.Message
|
||||
|
||||
wakuLP.metrics.RecordMessage()
|
||||
|
||||
@ -127,11 +128,13 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
||||
if err != nil {
|
||||
logger.Error("publishing message", zap.Error(err))
|
||||
wakuLP.metrics.RecordError(messagePushFailure)
|
||||
responsePushRPC.Response.Info = fmt.Sprintf("Could not publish message: %s", err.Error())
|
||||
responseMsg := fmt.Sprintf("Could not publish message: %s", err.Error())
|
||||
responsePushRPC.Response.Info = &responseMsg
|
||||
return
|
||||
} else {
|
||||
responsePushRPC.Response.IsSuccess = true
|
||||
responsePushRPC.Response.Info = "OK"
|
||||
responseMsg := "OK"
|
||||
responsePushRPC.Response.Info = &responseMsg
|
||||
}
|
||||
|
||||
wakuLP.reply(stream, responsePushRPC, logger)
|
||||
@ -143,12 +146,12 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
||||
if responsePushRPC.Response.IsSuccess {
|
||||
logger.Info("request success")
|
||||
} else {
|
||||
logger.Info("request failure", zap.String("info", responsePushRPC.Response.Info))
|
||||
logger.Info("request failure", zap.String("info", responsePushRPC.GetResponse().GetInfo()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (wakuLP *WakuLightPush) reply(stream network.Stream, responsePushRPC *pb.PushRPC, logger *zap.Logger) {
|
||||
func (wakuLP *WakuLightPush) reply(stream network.Stream, responsePushRPC *pb.PushRpc, logger *zap.Logger) {
|
||||
writer := pbio.NewDelimitedWriter(stream)
|
||||
err := writer.WriteMsg(responsePushRPC)
|
||||
if err != nil {
|
||||
@ -180,7 +183,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, p
|
||||
wakuLP.metrics.RecordError(dialFailure)
|
||||
return nil, err
|
||||
}
|
||||
pushRequestRPC := &pb.PushRPC{RequestId: hex.EncodeToString(params.requestID), Query: req}
|
||||
pushRequestRPC := &pb.PushRpc{RequestId: hex.EncodeToString(params.requestID), Request: req}
|
||||
|
||||
writer := pbio.NewDelimitedWriter(stream)
|
||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||
@ -195,7 +198,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, p
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pushResponseRPC := &pb.PushRPC{}
|
||||
pushResponseRPC := &pb.PushRpc{}
|
||||
err = reader.ReadMsg(pushResponseRPC)
|
||||
if err != nil {
|
||||
logger.Error("reading response", zap.Error(err))
|
||||
@ -293,5 +296,10 @@ func (wakuLP *WakuLightPush) Publish(ctx context.Context, message *wpb.WakuMessa
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
return nil, errors.New(response.Info)
|
||||
errMsg := "lightpush error"
|
||||
if response.Info != nil {
|
||||
errMsg = *response.Info
|
||||
}
|
||||
|
||||
return nil, errors.New(errMsg)
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ func TestWakuLightPush(t *testing.T) {
|
||||
// Checking that msg hash is correct
|
||||
hash, err := client.Publish(ctx, msg2, lpOptions...)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), string(testTopic)).Hash(), hash)
|
||||
require.Equal(t, protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), string(testTopic)).Hash(), hash)
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ func TestWakuLightPushAutoSharding(t *testing.T) {
|
||||
// Verifying successful request
|
||||
hash1, err := client.Publish(ctx, msg1, lpOptions...)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), string(pubSubTopic)).Hash(), hash1)
|
||||
require.Equal(t, protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), string(pubSubTopic)).Hash(), hash1)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
package pb
|
||||
|
||||
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mwaku_metadata.proto=github.com/waku-org/go-waku/waku/v2/protocol/metadata/pb --go_out=. ./waku_metadata.proto
|
||||
//go:generate protoc -I./../../waku-proto/waku/metadata/v1/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mwaku_metadata.proto=github.com/waku-org/go-waku/waku/v2/protocol/metadata/pb --go_out=. ./../../waku-proto/waku/metadata/v1/waku_metadata.proto
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v3.21.12
|
||||
// protoc v4.24.4
|
||||
// source: waku_metadata.proto
|
||||
|
||||
// rfc: https://rfc.vac.dev/spec/66/
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
@ -134,20 +136,21 @@ var File_waku_metadata_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_waku_metadata_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x60, 0x0a, 0x13, 0x57, 0x61, 0x6b,
|
||||
0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49,
|
||||
0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02,
|
||||
0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b,
|
||||
0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x57,
|
||||
0x61, 0x6b, 0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64,
|
||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42,
|
||||
0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x22, 0x60, 0x0a, 0x13, 0x57, 0x61, 0x6b, 0x75, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22,
|
||||
0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x88,
|
||||
0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03,
|
||||
0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x57, 0x61, 0x6b,
|
||||
0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a,
|
||||
0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -164,8 +167,8 @@ func file_waku_metadata_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_waku_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_waku_metadata_proto_goTypes = []interface{}{
|
||||
(*WakuMetadataRequest)(nil), // 0: pb.WakuMetadataRequest
|
||||
(*WakuMetadataResponse)(nil), // 1: pb.WakuMetadataResponse
|
||||
(*WakuMetadataRequest)(nil), // 0: waku.metadata.v1.WakuMetadataRequest
|
||||
(*WakuMetadataResponse)(nil), // 1: waku.metadata.v1.WakuMetadataResponse
|
||||
}
|
||||
var file_waku_metadata_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
message WakuMetadataRequest {
|
||||
optional uint32 cluster_id = 1;
|
||||
repeated uint32 shards = 2;
|
||||
}
|
||||
|
||||
message WakuMetadataResponse {
|
||||
optional uint32 cluster_id = 1;
|
||||
repeated uint32 shards = 2;
|
||||
}
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"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"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type NoiseMessenger interface {
|
||||
@ -106,7 +107,7 @@ func (r *NoiseWakuRelay) Subscribe(ctx context.Context, contentTopic string) <-c
|
||||
return
|
||||
}
|
||||
|
||||
if env.Message().ContentTopic != contentTopic || env.Message().Version != 2 {
|
||||
if env.Message().ContentTopic != contentTopic || env.Message().GetVersion() != NoiseEncryption {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -127,7 +128,7 @@ func (r *NoiseWakuRelay) Publish(ctx context.Context, contentTopic string, paylo
|
||||
}
|
||||
|
||||
message.ContentTopic = contentTopic
|
||||
message.Timestamp = r.timesource.Now().UnixNano()
|
||||
message.Timestamp = proto.Int64(r.timesource.Now().UnixNano())
|
||||
|
||||
_, err = r.relay.Publish(ctx, message, relay.WithPubSubTopic(r.pubsubTopic))
|
||||
return err
|
||||
|
||||
@ -5,12 +5,15 @@ import (
|
||||
|
||||
n "github.com/waku-org/go-noise"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const NoiseEncryption = 2
|
||||
|
||||
// DecodePayloadV2 decodes a WakuMessage to a PayloadV2
|
||||
// Currently, this is just a wrapper over deserializePayloadV2 and encryption/decryption is done on top (no KeyInfo)
|
||||
func DecodePayloadV2(message *pb.WakuMessage) (*n.PayloadV2, error) {
|
||||
if message.Version != 2 {
|
||||
if message.GetVersion() != NoiseEncryption {
|
||||
return nil, errors.New("wrong message version while decoding payload")
|
||||
}
|
||||
return n.DeserializePayloadV2(message.Payload)
|
||||
@ -26,6 +29,6 @@ func EncodePayloadV2(payload2 *n.PayloadV2) (*pb.WakuMessage, error) {
|
||||
|
||||
return &pb.WakuMessage{
|
||||
Payload: serializedPayload2,
|
||||
Version: 2,
|
||||
Version: proto.Uint32(NoiseEncryption),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
package pb
|
||||
|
||||
//go:generate protoc -I. --go_opt=paths=source_relative --go_opt=Mwaku_message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./waku_message.proto
|
||||
//go:generate protoc -I./../waku-proto/waku/message/v1/. -I./../waku-proto/ --go_opt=paths=source_relative --go_opt=Mmessage.proto=github.com/waku-org/go-waku/waku/v2/pb --go_out=. ./../waku-proto/waku/message/v1/message.proto
|
||||
|
||||
210
waku/v2/protocol/pb/message.pb.go
Normal file
210
waku/v2/protocol/pb/message.pb.go
Normal file
@ -0,0 +1,210 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: message.proto
|
||||
|
||||
// 14/WAKU2-MESSAGE rfc: https://rfc.vac.dev/spec/14/
|
||||
|
||||
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 WakuMessage struct {
|
||||
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=content_topic,json=contentTopic,proto3" json:"content_topic,omitempty"`
|
||||
Version *uint32 `protobuf:"varint,3,opt,name=version,proto3,oneof" json:"version,omitempty"`
|
||||
Timestamp *int64 `protobuf:"zigzag64,10,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"`
|
||||
Meta []byte `protobuf:"bytes,11,opt,name=meta,proto3,oneof" json:"meta,omitempty"`
|
||||
Ephemeral *bool `protobuf:"varint,31,opt,name=ephemeral,proto3,oneof" json:"ephemeral,omitempty"`
|
||||
RateLimitProof []byte `protobuf:"bytes,21,opt,name=rate_limit_proof,json=rateLimitProof,proto3,oneof" json:"rate_limit_proof,omitempty"`
|
||||
}
|
||||
|
||||
func (x *WakuMessage) Reset() {
|
||||
*x = WakuMessage{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_message_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *WakuMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WakuMessage) ProtoMessage() {}
|
||||
|
||||
func (x *WakuMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_message_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 WakuMessage.ProtoReflect.Descriptor instead.
|
||||
func (*WakuMessage) Descriptor() ([]byte, []int) {
|
||||
return file_message_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetPayload() []byte {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetContentTopic() string {
|
||||
if x != nil {
|
||||
return x.ContentTopic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetVersion() uint32 {
|
||||
if x != nil && x.Version != nil {
|
||||
return *x.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetTimestamp() int64 {
|
||||
if x != nil && x.Timestamp != nil {
|
||||
return *x.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetMeta() []byte {
|
||||
if x != nil {
|
||||
return x.Meta
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetEphemeral() bool {
|
||||
if x != nil && x.Ephemeral != nil {
|
||||
return *x.Ephemeral
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetRateLimitProof() []byte {
|
||||
if x != nil {
|
||||
return x.RateLimitProof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_message_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_message_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x0f, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31,
|
||||
0x22, 0xbf, 0x02, 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, 0x23, 0x0a, 0x0d, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 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,
|
||||
0x1d, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x48, 0x00, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x21,
|
||||
0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
||||
0x12, 0x48, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x88, 0x01,
|
||||
0x01, 0x12, 0x17, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x48,
|
||||
0x02, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x65, 0x70,
|
||||
0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52,
|
||||
0x09, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a,
|
||||
0x10, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x6f,
|
||||
0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x04, 0x52, 0x0e, 0x72, 0x61, 0x74, 0x65, 0x4c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08,
|
||||
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x42,
|
||||
0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x42, 0x13, 0x0a,
|
||||
0x11, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x6f,
|
||||
0x6f, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_message_proto_rawDescOnce sync.Once
|
||||
file_message_proto_rawDescData = file_message_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_message_proto_rawDescGZIP() []byte {
|
||||
file_message_proto_rawDescOnce.Do(func() {
|
||||
file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData)
|
||||
})
|
||||
return file_message_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_message_proto_goTypes = []interface{}{
|
||||
(*WakuMessage)(nil), // 0: waku.message.v1.WakuMessage
|
||||
}
|
||||
var file_message_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_message_proto_init() }
|
||||
func file_message_proto_init() {
|
||||
if File_message_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_message_proto_msgTypes[0].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
|
||||
}
|
||||
}
|
||||
}
|
||||
file_message_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_message_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_message_proto_goTypes,
|
||||
DependencyIndexes: file_message_proto_depIdxs,
|
||||
MessageInfos: file_message_proto_msgTypes,
|
||||
}.Build()
|
||||
File_message_proto = out.File
|
||||
file_message_proto_rawDesc = nil
|
||||
file_message_proto_goTypes = nil
|
||||
file_message_proto_depIdxs = nil
|
||||
}
|
||||
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/waku-org/go-waku/waku/v2/hash"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestHash(t *testing.T) {
|
||||
@ -18,8 +19,8 @@ func TestEnvelopeHash(t *testing.T) {
|
||||
msg := new(WakuMessage)
|
||||
msg.ContentTopic = "Test"
|
||||
msg.Payload = []byte("Hello World")
|
||||
msg.Timestamp = 123456789123456789
|
||||
msg.Version = 1
|
||||
msg.Timestamp = proto.Int64(123456789123456789)
|
||||
msg.Version = proto.Uint32(1)
|
||||
|
||||
expected := []byte{0xee, 0xcf, 0xf5, 0xb7, 0xdd, 0x54, 0x2d, 0x68, 0x9e, 0x7d, 0x64, 0xa3, 0xb8, 0x50, 0x8b, 0xba, 0xc, 0xf1, 0xac, 0xb6, 0xf7, 0x1c, 0x9f, 0xf2, 0x32, 0x7, 0x5b, 0xfd, 0x90, 0x5c, 0xe5, 0xa1}
|
||||
result := msg.Hash("test")
|
||||
@ -33,8 +34,8 @@ func TestEmptyMeta(t *testing.T) {
|
||||
msg.Payload = []byte("\x01\x02\x03\x04TEST\x05\x06\x07\x08")
|
||||
|
||||
msg.Meta = []byte{}
|
||||
msg.Timestamp = 123456789123456789
|
||||
msg.Version = 1
|
||||
msg.Timestamp = proto.Int64(123456789123456789)
|
||||
msg.Version = proto.Uint32(1)
|
||||
|
||||
messageHash := msg.Hash(pubsubTopic)
|
||||
|
||||
@ -47,7 +48,7 @@ func Test13ByteMeta(t *testing.T) {
|
||||
msg.ContentTopic = "/waku/2/default-content/proto"
|
||||
msg.Payload = []byte("\x01\x02\x03\x04TEST\x05\x06\x07\x08")
|
||||
msg.Meta = []byte("\x73\x75\x70\x65\x72\x2d\x73\x65\x63\x72\x65\x74")
|
||||
msg.Version = 1
|
||||
msg.Version = proto.Uint32(1)
|
||||
|
||||
messageHash := msg.Hash(pubsubTopic)
|
||||
|
||||
@ -60,7 +61,7 @@ func TestZeroLenPayload(t *testing.T) {
|
||||
msg.ContentTopic = "/waku/2/default-content/proto"
|
||||
msg.Payload = []byte{}
|
||||
msg.Meta = []byte("\x73\x75\x70\x65\x72\x2d\x73\x65\x63\x72\x65\x74")
|
||||
msg.Version = 1
|
||||
msg.Version = proto.Uint32(1)
|
||||
|
||||
messageHash := msg.Hash(pubsubTopic)
|
||||
|
||||
|
||||
@ -1,324 +0,0 @@
|
||||
// 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 (
|
||||
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 RateLimitProof struct {
|
||||
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 (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 (x *RateLimitProof) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
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 ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RateLimitProof.ProtoReflect.Descriptor instead.
|
||||
func (*RateLimitProof) Descriptor() ([]byte, []int) {
|
||||
return file_waku_message_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetProof() []byte {
|
||||
if x != nil {
|
||||
return x.Proof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetMerkleRoot() []byte {
|
||||
if x != nil {
|
||||
return x.MerkleRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetEpoch() []byte {
|
||||
if x != nil {
|
||||
return x.Epoch
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetShareX() []byte {
|
||||
if x != nil {
|
||||
return x.ShareX
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetShareY() []byte {
|
||||
if x != nil {
|
||||
return x.ShareY
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetNullifier() []byte {
|
||||
if x != nil {
|
||||
return x.Nullifier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetRlnIdentifier() []byte {
|
||||
if x != nil {
|
||||
return x.RlnIdentifier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WakuMessage struct {
|
||||
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"`
|
||||
Meta []byte `protobuf:"bytes,11,opt,name=meta,proto3" json:"meta,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 (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 (x *WakuMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WakuMessage) ProtoMessage() {}
|
||||
|
||||
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 (x *WakuMessage) GetContentTopic() string {
|
||||
if x != nil {
|
||||
return x.ContentTopic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetVersion() uint32 {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetMeta() []byte {
|
||||
if x != nil {
|
||||
return x.Meta
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetRateLimitProof() *RateLimitProof {
|
||||
if x != nil {
|
||||
return x.RateLimitProof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WakuMessage) GetEphemeral() bool {
|
||||
if x != nil {
|
||||
return x.Ephemeral
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_waku_message_proto protoreflect.FileDescriptor
|
||||
|
||||
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,
|
||||
0xf3, 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, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x0b, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 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 (
|
||||
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
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
message RateLimitProof {
|
||||
bytes proof = 1;
|
||||
bytes merkle_root = 2;
|
||||
bytes epoch = 3;
|
||||
bytes share_x = 4;
|
||||
bytes share_y = 5;
|
||||
bytes nullifier = 6;
|
||||
bytes rln_identifier = 7;
|
||||
}
|
||||
|
||||
message WakuMessage {
|
||||
bytes payload = 1;
|
||||
string contentTopic = 2;
|
||||
uint32 version = 3;
|
||||
sint64 timestamp = 10;
|
||||
bytes meta = 11;
|
||||
RateLimitProof rate_limit_proof = 21;
|
||||
bool ephemeral = 31;
|
||||
}
|
||||
@ -91,9 +91,9 @@ func (wakuPX *WakuPeerExchange) handleResponse(ctx context.Context, response *pb
|
||||
|
||||
for _, p := range response.PeerInfos {
|
||||
enrRecord := &enr.Record{}
|
||||
buf := bytes.NewBuffer(p.ENR)
|
||||
buf := bytes.NewBuffer(p.Enr)
|
||||
|
||||
err := enrRecord.DecodeRLP(rlp.NewStream(buf, uint64(len(p.ENR))))
|
||||
err := enrRecord.DecodeRLP(rlp.NewStream(buf, uint64(len(p.Enr))))
|
||||
if err != nil {
|
||||
wakuPX.log.Error("converting bytes to enr", zap.Error(err))
|
||||
return err
|
||||
|
||||
@ -67,7 +67,7 @@ func (c *enrCache) getENRs(neededPeers int) ([]*pb.PeerInfo, error) {
|
||||
}
|
||||
writer.Flush()
|
||||
result = append(result, &pb.PeerInfo{
|
||||
ENR: b.Bytes(),
|
||||
Enr: b.Bytes(),
|
||||
})
|
||||
}
|
||||
return result, nil
|
||||
|
||||
@ -1,3 +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
|
||||
//go:generate protoc -I./../../waku-proto/waku/peer_exchange/v2alpha1/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mpeer_exchange.proto=github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb --go_out=. ./../../waku-proto/waku/peer_exchange/v2alpha1/peer_exchange.proto
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
// 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
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: peer_exchange.proto
|
||||
|
||||
// 34/WAKU2-PEER-EXCHANGE rfc: https://rfc.vac.dev/spec/34/
|
||||
// Protocol identifier: /vac/waku/peer-exchange/2.0.0-alpha1
|
||||
|
||||
package pb
|
||||
|
||||
@ -25,13 +28,13 @@ type PeerInfo struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ENR []byte `protobuf:"bytes,1,opt,name=ENR,proto3" json:"ENR,omitempty"`
|
||||
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]
|
||||
mi := &file_peer_exchange_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -44,7 +47,7 @@ func (x *PeerInfo) String() string {
|
||||
func (*PeerInfo) ProtoMessage() {}
|
||||
|
||||
func (x *PeerInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[0]
|
||||
mi := &file_peer_exchange_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -57,12 +60,12 @@ func (x *PeerInfo) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.
|
||||
func (*PeerInfo) Descriptor() ([]byte, []int) {
|
||||
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{0}
|
||||
return file_peer_exchange_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PeerInfo) GetENR() []byte {
|
||||
func (x *PeerInfo) GetEnr() []byte {
|
||||
if x != nil {
|
||||
return x.ENR
|
||||
return x.Enr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -72,13 +75,13 @@ type PeerExchangeQuery struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NumPeers uint64 `protobuf:"varint,1,opt,name=numPeers,proto3" json:"numPeers,omitempty"` // number of peers requested
|
||||
NumPeers uint64 `protobuf:"varint,1,opt,name=num_peers,json=numPeers,proto3" json:"num_peers,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PeerExchangeQuery) Reset() {
|
||||
*x = PeerExchangeQuery{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[1]
|
||||
mi := &file_peer_exchange_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -91,7 +94,7 @@ func (x *PeerExchangeQuery) String() string {
|
||||
func (*PeerExchangeQuery) ProtoMessage() {}
|
||||
|
||||
func (x *PeerExchangeQuery) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[1]
|
||||
mi := &file_peer_exchange_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -104,7 +107,7 @@ func (x *PeerExchangeQuery) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PeerExchangeQuery.ProtoReflect.Descriptor instead.
|
||||
func (*PeerExchangeQuery) Descriptor() ([]byte, []int) {
|
||||
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{1}
|
||||
return file_peer_exchange_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PeerExchangeQuery) GetNumPeers() uint64 {
|
||||
@ -119,13 +122,13 @@ type PeerExchangeResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
PeerInfos []*PeerInfo `protobuf:"bytes,1,rep,name=peerInfos,proto3" json:"peerInfos,omitempty"`
|
||||
PeerInfos []*PeerInfo `protobuf:"bytes,1,rep,name=peer_infos,json=peerInfos,proto3" json:"peer_infos,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PeerExchangeResponse) Reset() {
|
||||
*x = PeerExchangeResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[2]
|
||||
mi := &file_peer_exchange_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -138,7 +141,7 @@ func (x *PeerExchangeResponse) String() string {
|
||||
func (*PeerExchangeResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PeerExchangeResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[2]
|
||||
mi := &file_peer_exchange_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -151,7 +154,7 @@ func (x *PeerExchangeResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PeerExchangeResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PeerExchangeResponse) Descriptor() ([]byte, []int) {
|
||||
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{2}
|
||||
return file_peer_exchange_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PeerExchangeResponse) GetPeerInfos() []*PeerInfo {
|
||||
@ -173,7 +176,7 @@ type PeerExchangeRPC struct {
|
||||
func (x *PeerExchangeRPC) Reset() {
|
||||
*x = PeerExchangeRPC{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[3]
|
||||
mi := &file_peer_exchange_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -186,7 +189,7 @@ func (x *PeerExchangeRPC) String() string {
|
||||
func (*PeerExchangeRPC) ProtoMessage() {}
|
||||
|
||||
func (x *PeerExchangeRPC) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_waku_peer_exchange_proto_msgTypes[3]
|
||||
mi := &file_peer_exchange_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -199,7 +202,7 @@ func (x *PeerExchangeRPC) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PeerExchangeRPC.ProtoReflect.Descriptor instead.
|
||||
func (*PeerExchangeRPC) Descriptor() ([]byte, []int) {
|
||||
return file_waku_peer_exchange_proto_rawDescGZIP(), []int{3}
|
||||
return file_peer_exchange_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PeerExchangeRPC) GetQuery() *PeerExchangeQuery {
|
||||
@ -216,53 +219,60 @@ func (x *PeerExchangeRPC) GetResponse() *PeerExchangeResponse {
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_waku_peer_exchange_proto protoreflect.FileDescriptor
|
||||
var File_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_peer_exchange_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72,
|
||||
0x5f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x65, 0x6e, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x65, 0x6e, 0x72,
|
||||
0x22, 0x30, 0x0a, 0x11, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x75, 0x6d, 0x5f, 0x70, 0x65, 0x65,
|
||||
0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65,
|
||||
0x72, 0x73, 0x22, 0x5c, 0x0a, 0x14, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x70, 0x65,
|
||||
0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25,
|
||||
0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x65,
|
||||
0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73,
|
||||
0x22, 0xa6, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x52, 0x50, 0x43, 0x12, 0x44, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x5f,
|
||||
0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||
0x31, 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, 0x4d, 0x0a, 0x08, 0x72, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x77,
|
||||
0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 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
|
||||
file_peer_exchange_proto_rawDescOnce sync.Once
|
||||
file_peer_exchange_proto_rawDescData = file_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)
|
||||
func file_peer_exchange_proto_rawDescGZIP() []byte {
|
||||
file_peer_exchange_proto_rawDescOnce.Do(func() {
|
||||
file_peer_exchange_proto_rawDescData = protoimpl.X.CompressGZIP(file_peer_exchange_proto_rawDescData)
|
||||
})
|
||||
return file_waku_peer_exchange_proto_rawDescData
|
||||
return file_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_peer_exchange_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_peer_exchange_proto_goTypes = []interface{}{
|
||||
(*PeerInfo)(nil), // 0: waku.peer_exchange.v2alpha1.PeerInfo
|
||||
(*PeerExchangeQuery)(nil), // 1: waku.peer_exchange.v2alpha1.PeerExchangeQuery
|
||||
(*PeerExchangeResponse)(nil), // 2: waku.peer_exchange.v2alpha1.PeerExchangeResponse
|
||||
(*PeerExchangeRPC)(nil), // 3: waku.peer_exchange.v2alpha1.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
|
||||
var file_peer_exchange_proto_depIdxs = []int32{
|
||||
0, // 0: waku.peer_exchange.v2alpha1.PeerExchangeResponse.peer_infos:type_name -> waku.peer_exchange.v2alpha1.PeerInfo
|
||||
1, // 1: waku.peer_exchange.v2alpha1.PeerExchangeRPC.query:type_name -> waku.peer_exchange.v2alpha1.PeerExchangeQuery
|
||||
2, // 2: waku.peer_exchange.v2alpha1.PeerExchangeRPC.response:type_name -> waku.peer_exchange.v2alpha1.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
|
||||
@ -270,13 +280,13 @@ var file_waku_peer_exchange_proto_depIdxs = []int32{
|
||||
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 {
|
||||
func init() { file_peer_exchange_proto_init() }
|
||||
func file_peer_exchange_proto_init() {
|
||||
if File_peer_exchange_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_waku_peer_exchange_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_peer_exchange_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PeerInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -288,7 +298,7 @@ func file_waku_peer_exchange_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_waku_peer_exchange_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_peer_exchange_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PeerExchangeQuery); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -300,7 +310,7 @@ func file_waku_peer_exchange_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_waku_peer_exchange_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_peer_exchange_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PeerExchangeResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -312,7 +322,7 @@ func file_waku_peer_exchange_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_waku_peer_exchange_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_peer_exchange_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PeerExchangeRPC); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -329,18 +339,18 @@ func file_waku_peer_exchange_proto_init() {
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_waku_peer_exchange_proto_rawDesc,
|
||||
RawDescriptor: file_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,
|
||||
GoTypes: file_peer_exchange_proto_goTypes,
|
||||
DependencyIndexes: file_peer_exchange_proto_depIdxs,
|
||||
MessageInfos: file_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
|
||||
File_peer_exchange_proto = out.File
|
||||
file_peer_exchange_proto_rawDesc = nil
|
||||
file_peer_exchange_proto_goTypes = nil
|
||||
file_peer_exchange_proto_depIdxs = nil
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
message PeerInfo {
|
||||
bytes ENR = 1;
|
||||
}
|
||||
|
||||
message PeerExchangeQuery {
|
||||
uint64 numPeers = 1; // number of peers requested
|
||||
}
|
||||
|
||||
message PeerExchangeResponse {
|
||||
repeated PeerInfo peerInfos = 1;
|
||||
}
|
||||
|
||||
message PeerExchangeRPC {
|
||||
PeerExchangeQuery query = 1;
|
||||
PeerExchangeResponse response = 2;
|
||||
}
|
||||
@ -30,7 +30,7 @@ func TestBroadcast(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, utils.GetUnixEpoch(), "abc")
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, *utils.GetUnixEpoch(), "abc")
|
||||
b.Submit(env)
|
||||
|
||||
wg.Wait()
|
||||
@ -56,7 +56,7 @@ func TestBroadcastSpecificTopic(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, utils.GetUnixEpoch(), "abc")
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, *utils.GetUnixEpoch(), "abc")
|
||||
b.Submit(env)
|
||||
|
||||
wg.Wait()
|
||||
@ -81,7 +81,7 @@ func TestBroadcastUnregisterSub(t *testing.T) {
|
||||
specificSub := b.Register(protocol.NewContentFilter("abc"))
|
||||
specificSub.Unsubscribe()
|
||||
//
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, utils.GetUnixEpoch(), "abc")
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, *utils.GetUnixEpoch(), "abc")
|
||||
b.Submit(env)
|
||||
// no message on specific sub
|
||||
require.Nil(t, <-specificSub.Ch)
|
||||
@ -96,7 +96,7 @@ func TestBroadcastNoOneListening(t *testing.T) {
|
||||
require.NoError(t, b.Start(context.Background()))
|
||||
_ = b.RegisterForAll() // no one listening on channel
|
||||
//
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, utils.GetUnixEpoch(), "abc")
|
||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, *utils.GetUnixEpoch(), "abc")
|
||||
b.Submit(env)
|
||||
b.Submit(env)
|
||||
b.Stop()
|
||||
|
||||
@ -21,10 +21,10 @@ import (
|
||||
|
||||
func msgHash(pubSubTopic string, msg *pb.WakuMessage) []byte {
|
||||
timestampBytes := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(timestampBytes, uint64(msg.Timestamp))
|
||||
binary.LittleEndian.PutUint64(timestampBytes, uint64(msg.GetTimestamp()))
|
||||
|
||||
var ephemeralByte byte
|
||||
if msg.Ephemeral {
|
||||
if msg.GetEphemeral() {
|
||||
ephemeralByte = 1
|
||||
}
|
||||
|
||||
@ -101,12 +101,12 @@ func (w *WakuRelay) AddSignedTopicValidator(topic string, publicKey *ecdsa.Publi
|
||||
const messageWindowDuration = time.Minute * 5
|
||||
|
||||
func withinTimeWindow(t timesource.Timesource, msg *pb.WakuMessage) bool {
|
||||
if msg.Timestamp == 0 {
|
||||
if msg.GetTimestamp() == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
now := t.Now()
|
||||
msgTime := time.Unix(0, msg.Timestamp)
|
||||
msgTime := time.Unix(0, msg.GetTimestamp())
|
||||
|
||||
return now.Sub(msgTime).Abs() <= messageWindowDuration
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
proto "google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type FakeTimesource struct {
|
||||
@ -46,8 +47,8 @@ func TestMsgHash(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: payload,
|
||||
ContentTopic: contentTopic,
|
||||
Timestamp: timestamp.UnixNano(),
|
||||
Ephemeral: ephemeral,
|
||||
Timestamp: proto.Int64(timestamp.UnixNano()),
|
||||
Ephemeral: proto.Bool(ephemeral),
|
||||
}
|
||||
|
||||
err := SignMessage(prvKey, msg, protectedPubSubTopic)
|
||||
|
||||
@ -219,7 +219,7 @@ func (w *WakuRelay) subscribeToPubsubTopic(topic string) (subs *pubsub.Subscript
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w.log.Info("subscribing to topic", zap.String("topic", sub.Topic()))
|
||||
w.log.Info("gossipsub subscription", zap.String("pubsubTopic", sub.Topic()))
|
||||
}
|
||||
|
||||
return sub, nil
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"github.com/libp2p/go-libp2p/core/peerstore"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/waku-org/go-waku/logging"
|
||||
"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"
|
||||
@ -53,15 +54,13 @@ func TestWakuRelay(t *testing.T) {
|
||||
go func() {
|
||||
defer cancel()
|
||||
|
||||
msg := <-subs[0].Ch
|
||||
fmt.Println("msg received ", msg)
|
||||
env := <-subs[0].Ch
|
||||
t.Log("received msg", logging.HexString("hash", env.Hash()))
|
||||
}()
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: bytesToSend,
|
||||
Version: 0,
|
||||
ContentTopic: "test",
|
||||
Timestamp: 0,
|
||||
}
|
||||
_, err = relay.Publish(context.Background(), msg, WithPubSubTopic(testTopic))
|
||||
require.NoError(t, err)
|
||||
@ -194,7 +193,6 @@ func waitForMsg(t *testing.T, ch chan *protocol.Envelope, cTopicExpected string)
|
||||
defer wg.Done()
|
||||
select {
|
||||
case env := <-ch:
|
||||
fmt.Println("msg received", env)
|
||||
require.Equal(t, cTopicExpected, env.Message().GetContentTopic())
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Error("Message timeout")
|
||||
@ -251,9 +249,7 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
||||
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: bytesToSend,
|
||||
Version: 0,
|
||||
ContentTopic: testcTopic,
|
||||
Timestamp: 0,
|
||||
}
|
||||
_, err = relay.Publish(context.Background(), msg)
|
||||
require.NoError(t, err)
|
||||
@ -268,9 +264,7 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
||||
|
||||
msg1 := &pb.WakuMessage{
|
||||
Payload: bytesToSend,
|
||||
Version: 0,
|
||||
ContentTopic: testcTopic1,
|
||||
Timestamp: 0,
|
||||
}
|
||||
|
||||
_, err = relay.Publish(context.Background(), msg1, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
||||
@ -295,9 +289,8 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
||||
|
||||
msg2 := &pb.WakuMessage{
|
||||
Payload: bytesToSend,
|
||||
Version: 0,
|
||||
ContentTopic: testcTopic1,
|
||||
Timestamp: 1,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
|
||||
_, err = relay.Publish(context.Background(), msg2, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
||||
|
||||
@ -3,7 +3,9 @@ package rln
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
rlnpb "github.com/waku-org/go-waku/waku/v2/protocol/rln/pb"
|
||||
"github.com/waku-org/go-zerokit-rln/rln"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type messageValidationResult int
|
||||
@ -37,20 +39,27 @@ func toRLNSignal(wakuMessage *pb.WakuMessage) []byte {
|
||||
return append(wakuMessage.Payload, contentTopicBytes...)
|
||||
}
|
||||
|
||||
func toRateLimitProof(msg *pb.WakuMessage) *rln.RateLimitProof {
|
||||
if msg == nil || msg.RateLimitProof == nil {
|
||||
return nil
|
||||
// Bytres2RateLimitProof converts a slice of bytes into a RateLimitProof instance
|
||||
func BytesToRateLimitProof(data []byte) (*rln.RateLimitProof, error) {
|
||||
if data == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
rateLimitProof := &rlnpb.RateLimitProof{}
|
||||
err := proto.Unmarshal(data, rateLimitProof)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &rln.RateLimitProof{
|
||||
Proof: rln.ZKSNARK(rln.Bytes128(msg.RateLimitProof.Proof)),
|
||||
MerkleRoot: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.MerkleRoot)),
|
||||
Epoch: rln.Epoch(rln.Bytes32(msg.RateLimitProof.Epoch)),
|
||||
ShareX: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.ShareX)),
|
||||
ShareY: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.ShareY)),
|
||||
Nullifier: rln.Nullifier(rln.Bytes32(msg.RateLimitProof.Nullifier)),
|
||||
RLNIdentifier: rln.RLNIdentifier(rln.Bytes32(msg.RateLimitProof.RlnIdentifier)),
|
||||
Proof: rln.ZKSNARK(rln.Bytes128(rateLimitProof.Proof)),
|
||||
MerkleRoot: rln.MerkleNode(rln.Bytes32(rateLimitProof.MerkleRoot)),
|
||||
Epoch: rln.Epoch(rln.Bytes32(rateLimitProof.Epoch)),
|
||||
ShareX: rln.MerkleNode(rln.Bytes32(rateLimitProof.ShareX)),
|
||||
ShareY: rln.MerkleNode(rln.Bytes32(rateLimitProof.ShareY)),
|
||||
Nullifier: rln.Nullifier(rln.Bytes32(rateLimitProof.Nullifier)),
|
||||
RLNIdentifier: rln.RLNIdentifier(rln.Bytes32(rateLimitProof.RlnIdentifier)),
|
||||
}
|
||||
|
||||
return result
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@ -101,10 +101,11 @@ var (
|
||||
type invalidCategory string
|
||||
|
||||
var (
|
||||
invalidNoProof invalidCategory = "no_proof"
|
||||
invalidEpoch invalidCategory = "invalid_epoch"
|
||||
invalidRoot invalidCategory = "invalid_root"
|
||||
invalidProof invalidCategory = "invalid_proof"
|
||||
invalidNoProof invalidCategory = "no_proof"
|
||||
invalidEpoch invalidCategory = "invalid_epoch"
|
||||
invalidRoot invalidCategory = "invalid_root"
|
||||
invalidProof invalidCategory = "invalid_proof"
|
||||
proofExtractionErr invalidCategory = "invalid_proof_extract_err"
|
||||
)
|
||||
|
||||
// Metrics exposes the functions required to update prometheus metrics for lightpush protocol
|
||||
|
||||
3
waku/v2/protocol/rln/pb/generate.go
Normal file
3
waku/v2/protocol/rln/pb/generate.go
Normal file
@ -0,0 +1,3 @@
|
||||
package pb
|
||||
|
||||
//go:generate protoc -I./../../waku-proto/waku/rln/v1/. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mrln.proto=github.com/waku-org/go-waku/waku/v2/protocol/rln/pb --go_out=. ./../../waku-proto/waku/rln/v1/rln.proto
|
||||
202
waku/v2/protocol/rln/pb/rln.pb.go
Normal file
202
waku/v2/protocol/rln/pb/rln.pb.go
Normal file
@ -0,0 +1,202 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: rln.proto
|
||||
|
||||
// rfc: https://rfc.vac.dev/spec/17/
|
||||
|
||||
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 RateLimitProof struct {
|
||||
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 (x *RateLimitProof) Reset() {
|
||||
*x = RateLimitProof{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rln_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RateLimitProof) ProtoMessage() {}
|
||||
|
||||
func (x *RateLimitProof) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rln_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 RateLimitProof.ProtoReflect.Descriptor instead.
|
||||
func (*RateLimitProof) Descriptor() ([]byte, []int) {
|
||||
return file_rln_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetProof() []byte {
|
||||
if x != nil {
|
||||
return x.Proof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetMerkleRoot() []byte {
|
||||
if x != nil {
|
||||
return x.MerkleRoot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetEpoch() []byte {
|
||||
if x != nil {
|
||||
return x.Epoch
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetShareX() []byte {
|
||||
if x != nil {
|
||||
return x.ShareX
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetShareY() []byte {
|
||||
if x != nil {
|
||||
return x.ShareY
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetNullifier() []byte {
|
||||
if x != nil {
|
||||
return x.Nullifier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RateLimitProof) GetRlnIdentifier() []byte {
|
||||
if x != nil {
|
||||
return x.RlnIdentifier
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_rln_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rln_proto_rawDesc = []byte{
|
||||
0x0a, 0x09, 0x72, 0x6c, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x77, 0x61, 0x6b,
|
||||
0x75, 0x2e, 0x72, 0x6c, 0x6e, 0x2e, 0x76, 0x31, 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, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_rln_proto_rawDescOnce sync.Once
|
||||
file_rln_proto_rawDescData = file_rln_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_rln_proto_rawDescGZIP() []byte {
|
||||
file_rln_proto_rawDescOnce.Do(func() {
|
||||
file_rln_proto_rawDescData = protoimpl.X.CompressGZIP(file_rln_proto_rawDescData)
|
||||
})
|
||||
return file_rln_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rln_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_rln_proto_goTypes = []interface{}{
|
||||
(*RateLimitProof)(nil), // 0: waku.rln.v1.RateLimitProof
|
||||
}
|
||||
var file_rln_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_rln_proto_init() }
|
||||
func file_rln_proto_init() {
|
||||
if File_rln_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rln_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
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_rln_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_rln_proto_goTypes,
|
||||
DependencyIndexes: file_rln_proto_depIdxs,
|
||||
MessageInfos: file_rln_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rln_proto = out.File
|
||||
file_rln_proto_rawDesc = nil
|
||||
file_rln_proto_goTypes = nil
|
||||
file_rln_proto_depIdxs = nil
|
||||
}
|
||||
@ -13,9 +13,11 @@ import (
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/rln/group_manager"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/rln/group_manager/static"
|
||||
rlnpb "github.com/waku-org/go-waku/waku/v2/protocol/rln/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
r "github.com/waku-org/go-zerokit-rln/rln"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestWakuRLNRelaySuite(t *testing.T) {
|
||||
@ -114,13 +116,23 @@ func (s *WakuRLNRelaySuite) TestUpdateLogAndHasDuplicate() {
|
||||
shareY3[i] = shareX3[i]
|
||||
}
|
||||
|
||||
wm1 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier1[:], ShareX: shareX1[:], ShareY: shareY1[:]}}
|
||||
wm2 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier2[:], ShareX: shareX2[:], ShareY: shareY2[:]}}
|
||||
wm3 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier3[:], ShareX: shareX3[:], ShareY: shareY3[:]}}
|
||||
rlpProof1, err := proto.Marshal(&rlnpb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier1[:], ShareX: shareX1[:], ShareY: shareY1[:]})
|
||||
s.Require().NoError(err)
|
||||
|
||||
msgProof1 := toRateLimitProof(wm1)
|
||||
msgProof2 := toRateLimitProof(wm2)
|
||||
msgProof3 := toRateLimitProof(wm3)
|
||||
rlpProof2, err := proto.Marshal(&rlnpb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier2[:], ShareX: shareX2[:], ShareY: shareY2[:]})
|
||||
s.Require().NoError(err)
|
||||
|
||||
rlpProof3, err := proto.Marshal(&rlnpb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier3[:], ShareX: shareX3[:], ShareY: shareY3[:]})
|
||||
s.Require().NoError(err)
|
||||
|
||||
msgProof1, err := BytesToRateLimitProof(rlpProof1)
|
||||
s.Require().NoError(err)
|
||||
|
||||
msgProof2, err := BytesToRateLimitProof(rlpProof2)
|
||||
s.Require().NoError(err)
|
||||
|
||||
msgProof3, err := BytesToRateLimitProof(rlpProof3)
|
||||
s.Require().NoError(err)
|
||||
|
||||
md1, err := rlnInstance.ExtractMetadata(*msgProof1)
|
||||
s.Require().NoError(err)
|
||||
|
||||
@ -11,9 +11,11 @@ import (
|
||||
"github.com/waku-org/go-waku/logging"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol/rln/group_manager"
|
||||
rlnpb "github.com/waku-org/go-waku/waku/v2/protocol/rln/pb"
|
||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||
"github.com/waku-org/go-zerokit-rln/rln"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type WakuRLNRelay struct {
|
||||
@ -106,7 +108,12 @@ func (rlnRelay *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime
|
||||
epoch = rln.CalcEpoch(rlnRelay.timesource.Now())
|
||||
}
|
||||
|
||||
msgProof := toRateLimitProof(msg)
|
||||
msgProof, err := BytesToRateLimitProof(msg.RateLimitProof)
|
||||
if err != nil {
|
||||
rlnRelay.log.Debug("invalid message: could not extract proof", zap.Error(err))
|
||||
rlnRelay.metrics.RecordInvalidMessage(proofExtractionErr)
|
||||
}
|
||||
|
||||
if msgProof == nil {
|
||||
// message does not contain a proof
|
||||
rlnRelay.log.Debug("invalid message: message does not contain a proof")
|
||||
@ -133,7 +140,7 @@ func (rlnRelay *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime
|
||||
}
|
||||
|
||||
if !(rlnRelay.RootTracker.ContainsRoot(msgProof.MerkleRoot)) {
|
||||
rlnRelay.log.Debug("invalid message: unexpected root", logging.HexBytes("msgRoot", msg.RateLimitProof.MerkleRoot))
|
||||
rlnRelay.log.Debug("invalid message: unexpected root", logging.HexBytes("msgRoot", msgProof.MerkleRoot[:]))
|
||||
rlnRelay.metrics.RecordInvalidMessage(invalidRoot)
|
||||
return invalidMessage, nil
|
||||
}
|
||||
@ -206,7 +213,12 @@ func (rlnRelay *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTim
|
||||
}
|
||||
rlnRelay.metrics.RecordProofGeneration(time.Since(start))
|
||||
|
||||
msg.RateLimitProof = proof
|
||||
b, err := proto.Marshal(proof)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg.RateLimitProof = b
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -262,7 +274,7 @@ func (rlnRelay *WakuRLNRelay) Validator(
|
||||
}
|
||||
}
|
||||
|
||||
func (rlnRelay *WakuRLNRelay) generateProof(input []byte, epoch rln.Epoch) (*pb.RateLimitProof, error) {
|
||||
func (rlnRelay *WakuRLNRelay) generateProof(input []byte, epoch rln.Epoch) (*rlnpb.RateLimitProof, error) {
|
||||
identityCredentials, err := rlnRelay.GroupManager.IdentityCredentials()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -275,7 +287,7 @@ func (rlnRelay *WakuRLNRelay) generateProof(input []byte, epoch rln.Epoch) (*pb.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.RateLimitProof{
|
||||
return &rlnpb.RateLimitProof{
|
||||
Proof: proof.Proof[:],
|
||||
MerkleRoot: proof.MerkleRoot[:],
|
||||
Epoch: proof.Epoch[:],
|
||||
|
||||
@ -1,3 +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
|
||||
//go:generate protoc -I./../../waku-proto/waku/store/v2beta4//. -I./../../waku-proto/ --go_opt=paths=source_relative --go_opt=Mstore.proto=github.com/waku-org/go-waku/waku/v2/protocol/store/pb --go_opt=Mwaku/message/v1/message.proto=github.com/waku-org/go-waku/waku/v2/protocol/pb --go_out=. ./../../waku-proto/waku/store/v2beta4/store.proto
|
||||
|
||||
727
waku/v2/protocol/store/pb/store.pb.go
Normal file
727
waku/v2/protocol/store/pb/store.pb.go
Normal file
@ -0,0 +1,727 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v4.24.4
|
||||
// source: store.proto
|
||||
|
||||
// 13/WAKU2-STORE rfc: https://rfc.vac.dev/spec/13/
|
||||
// Protocol identifier: /vac/waku/store/2.0.0-beta4
|
||||
|
||||
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_store_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (PagingInfo_Direction) Type() protoreflect.EnumType {
|
||||
return &file_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_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_store_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (HistoryResponse_Error) Type() protoreflect.EnumType {
|
||||
return &file_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_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=receiver_time,json=receiverTime,proto3" json:"receiver_time,omitempty"`
|
||||
SenderTime int64 `protobuf:"zigzag64,3,opt,name=sender_time,json=senderTime,proto3" json:"sender_time,omitempty"`
|
||||
PubsubTopic string `protobuf:"bytes,4,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Index) Reset() {
|
||||
*x = Index{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
Cursor *Index `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"`
|
||||
Direction PagingInfo_Direction `protobuf:"varint,3,opt,name=direction,proto3,enum=waku.store.v2beta4.PagingInfo_Direction" json:"direction,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PagingInfo) Reset() {
|
||||
*x = PagingInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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=content_topic,json=contentTopic,proto3" json:"content_topic,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ContentFilter) Reset() {
|
||||
*x = ContentFilter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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
|
||||
|
||||
// The first field is reserved for future use
|
||||
PubsubTopic string `protobuf:"bytes,2,opt,name=pubsub_topic,json=pubsubTopic,proto3" json:"pubsub_topic,omitempty"`
|
||||
ContentFilters []*ContentFilter `protobuf:"bytes,3,rep,name=content_filters,json=contentFilters,proto3" json:"content_filters,omitempty"`
|
||||
PagingInfo *PagingInfo `protobuf:"bytes,4,opt,name=paging_info,json=pagingInfo,proto3" json:"paging_info,omitempty"`
|
||||
StartTime *int64 `protobuf:"zigzag64,5,opt,name=start_time,json=startTime,proto3,oneof" json:"start_time,omitempty"`
|
||||
EndTime *int64 `protobuf:"zigzag64,6,opt,name=end_time,json=endTime,proto3,oneof" json:"end_time,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HistoryQuery) Reset() {
|
||||
*x = HistoryQuery{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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 && x.StartTime != nil {
|
||||
return *x.StartTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *HistoryQuery) GetEndTime() int64 {
|
||||
if x != nil && x.EndTime != 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=paging_info,json=pagingInfo,proto3" json:"paging_info,omitempty"`
|
||||
Error HistoryResponse_Error `protobuf:"varint,4,opt,name=error,proto3,enum=waku.store.v2beta4.HistoryResponse_Error" json:"error,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HistoryResponse) Reset() {
|
||||
*x = HistoryResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_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_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_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_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_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_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_store_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_store_proto_rawDesc = []byte{
|
||||
0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x77,
|
||||
0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61,
|
||||
0x34, 0x1a, 0x1d, 0x77, 0x61, 0x6b, 0x75, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0x88, 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, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65,
|
||||
0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x12, 0x52, 0x0a, 0x73, 0x65,
|
||||
0x6e, 0x64, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73,
|
||||
0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x22, 0xcc, 0x01, 0x0a, 0x0a,
|
||||
0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x70,
|
||||
0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f,
|
||||
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x34, 0x2e, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x69,
|
||||
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e,
|
||||
0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||
0x61, 0x34, 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, 0x34, 0x0a, 0x0d, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 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, 0x9e, 0x02, 0x0a, 0x0c, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x51, 0x75, 0x65, 0x72,
|
||||
0x79, 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, 0x12, 0x4a, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f,
|
||||
0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e,
|
||||
0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||
0x61, 0x34, 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, 0x3f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x34, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e,
|
||||
0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x12, 0x22, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x12, 0x48, 0x00, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x12, 0x48, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x22, 0xf4, 0x01, 0x0a, 0x0f, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12,
|
||||
0x3f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x34, 0x2e, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x12, 0x3f, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x29, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x62,
|
||||
0x65, 0x74, 0x61, 0x34, 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, 0xa4, 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, 0x36, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x65, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x34, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x3f,
|
||||
0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x23, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32,
|
||||
0x62, 0x65, 0x74, 0x61, 0x34, 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_store_proto_rawDescOnce sync.Once
|
||||
file_store_proto_rawDescData = file_store_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_store_proto_rawDescGZIP() []byte {
|
||||
file_store_proto_rawDescOnce.Do(func() {
|
||||
file_store_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_proto_rawDescData)
|
||||
})
|
||||
return file_store_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_store_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_store_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_store_proto_goTypes = []interface{}{
|
||||
(PagingInfo_Direction)(0), // 0: waku.store.v2beta4.PagingInfo.Direction
|
||||
(HistoryResponse_Error)(0), // 1: waku.store.v2beta4.HistoryResponse.Error
|
||||
(*Index)(nil), // 2: waku.store.v2beta4.Index
|
||||
(*PagingInfo)(nil), // 3: waku.store.v2beta4.PagingInfo
|
||||
(*ContentFilter)(nil), // 4: waku.store.v2beta4.ContentFilter
|
||||
(*HistoryQuery)(nil), // 5: waku.store.v2beta4.HistoryQuery
|
||||
(*HistoryResponse)(nil), // 6: waku.store.v2beta4.HistoryResponse
|
||||
(*HistoryRPC)(nil), // 7: waku.store.v2beta4.HistoryRPC
|
||||
(*pb.WakuMessage)(nil), // 8: waku.message.v1.WakuMessage
|
||||
}
|
||||
var file_store_proto_depIdxs = []int32{
|
||||
2, // 0: waku.store.v2beta4.PagingInfo.cursor:type_name -> waku.store.v2beta4.Index
|
||||
0, // 1: waku.store.v2beta4.PagingInfo.direction:type_name -> waku.store.v2beta4.PagingInfo.Direction
|
||||
4, // 2: waku.store.v2beta4.HistoryQuery.content_filters:type_name -> waku.store.v2beta4.ContentFilter
|
||||
3, // 3: waku.store.v2beta4.HistoryQuery.paging_info:type_name -> waku.store.v2beta4.PagingInfo
|
||||
8, // 4: waku.store.v2beta4.HistoryResponse.messages:type_name -> waku.message.v1.WakuMessage
|
||||
3, // 5: waku.store.v2beta4.HistoryResponse.paging_info:type_name -> waku.store.v2beta4.PagingInfo
|
||||
1, // 6: waku.store.v2beta4.HistoryResponse.error:type_name -> waku.store.v2beta4.HistoryResponse.Error
|
||||
5, // 7: waku.store.v2beta4.HistoryRPC.query:type_name -> waku.store.v2beta4.HistoryQuery
|
||||
6, // 8: waku.store.v2beta4.HistoryRPC.response:type_name -> waku.store.v2beta4.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_store_proto_init() }
|
||||
func file_store_proto_init() {
|
||||
if File_store_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_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_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_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_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_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_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
|
||||
}
|
||||
}
|
||||
}
|
||||
file_store_proto_msgTypes[3].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_store_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_store_proto_goTypes,
|
||||
DependencyIndexes: file_store_proto_depIdxs,
|
||||
EnumInfos: file_store_proto_enumTypes,
|
||||
MessageInfos: file_store_proto_msgTypes,
|
||||
}.Build()
|
||||
File_store_proto = out.File
|
||||
file_store_proto_rawDesc = nil
|
||||
file_store_proto_goTypes = nil
|
||||
file_store_proto_depIdxs = nil
|
||||
}
|
||||
@ -1,709 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
import "waku_message.proto";
|
||||
|
||||
message Index {
|
||||
bytes digest = 1;
|
||||
sint64 receiverTime = 2;
|
||||
sint64 senderTime = 3;
|
||||
string pubsubTopic = 4;
|
||||
}
|
||||
|
||||
message PagingInfo {
|
||||
uint64 pageSize = 1;
|
||||
Index cursor = 2;
|
||||
enum Direction {
|
||||
BACKWARD = 0;
|
||||
FORWARD = 1;
|
||||
}
|
||||
Direction direction = 3;
|
||||
}
|
||||
|
||||
message ContentFilter {
|
||||
string contentTopic = 1;
|
||||
}
|
||||
|
||||
message HistoryQuery {
|
||||
string pubsubTopic = 2;
|
||||
repeated ContentFilter contentFilters = 3;
|
||||
PagingInfo pagingInfo = 4; // used for pagination
|
||||
sint64 startTime = 5;
|
||||
sint64 endTime = 6;
|
||||
}
|
||||
|
||||
message HistoryResponse {
|
||||
// the first field is reserved for future use
|
||||
repeated WakuMessage messages = 2;
|
||||
PagingInfo pagingInfo = 3;
|
||||
enum Error {
|
||||
NONE = 0;
|
||||
INVALID_CURSOR = 1;
|
||||
}
|
||||
Error error = 4;
|
||||
}
|
||||
|
||||
message HistoryRPC {
|
||||
string request_id = 1;
|
||||
HistoryQuery query = 2;
|
||||
HistoryResponse response = 3;
|
||||
}
|
||||
@ -15,15 +15,16 @@ import (
|
||||
"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"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestFindLastSeenMessage(t *testing.T) {
|
||||
now := utils.GetUnixEpoch()
|
||||
msg1 := protocol.NewEnvelope(tests.CreateWakuMessage("1", now+1), utils.GetUnixEpoch(), "test")
|
||||
msg2 := protocol.NewEnvelope(tests.CreateWakuMessage("2", now+2), utils.GetUnixEpoch(), "test")
|
||||
msg3 := protocol.NewEnvelope(tests.CreateWakuMessage("3", now+3), utils.GetUnixEpoch(), "test")
|
||||
msg4 := protocol.NewEnvelope(tests.CreateWakuMessage("4", now+4), utils.GetUnixEpoch(), "test")
|
||||
msg5 := protocol.NewEnvelope(tests.CreateWakuMessage("5", now+5), utils.GetUnixEpoch(), "test")
|
||||
now := *utils.GetUnixEpoch()
|
||||
msg1 := protocol.NewEnvelope(tests.CreateWakuMessage("1", proto.Int64(now+1)), *utils.GetUnixEpoch(), "test")
|
||||
msg2 := protocol.NewEnvelope(tests.CreateWakuMessage("2", proto.Int64(now+2)), *utils.GetUnixEpoch(), "test")
|
||||
msg3 := protocol.NewEnvelope(tests.CreateWakuMessage("3", proto.Int64(now+3)), *utils.GetUnixEpoch(), "test")
|
||||
msg4 := protocol.NewEnvelope(tests.CreateWakuMessage("4", proto.Int64(now+4)), *utils.GetUnixEpoch(), "test")
|
||||
msg5 := protocol.NewEnvelope(tests.CreateWakuMessage("5", proto.Int64(now+5)), *utils.GetUnixEpoch(), "test")
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
_ = s.storeMessage(msg1)
|
||||
@ -35,7 +36,7 @@ func TestFindLastSeenMessage(t *testing.T) {
|
||||
lastSeen, err := s.findLastSeen()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, msg5.Message().Timestamp, lastSeen)
|
||||
require.Equal(t, msg5.Message().GetTimestamp(), lastSeen)
|
||||
}
|
||||
|
||||
func TestResume(t *testing.T) {
|
||||
@ -53,15 +54,15 @@ func TestResume(t *testing.T) {
|
||||
|
||||
defer s1.Stop()
|
||||
|
||||
now := utils.GetUnixEpoch()
|
||||
for i := 0; i < 10; i++ {
|
||||
now := *utils.GetUnixEpoch()
|
||||
for i := int64(0); i < 10; i++ {
|
||||
var contentTopic = "1"
|
||||
if i%2 == 0 {
|
||||
contentTopic = "2"
|
||||
}
|
||||
|
||||
wakuMessage := tests.CreateWakuMessage(contentTopic, now+int64(i+1))
|
||||
msg := protocol.NewEnvelope(wakuMessage, utils.GetUnixEpoch(), "test")
|
||||
wakuMessage := tests.CreateWakuMessage(contentTopic, proto.Int64(now+i+1))
|
||||
msg := protocol.NewEnvelope(wakuMessage, *utils.GetUnixEpoch(), "test")
|
||||
_ = s1.storeMessage(msg)
|
||||
}
|
||||
|
||||
@ -117,9 +118,9 @@ func TestResumeWithListOfPeers(t *testing.T) {
|
||||
|
||||
defer s1.Stop()
|
||||
|
||||
msg0 := &pb.WakuMessage{Payload: []byte{1, 2, 3}, ContentTopic: "2", Version: 0, Timestamp: utils.GetUnixEpoch()}
|
||||
msg0 := &pb.WakuMessage{Payload: []byte{1, 2, 3}, ContentTopic: "2", Timestamp: utils.GetUnixEpoch()}
|
||||
|
||||
_ = s1.storeMessage(protocol.NewEnvelope(msg0, utils.GetUnixEpoch(), "test"))
|
||||
_ = s1.storeMessage(protocol.NewEnvelope(msg0, *utils.GetUnixEpoch(), "test"))
|
||||
|
||||
host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
|
||||
require.NoError(t, err)
|
||||
@ -162,9 +163,9 @@ func TestResumeWithoutSpecifyingPeer(t *testing.T) {
|
||||
|
||||
defer s1.Stop()
|
||||
|
||||
msg0 := &pb.WakuMessage{Payload: []byte{1, 2, 3}, ContentTopic: "2", Version: 0, Timestamp: 0}
|
||||
msg0 := &pb.WakuMessage{Payload: []byte{1, 2, 3}, ContentTopic: "2"}
|
||||
|
||||
_ = s1.storeMessage(protocol.NewEnvelope(msg0, utils.GetUnixEpoch(), "test"))
|
||||
_ = s1.storeMessage(protocol.NewEnvelope(msg0, *utils.GetUnixEpoch(), "test"))
|
||||
|
||||
host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -20,8 +20,8 @@ import (
|
||||
type Query struct {
|
||||
Topic string
|
||||
ContentTopics []string
|
||||
StartTime int64
|
||||
EndTime int64
|
||||
StartTime *int64
|
||||
EndTime *int64
|
||||
}
|
||||
|
||||
// Result represents a valid response from a store node
|
||||
@ -247,7 +247,6 @@ func (store *WakuStore) localQuery(historyQuery *pb.HistoryRPC) (*pb.HistoryResp
|
||||
}
|
||||
|
||||
func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error) {
|
||||
|
||||
params := new(HistoryRequestParameters)
|
||||
params.s = store
|
||||
|
||||
|
||||
@ -19,36 +19,36 @@ func TestIndexComputation(t *testing.T) {
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
|
||||
idx := protocol.NewEnvelope(msg, utils.GetUnixEpoch(), "test").Index()
|
||||
idx := protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), "test").Index()
|
||||
require.NotZero(t, idx.ReceiverTime)
|
||||
require.Equal(t, msg.Timestamp, idx.SenderTime)
|
||||
require.Equal(t, msg.GetTimestamp(), idx.SenderTime)
|
||||
require.NotZero(t, idx.Digest)
|
||||
require.Len(t, idx.Digest, 32)
|
||||
|
||||
msg1 := &wpb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
Timestamp: 123,
|
||||
Timestamp: proto.Int64(123),
|
||||
ContentTopic: testContentTopic,
|
||||
}
|
||||
idx1 := protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), "test").Index()
|
||||
idx1 := protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), "test").Index()
|
||||
|
||||
msg2 := &wpb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
Timestamp: 123,
|
||||
Timestamp: proto.Int64(123),
|
||||
ContentTopic: testContentTopic,
|
||||
}
|
||||
idx2 := protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), "test").Index()
|
||||
idx2 := protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), "test").Index()
|
||||
|
||||
require.Equal(t, idx1.Digest, idx2.Digest)
|
||||
}
|
||||
|
||||
func createSampleList(s int) []*protocol.Envelope {
|
||||
var result []*protocol.Envelope
|
||||
for i := 0; i < s; i++ {
|
||||
for i := 1; i <= s; i++ {
|
||||
msg :=
|
||||
&wpb.WakuMessage{
|
||||
Payload: []byte{byte(i)},
|
||||
Timestamp: int64(i),
|
||||
Timestamp: proto.Int64(int64(i)),
|
||||
}
|
||||
result = append(result, protocol.NewEnvelope(msg, int64(i), "abc"))
|
||||
}
|
||||
@ -77,6 +77,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, msgList[0].Message(), messages[0])
|
||||
|
||||
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)
|
||||
@ -120,7 +122,7 @@ func TestForwardPagination(t *testing.T) {
|
||||
require.Nil(t, newPagingInfo.Cursor)
|
||||
|
||||
// test for an invalid cursor
|
||||
invalidIndex := protocol.NewEnvelope(&wpb.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)
|
||||
@ -207,7 +209,7 @@ func TestBackwardPagination(t *testing.T) {
|
||||
require.Nil(t, newPagingInfo.Cursor)
|
||||
|
||||
// test for an invalid cursor
|
||||
invalidIndex := protocol.NewEnvelope(&wpb.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)
|
||||
|
||||
@ -22,20 +22,18 @@ func TestStorePersistence(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: defaultContentTopic,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
err := s1.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
err := s1.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
require.NoError(t, err)
|
||||
|
||||
msg2 := &pb.WakuMessage{
|
||||
Payload: []byte{4, 5, 6},
|
||||
ContentTopic: defaultContentTopic,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
Ephemeral: true, // Should not insert this message
|
||||
Ephemeral: proto.Bool(true), // Should not insert this message
|
||||
}
|
||||
err = s1.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
err = s1.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
require.NoError(t, err)
|
||||
|
||||
allMsgs, err := db.GetAll()
|
||||
@ -44,6 +42,6 @@ func TestStorePersistence(t *testing.T) {
|
||||
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))
|
||||
err = s1.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ func (store *WakuStore) Start(ctx context.Context, sub *relay.Subscription) erro
|
||||
|
||||
func (store *WakuStore) storeMessage(env *protocol.Envelope) error {
|
||||
|
||||
if env.Message().Ephemeral {
|
||||
if env.Message().GetEphemeral() {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -337,8 +337,8 @@ func (store *WakuStore) Resume(ctx context.Context, pubsubTopic string, peerList
|
||||
|
||||
rpc := &pb.HistoryQuery{
|
||||
PubsubTopic: pubsubTopic,
|
||||
StartTime: lastSeenTime,
|
||||
EndTime: currentTime,
|
||||
StartTime: &lastSeenTime,
|
||||
EndTime: ¤tTime,
|
||||
PagingInfo: &pb.PagingInfo{
|
||||
PageSize: 0,
|
||||
Direction: pb.PagingInfo_BACKWARD,
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
"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"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// SimulateSubscription creates a subscription for a list of envelopes
|
||||
@ -46,12 +47,11 @@ func TestWakuStoreProtocolQuery(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: topic1,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
|
||||
// Simulate a message has been received via relay protocol
|
||||
sub := SimulateSubscription([]*protocol.Envelope{protocol.NewEnvelope(msg, utils.GetUnixEpoch(), pubsubTopic1)})
|
||||
sub := SimulateSubscription([]*protocol.Envelope{protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), pubsubTopic1)})
|
||||
err = s1.Start(ctx, sub)
|
||||
require.NoError(t, err)
|
||||
defer s1.Stop()
|
||||
@ -98,12 +98,11 @@ func TestWakuStoreProtocolLocalQuery(t *testing.T) {
|
||||
msg := &pb.WakuMessage{
|
||||
Payload: []byte{1, 2, 3},
|
||||
ContentTopic: topic1,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
|
||||
// Simulate a message has been received via relay protocol
|
||||
sub := SimulateSubscription([]*protocol.Envelope{protocol.NewEnvelope(msg, utils.GetUnixEpoch(), pubsubTopic1)})
|
||||
sub := SimulateSubscription([]*protocol.Envelope{protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), pubsubTopic1)})
|
||||
err = s1.Start(ctx, sub)
|
||||
require.NoError(t, err)
|
||||
defer s1.Stop()
|
||||
@ -135,19 +134,19 @@ func TestWakuStoreProtocolNext(t *testing.T) {
|
||||
topic1 := "1"
|
||||
pubsubTopic1 := "topic1"
|
||||
|
||||
now := utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, now+1)
|
||||
msg2 := tests.CreateWakuMessage(topic1, now+2)
|
||||
msg3 := tests.CreateWakuMessage(topic1, now+3)
|
||||
msg4 := tests.CreateWakuMessage(topic1, now+4)
|
||||
msg5 := tests.CreateWakuMessage(topic1, now+5)
|
||||
now := *utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, proto.Int64(now+1))
|
||||
msg2 := tests.CreateWakuMessage(topic1, proto.Int64(now+2))
|
||||
msg3 := tests.CreateWakuMessage(topic1, proto.Int64(now+3))
|
||||
msg4 := tests.CreateWakuMessage(topic1, proto.Int64(now+4))
|
||||
msg5 := tests.CreateWakuMessage(topic1, proto.Int64(now+5))
|
||||
|
||||
sub := SimulateSubscription([]*protocol.Envelope{
|
||||
protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
})
|
||||
err = s1.Start(ctx, sub)
|
||||
require.NoError(t, err)
|
||||
@ -212,19 +211,19 @@ func TestWakuStoreResult(t *testing.T) {
|
||||
topic1 := "1"
|
||||
pubsubTopic1 := "topic1"
|
||||
|
||||
now := utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, now+1)
|
||||
msg2 := tests.CreateWakuMessage(topic1, now+2)
|
||||
msg3 := tests.CreateWakuMessage(topic1, now+3)
|
||||
msg4 := tests.CreateWakuMessage(topic1, now+4)
|
||||
msg5 := tests.CreateWakuMessage(topic1, now+5)
|
||||
now := *utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, proto.Int64(now+1))
|
||||
msg2 := tests.CreateWakuMessage(topic1, proto.Int64(now+2))
|
||||
msg3 := tests.CreateWakuMessage(topic1, proto.Int64(now+3))
|
||||
msg4 := tests.CreateWakuMessage(topic1, proto.Int64(now+4))
|
||||
msg5 := tests.CreateWakuMessage(topic1, proto.Int64(now+5))
|
||||
|
||||
sub := SimulateSubscription([]*protocol.Envelope{
|
||||
protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
})
|
||||
err = s1.Start(ctx, sub)
|
||||
require.NoError(t, err)
|
||||
@ -304,27 +303,27 @@ func TestWakuStoreProtocolFind(t *testing.T) {
|
||||
topic1 := "1"
|
||||
pubsubTopic1 := "topic1"
|
||||
|
||||
now := utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, now+1)
|
||||
msg2 := tests.CreateWakuMessage(topic1, now+2)
|
||||
msg3 := tests.CreateWakuMessage(topic1, now+3)
|
||||
msg4 := tests.CreateWakuMessage(topic1, now+4)
|
||||
msg5 := tests.CreateWakuMessage(topic1, now+5)
|
||||
msg6 := tests.CreateWakuMessage(topic1, now+6)
|
||||
msg7 := tests.CreateWakuMessage("hello", now+7)
|
||||
msg8 := tests.CreateWakuMessage(topic1, now+8)
|
||||
msg9 := tests.CreateWakuMessage(topic1, now+9)
|
||||
now := *utils.GetUnixEpoch()
|
||||
msg1 := tests.CreateWakuMessage(topic1, proto.Int64(now+1))
|
||||
msg2 := tests.CreateWakuMessage(topic1, proto.Int64(now+2))
|
||||
msg3 := tests.CreateWakuMessage(topic1, proto.Int64(now+3))
|
||||
msg4 := tests.CreateWakuMessage(topic1, proto.Int64(now+4))
|
||||
msg5 := tests.CreateWakuMessage(topic1, proto.Int64(now+5))
|
||||
msg6 := tests.CreateWakuMessage(topic1, proto.Int64(now+6))
|
||||
msg7 := tests.CreateWakuMessage("hello", proto.Int64(now+7))
|
||||
msg8 := tests.CreateWakuMessage(topic1, proto.Int64(now+8))
|
||||
msg9 := tests.CreateWakuMessage(topic1, proto.Int64(now+9))
|
||||
|
||||
sub := SimulateSubscription([]*protocol.Envelope{
|
||||
protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg6, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg7, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg8, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg9, utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg4, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg5, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg6, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg7, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg8, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
protocol.NewEnvelope(msg9, *utils.GetUnixEpoch(), pubsubTopic1),
|
||||
})
|
||||
err = s1.Start(ctx, sub)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -23,8 +23,8 @@ func TestStoreQuery(t *testing.T) {
|
||||
msg2 := tests.CreateWakuMessage("2", utils.GetUnixEpoch())
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
ContentFilters: []*pb.ContentFilter{
|
||||
@ -50,9 +50,9 @@ func TestStoreQueryMultipleContentFilters(t *testing.T) {
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
ContentFilters: []*pb.ContentFilter{
|
||||
@ -82,9 +82,9 @@ func TestStoreQueryPubsubTopicFilter(t *testing.T) {
|
||||
msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch())
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic2))
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
PubsubTopic: pubsubTopic1,
|
||||
@ -114,9 +114,9 @@ func TestStoreQueryPubsubTopicNoMatch(t *testing.T) {
|
||||
msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch())
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic2))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic2))
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
PubsubTopic: pubsubTopic1,
|
||||
@ -136,9 +136,9 @@ func TestStoreQueryPubsubTopicAllMessages(t *testing.T) {
|
||||
msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch())
|
||||
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg2, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
PubsubTopic: pubsubTopic1,
|
||||
@ -158,7 +158,7 @@ func TestStoreQueryForwardPagination(t *testing.T) {
|
||||
for i := 0; i < 10; i++ {
|
||||
msg := tests.CreateWakuMessage(topic1, utils.GetUnixEpoch())
|
||||
msg.Payload = []byte{byte(i)}
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
}
|
||||
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
@ -183,10 +183,9 @@ func TestStoreQueryBackwardPagination(t *testing.T) {
|
||||
msg := &wpb.WakuMessage{
|
||||
Payload: []byte{byte(i)},
|
||||
ContentTopic: topic1,
|
||||
Version: 0,
|
||||
Timestamp: utils.GetUnixEpoch(),
|
||||
}
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), pubsubTopic1))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||
|
||||
}
|
||||
|
||||
@ -207,22 +206,22 @@ func TestTemporalHistoryQueries(t *testing.T) {
|
||||
s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||
|
||||
var messages []*wpb.WakuMessage
|
||||
now := utils.GetUnixEpoch()
|
||||
for i := 0; i < 10; i++ {
|
||||
now := *utils.GetUnixEpoch()
|
||||
for i := int64(0); i < 10; i++ {
|
||||
contentTopic := "1"
|
||||
if i%2 == 0 {
|
||||
contentTopic = "2"
|
||||
}
|
||||
msg := tests.CreateWakuMessage(contentTopic, now+int64(i))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), "test"))
|
||||
msg := tests.CreateWakuMessage(contentTopic, proto.Int64(now+i))
|
||||
_ = s.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), "test"))
|
||||
messages = append(messages, msg)
|
||||
}
|
||||
|
||||
// handle temporal history query with a valid time window
|
||||
response := s.FindMessages(&pb.HistoryQuery{
|
||||
ContentFilters: []*pb.ContentFilter{{ContentTopic: "1"}},
|
||||
StartTime: now + 2,
|
||||
EndTime: now + 5,
|
||||
StartTime: proto.Int64(now + 2),
|
||||
EndTime: proto.Int64(now + 5),
|
||||
})
|
||||
|
||||
require.Len(t, response.Messages, 2)
|
||||
@ -232,8 +231,8 @@ func TestTemporalHistoryQueries(t *testing.T) {
|
||||
// handle temporal history query with a zero-size time window
|
||||
response = s.FindMessages(&pb.HistoryQuery{
|
||||
ContentFilters: []*pb.ContentFilter{{ContentTopic: "1"}},
|
||||
StartTime: now + 2,
|
||||
EndTime: now + 2,
|
||||
StartTime: proto.Int64(now + 2),
|
||||
EndTime: proto.Int64(now + 2),
|
||||
})
|
||||
|
||||
require.Len(t, response.Messages, 0)
|
||||
@ -241,8 +240,8 @@ func TestTemporalHistoryQueries(t *testing.T) {
|
||||
// handle temporal history query with an invalid time window
|
||||
response = s.FindMessages(&pb.HistoryQuery{
|
||||
ContentFilters: []*pb.ContentFilter{{ContentTopic: "1"}},
|
||||
StartTime: now + 5,
|
||||
EndTime: now + 2,
|
||||
StartTime: proto.Int64(now + 5),
|
||||
EndTime: proto.Int64(now + 2),
|
||||
})
|
||||
// time window is invalid since start time > end time
|
||||
// perhaps it should return an error?
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"github.com/waku-org/go-waku/tests"
|
||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const PUBSUB_TOPIC = "/test/topic"
|
||||
@ -151,7 +152,7 @@ func TestSubscriptionsNotify(t *testing.T) {
|
||||
go failOnReceive(ctx, 2)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
envTopic1Ct1 := protocol.NewEnvelope(tests.CreateWakuMessage("ct1", 0), 0, PUBSUB_TOPIC+"1")
|
||||
envTopic1Ct1 := protocol.NewEnvelope(tests.CreateWakuMessage("ct1", nil), 0, PUBSUB_TOPIC+"1")
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
@ -175,7 +176,7 @@ func TestSubscriptionsNotify(t *testing.T) {
|
||||
go failOnReceive(ctx, 2)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
envTopic1Ct2 := protocol.NewEnvelope(tests.CreateWakuMessage("ct2", 0), 0, PUBSUB_TOPIC+"1")
|
||||
envTopic1Ct2 := protocol.NewEnvelope(tests.CreateWakuMessage("ct2", nil), 0, PUBSUB_TOPIC+"1")
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
@ -204,7 +205,7 @@ func TestSubscriptionsNotify(t *testing.T) {
|
||||
go failOnReceive(ctx, 2)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
envTopic1Ct1_2 := protocol.NewEnvelope(tests.CreateWakuMessage("ct1", 1), 1, PUBSUB_TOPIC+"1")
|
||||
envTopic1Ct1_2 := protocol.NewEnvelope(tests.CreateWakuMessage("ct1", proto.Int64(1)), 1, PUBSUB_TOPIC+"1")
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
|
||||
1
waku/v2/protocol/waku-proto
Submodule
1
waku/v2/protocol/waku-proto
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit eb17d5032f3296e7cf9e7c6d3e383f12e7956909
|
||||
@ -2,11 +2,13 @@ package utils
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// GetUnixEpochFrom converts a time into a unix timestamp with nanoseconds
|
||||
func GetUnixEpochFrom(now time.Time) int64 {
|
||||
return now.UnixNano()
|
||||
func GetUnixEpochFrom(now time.Time) *int64 {
|
||||
return proto.Int64(now.UnixNano())
|
||||
}
|
||||
|
||||
type Timesource interface {
|
||||
@ -16,7 +18,7 @@ type Timesource interface {
|
||||
// GetUnixEpoch returns the current time in unix timestamp with the integer part
|
||||
// representing seconds and the decimal part representing subseconds.
|
||||
// Optionally receives a timesource to obtain the time from
|
||||
func GetUnixEpoch(timesource ...Timesource) int64 {
|
||||
func GetUnixEpoch(timesource ...Timesource) *int64 {
|
||||
if len(timesource) != 0 {
|
||||
return GetUnixEpochFrom(timesource[0].Now())
|
||||
}
|
||||
|
||||
@ -5,12 +5,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestGetUnixEpochFrom(t *testing.T) {
|
||||
loc := time.UTC
|
||||
timestamp := GetUnixEpochFrom(time.Date(2019, 1, 1, 0, 0, 0, 0, loc))
|
||||
require.Equal(t, int64(1546300800*time.Second), timestamp)
|
||||
require.Equal(t, proto.Int64(int64(1546300800*time.Second)), timestamp)
|
||||
|
||||
timestamp = GetUnixEpoch()
|
||||
require.NotNil(t, timestamp)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user