mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-06-06 18:49:49 +00:00
Merge branch 'master' into feat/autoshard-store-api
This commit is contained in:
commit
1dab4ff76e
40
.github/workflows/lint_pr.yml
vendored
Normal file
40
.github/workflows/lint_pr.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: "Lint PR"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
name: Validate PR title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
# When the previous steps fails, the workflow would stop. By adding this
|
||||||
|
# condition you can continue the execution with the populated error message.
|
||||||
|
if: always() && (steps.lint_pr_title.outputs.error_message != null)
|
||||||
|
with:
|
||||||
|
header: pr-title-lint-error
|
||||||
|
message: |
|
||||||
|
Hey there and thank you for opening this pull request! 👋🏼
|
||||||
|
|
||||||
|
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
|
||||||
|
|
||||||
|
Details:
|
||||||
|
|
||||||
|
> ${{ steps.lint_pr_title.outputs.error_message }}
|
||||||
|
|
||||||
|
# Delete a previous comment when the issue has been resolved
|
||||||
|
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
header: pr-title-lint-error
|
||||||
|
delete: true
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "libs/waku-rln-contract"]
|
[submodule "libs/waku-rln-contract"]
|
||||||
path = libs/waku-rln-contract
|
path = libs/waku-rln-contract
|
||||||
url = https://github.com/waku-org/waku-rln-contract.git
|
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/go-chi/chi/v5"
|
||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"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/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/peermanager"
|
"github.com/waku-org/go-waku/waku/v2/peermanager"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
@ -241,7 +242,7 @@ func (s *FilterService) unsubscribeGetMessage(result *filter.WakuFilterPushResul
|
|||||||
ind := 0
|
ind := 0
|
||||||
for _, entry := range result.Errors() {
|
for _, entry := range result.Errors() {
|
||||||
if entry.Err != nil {
|
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 {
|
if ind != 0 {
|
||||||
peerIds += ", "
|
peerIds += ", "
|
||||||
}
|
}
|
||||||
|
|||||||
@ -387,7 +387,6 @@ func genMessage(pubsubTopic, contentTopic string) *protocol.Envelope {
|
|||||||
&pb.WakuMessage{
|
&pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: contentTopic,
|
ContentTopic: contentTopic,
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
|
|||||||
@ -49,7 +49,6 @@ func TestLightpushMessagev1(t *testing.T) {
|
|||||||
Message: &pb.WakuMessage{
|
Message: &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "abc",
|
ContentTopic: "abc",
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ func (r *RelayService) postV1Subscriptions(w http.ResponseWriter, req *http.Requ
|
|||||||
} else {
|
} else {
|
||||||
topicToSubscribe = topic
|
topicToSubscribe = topic
|
||||||
}
|
}
|
||||||
_, err = r.node.Relay().Subscribe(req.Context(), protocol.NewContentFilter(topicToSubscribe), relay.WithCacheSize(r.cacheCapacity))
|
_, err = r.node.Relay().Subscribe(r.node.Relay().Context(), protocol.NewContentFilter(topicToSubscribe), relay.WithCacheSize(r.cacheCapacity))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.log.Error("subscribing to topic", zap.String("topic", strings.Replace(topicToSubscribe, "\n", "", -1)), zap.Error(err))
|
r.log.Error("subscribing to topic", zap.String("topic", strings.Replace(topicToSubscribe, "\n", "", -1)), zap.Error(err))
|
||||||
@ -126,7 +126,16 @@ func (r *RelayService) getV1Messages(w http.ResponseWriter, req *http.Request) {
|
|||||||
}
|
}
|
||||||
var response []*pb.WakuMessage
|
var response []*pb.WakuMessage
|
||||||
select {
|
select {
|
||||||
case msg := <-sub.Ch:
|
case msg, open := <-sub.Ch:
|
||||||
|
if !open {
|
||||||
|
r.log.Error("consume channel is closed for subscription", zap.String("pubsubTopic", topic))
|
||||||
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
_, err = w.Write([]byte("consume channel is closed for subscription"))
|
||||||
|
if err != nil {
|
||||||
|
r.log.Error("writing response", zap.Error(err))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
response = append(response, msg.Message())
|
response = append(response, msg.Message())
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeRelayService(t *testing.T, mux *chi.Mux) *RelayService {
|
func makeRelayService(t *testing.T, mux *chi.Mux) *RelayService {
|
||||||
@ -38,7 +39,6 @@ func TestPostV1Message(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "abc",
|
ContentTopic: "abc",
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
msgJSONBytes, err := json.Marshal(msg)
|
msgJSONBytes, err := json.Marshal(msg)
|
||||||
@ -70,16 +70,16 @@ func TestRelaySubscription(t *testing.T) {
|
|||||||
require.Equal(t, "true", rr.Body.String())
|
require.Equal(t, "true", rr.Body.String())
|
||||||
|
|
||||||
// Test max messages in subscription
|
// Test max messages in subscription
|
||||||
now := utils.GetUnixEpoch()
|
now := *utils.GetUnixEpoch()
|
||||||
_, err = r.node.Relay().Publish(context.Background(),
|
_, 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)
|
require.NoError(t, err)
|
||||||
_, err = r.node.Relay().Publish(context.Background(),
|
_, 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)
|
require.NoError(t, err)
|
||||||
|
|
||||||
_, err = r.node.Relay().Publish(context.Background(),
|
_, 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)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Wait for the messages to be processed
|
// Wait for the messages to be processed
|
||||||
@ -130,7 +130,6 @@ func TestRelayGetV1Messages(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "test",
|
ContentTopic: "test",
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
msgJsonBytes, err := json.Marshal(msg)
|
msgJsonBytes, err := json.Marshal(msg)
|
||||||
@ -168,7 +167,6 @@ func TestPostAutoV1Message(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "/toychat/1/huilong/proto",
|
ContentTopic: "/toychat/1/huilong/proto",
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
msgJSONBytes, err := json.Marshal(msg)
|
msgJSONBytes, err := json.Marshal(msg)
|
||||||
@ -201,9 +199,9 @@ func TestRelayAutoSubUnsub(t *testing.T) {
|
|||||||
require.Equal(t, "true", rr.Body.String())
|
require.Equal(t, "true", rr.Body.String())
|
||||||
|
|
||||||
// Test publishing messages after subscription
|
// Test publishing messages after subscription
|
||||||
now := utils.GetUnixEpoch()
|
now := *utils.GetUnixEpoch()
|
||||||
_, err = r.node.Relay().Publish(context.Background(),
|
_, err = r.node.Relay().Publish(context.Background(),
|
||||||
tests.CreateWakuMessage(cTopic1, now+1))
|
tests.CreateWakuMessage(cTopic1, proto.Int64(now+1)))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Wait for the messages to be processed
|
// Wait for the messages to be processed
|
||||||
@ -267,7 +265,6 @@ func TestRelayGetV1AutoMessages(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: cTopic1,
|
ContentTopic: cTopic1,
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
msgJsonBytes, err := json.Marshal(msg)
|
msgJsonBytes, err := json.Marshal(msg)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ type HistoryCursor struct {
|
|||||||
type StoreWakuMessage struct {
|
type StoreWakuMessage struct {
|
||||||
Payload []byte `json:"payload"`
|
Payload []byte `json:"payload"`
|
||||||
ContentTopic string `json:"content_topic"`
|
ContentTopic string `json:"content_topic"`
|
||||||
Version int32 `json:"version"`
|
Version uint32 `json:"version"`
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
Meta []byte `json:"meta"`
|
Meta []byte `json:"meta"`
|
||||||
}
|
}
|
||||||
@ -83,18 +83,20 @@ func getStoreParams(r *http.Request) (multiaddr.Multiaddr, *store.Query, []store
|
|||||||
|
|
||||||
startTimeStr := r.URL.Query().Get("startTime")
|
startTimeStr := r.URL.Query().Get("startTime")
|
||||||
if startTimeStr != "" {
|
if startTimeStr != "" {
|
||||||
query.StartTime, err = strconv.ParseInt(startTimeStr, 10, 64)
|
startTime, err := strconv.ParseInt(startTimeStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
query.StartTime = &startTime
|
||||||
}
|
}
|
||||||
|
|
||||||
endTimeStr := r.URL.Query().Get("endTime")
|
endTimeStr := r.URL.Query().Get("endTime")
|
||||||
if endTimeStr != "" {
|
if endTimeStr != "" {
|
||||||
query.EndTime, err = strconv.ParseInt(endTimeStr, 10, 64)
|
endTime, err := strconv.ParseInt(endTimeStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
query.EndTime = &endTime
|
||||||
}
|
}
|
||||||
|
|
||||||
var cursor *pb.Index
|
var cursor *pb.Index
|
||||||
@ -178,8 +180,8 @@ func toStoreResponse(result *store.Result) StoreResponse {
|
|||||||
response.Messages = append(response.Messages, StoreWakuMessage{
|
response.Messages = append(response.Messages, StoreWakuMessage{
|
||||||
Payload: m.Payload,
|
Payload: m.Payload,
|
||||||
ContentTopic: m.ContentTopic,
|
ContentTopic: m.ContentTopic,
|
||||||
Version: int32(m.Version),
|
Version: m.GetVersion(),
|
||||||
Timestamp: m.Timestamp,
|
Timestamp: m.GetTimestamp(),
|
||||||
Meta: m.Meta,
|
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/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetMessages(t *testing.T) {
|
func TestGetMessages(t *testing.T) {
|
||||||
@ -32,14 +33,14 @@ func TestGetMessages(t *testing.T) {
|
|||||||
topic1 := "1"
|
topic1 := "1"
|
||||||
pubsubTopic1 := "topic1"
|
pubsubTopic1 := "topic1"
|
||||||
|
|
||||||
now := utils.GetUnixEpoch()
|
now := *utils.GetUnixEpoch()
|
||||||
msg1 := tests.CreateWakuMessage(topic1, now+1)
|
msg1 := tests.CreateWakuMessage(topic1, proto.Int64(now+1))
|
||||||
msg2 := tests.CreateWakuMessage(topic1, now+2)
|
msg2 := tests.CreateWakuMessage(topic1, proto.Int64(now+2))
|
||||||
msg3 := tests.CreateWakuMessage(topic1, now+3)
|
msg3 := tests.CreateWakuMessage(topic1, proto.Int64(now+3))
|
||||||
|
|
||||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg1, 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(msg2, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||||
node1.Broadcaster().Submit(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1))
|
node1.Broadcaster().Submit(protocol.NewEnvelope(msg3, *utils.GetUnixEpoch(), pubsubTopic1))
|
||||||
|
|
||||||
n1HostInfo, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", node1.Host().ID().Pretty()))
|
n1HostInfo, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", node1.Host().ID().Pretty()))
|
||||||
n1Addr := node1.ListenAddresses()[0].Encapsulate(n1HostInfo)
|
n1Addr := node1.ListenAddresses()[0].Encapsulate(n1HostInfo)
|
||||||
|
|||||||
@ -33,10 +33,12 @@ func TestV1Peers(t *testing.T) {
|
|||||||
port, err := tests.FindFreePort(t, "", 5)
|
port, err := tests.FindFreePort(t, "", 5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
broadcaster := relay.NewBroadcaster(10)
|
||||||
|
require.NoError(t, broadcaster.Start(context.Background()))
|
||||||
|
|
||||||
host, err := tests.MakeHost(context.Background(), port, rand.Reader)
|
host, err := tests.MakeHost(context.Background(), port, rand.Reader)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
bcast := relay.NewBroadcaster(10)
|
relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||||
relay := relay.NewWakuRelay(bcast, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
|
||||||
relay.SetHost(host)
|
relay.SetHost(host)
|
||||||
err = relay.Start(context.Background())
|
err = relay.Start(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -125,7 +125,13 @@ func (f *FilterService) GetV1Messages(req *http.Request, args *ContentTopicArgs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i := range f.messages[args.ContentTopic] {
|
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)
|
f.messages[args.ContentTopic] = make([]*wpb.WakuMessage, 0)
|
||||||
|
|||||||
@ -1,16 +1,20 @@
|
|||||||
package rpc
|
package rpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/cmd/waku/server"
|
"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/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errChannelClosed = errors.New("consume channel is closed for subscription")
|
||||||
|
|
||||||
// RelayService represents the JSON RPC service for WakuRelay
|
// RelayService represents the JSON RPC service for WakuRelay
|
||||||
type RelayService struct {
|
type RelayService struct {
|
||||||
node *node.WakuNode
|
node *node.WakuNode
|
||||||
@ -69,7 +73,10 @@ func (r *RelayService) PostV1Message(req *http.Request, args *RelayMessageArgs,
|
|||||||
topic = args.Topic
|
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 {
|
if err = server.AppendRLNProof(r.node, msg); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -89,7 +96,7 @@ func (r *RelayService) PostV1Message(req *http.Request, args *RelayMessageArgs,
|
|||||||
// Note that this method takes contentTopics as an argument instead of pubsubtopics and uses autosharding to derive pubsubTopics.
|
// Note that this method takes contentTopics as an argument instead of pubsubtopics and uses autosharding to derive pubsubTopics.
|
||||||
func (r *RelayService) PostV1AutoSubscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error {
|
func (r *RelayService) PostV1AutoSubscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error {
|
||||||
|
|
||||||
_, err := r.node.Relay().Subscribe(r.node.Relay().Context(), protocol.NewContentFilter("", args.Topics...))
|
_, err := r.node.Relay().Subscribe(r.node.Relay().Context(), protocol.NewContentFilter("", args.Topics...), relay.WithCacheSize(uint(r.cacheCapacity)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.log.Error("subscribing to topics", zap.Strings("topics", args.Topics), zap.Error(err))
|
r.log.Error("subscribing to topics", zap.Strings("topics", args.Topics), zap.Error(err))
|
||||||
return err
|
return err
|
||||||
@ -117,10 +124,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
|
// 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 {
|
func (r *RelayService) PostV1AutoMessage(req *http.Request, args *RelayAutoMessageArgs, reply *SuccessReply) error {
|
||||||
var err error
|
msg, err := args.Message.toProto()
|
||||||
msg := args.Message.toProto()
|
if err != nil {
|
||||||
if msg == nil {
|
err = fmt.Errorf("invalid message format received: %w", err)
|
||||||
err := fmt.Errorf("invalid message format received")
|
|
||||||
r.log.Error("publishing message", zap.Error(err))
|
r.log.Error("publishing message", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -147,8 +153,17 @@ func (r *RelayService) GetV1AutoMessages(req *http.Request, args *TopicArgs, rep
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case msg := <-sub.Ch:
|
case msg, open := <-sub.Ch:
|
||||||
*reply = append(*reply, ProtoToRPC(msg.Message()))
|
if !open {
|
||||||
|
r.log.Error("consume channel is closed for subscription", zap.String("pubsubTopic", args.Topic))
|
||||||
|
return errChannelClosed
|
||||||
|
}
|
||||||
|
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:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -157,14 +172,13 @@ func (r *RelayService) GetV1AutoMessages(req *http.Request, args *TopicArgs, rep
|
|||||||
|
|
||||||
// PostV1Subscription is invoked when the json rpc request uses the post_waku_v2_relay_v1_subscription method
|
// PostV1Subscription is invoked when the json rpc request uses the post_waku_v2_relay_v1_subscription method
|
||||||
func (r *RelayService) PostV1Subscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error {
|
func (r *RelayService) PostV1Subscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error {
|
||||||
ctx := req.Context()
|
|
||||||
|
|
||||||
for _, topic := range args.Topics {
|
for _, topic := range args.Topics {
|
||||||
var err error
|
var err error
|
||||||
if topic == "" {
|
if topic == "" {
|
||||||
topic = relay.DefaultWakuTopic
|
topic = relay.DefaultWakuTopic
|
||||||
}
|
}
|
||||||
_, err = r.node.Relay().Subscribe(ctx, protocol.NewContentFilter(topic))
|
_, err = r.node.Relay().Subscribe(r.node.Relay().Context(), protocol.NewContentFilter(topic), relay.WithCacheSize(uint(r.cacheCapacity)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.log.Error("subscribing to topic", zap.String("topic", topic), zap.Error(err))
|
r.log.Error("subscribing to topic", zap.String("topic", topic), zap.Error(err))
|
||||||
return err
|
return err
|
||||||
@ -199,8 +213,15 @@ func (r *RelayService) GetV1Messages(req *http.Request, args *TopicArgs, reply *
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case msg := <-sub.Ch:
|
case msg, open := <-sub.Ch:
|
||||||
*reply = append(*reply, ProtoToRPC(msg.Message()))
|
if !open {
|
||||||
|
r.log.Error("consume channel is closed for subscription", zap.String("pubsubTopic", args.Topic))
|
||||||
|
return errChannelClosed
|
||||||
|
}
|
||||||
|
m, err := ProtoToRPC(msg.Message())
|
||||||
|
if err == nil {
|
||||||
|
*reply = append(*reply, m)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,14 +31,16 @@ func TestPostV1Message(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "abc",
|
ContentTopic: "abc",
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := d.PostV1Message(
|
rpcWakuMsg, err := ProtoToRPC(msg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = d.PostV1Message(
|
||||||
makeRequest(t),
|
makeRequest(t),
|
||||||
&RelayMessageArgs{
|
&RelayMessageArgs{
|
||||||
Message: ProtoToRPC(msg),
|
Message: rpcWakuMsg,
|
||||||
},
|
},
|
||||||
&reply,
|
&reply,
|
||||||
)
|
)
|
||||||
@ -95,6 +97,17 @@ func TestRelayGetV1Messages(t *testing.T) {
|
|||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
args := &TopicsArgs{Topics: []string{"test"}}
|
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(
|
err = serviceB.PostV1Subscription(
|
||||||
makeRequest(t),
|
makeRequest(t),
|
||||||
args,
|
args,
|
||||||
@ -106,14 +119,17 @@ func TestRelayGetV1Messages(t *testing.T) {
|
|||||||
// Wait for the subscription to be started
|
// Wait for the subscription to be started
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
|
rpcWakuMsg, err := ProtoToRPC(&pb.WakuMessage{
|
||||||
|
Payload: []byte("test"),
|
||||||
|
ContentTopic: "test",
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
err = serviceA.PostV1Message(
|
err = serviceA.PostV1Message(
|
||||||
makeRequest(t),
|
makeRequest(t),
|
||||||
&RelayMessageArgs{
|
&RelayMessageArgs{
|
||||||
Topic: "test",
|
Topic: "test",
|
||||||
Message: ProtoToRPC(&pb.WakuMessage{
|
Message: rpcWakuMsg,
|
||||||
Payload: []byte("test"),
|
|
||||||
ContentTopic: "testContentTopic",
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
&reply,
|
&reply,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -27,8 +27,8 @@ type StorePagingOptions struct {
|
|||||||
type StoreMessagesArgs struct {
|
type StoreMessagesArgs struct {
|
||||||
Topic string `json:"pubsubTopic,omitempty"`
|
Topic string `json:"pubsubTopic,omitempty"`
|
||||||
ContentFilters []string `json:"contentFilters,omitempty"`
|
ContentFilters []string `json:"contentFilters,omitempty"`
|
||||||
StartTime int64 `json:"startTime,omitempty"`
|
StartTime *int64 `json:"startTime,omitempty"`
|
||||||
EndTime int64 `json:"endTime,omitempty"`
|
EndTime *int64 `json:"endTime,omitempty"`
|
||||||
PagingOptions StorePagingOptions `json:"pagingOptions,omitempty"`
|
PagingOptions StorePagingOptions `json:"pagingOptions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,11 @@ func (s *StoreService) GetV1Messages(req *http.Request, args *StoreMessagesArgs,
|
|||||||
|
|
||||||
reply.Messages = make([]*RPCWakuMessage, len(res.Messages))
|
reply.Messages = make([]*RPCWakuMessage, len(res.Messages))
|
||||||
for i := range 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{
|
reply.PagingInfo = StorePagingOptions{
|
||||||
|
|||||||
@ -20,9 +20,11 @@ func makeRequest(t *testing.T) *http.Request {
|
|||||||
func TestBase64Encoding(t *testing.T) {
|
func TestBase64Encoding(t *testing.T) {
|
||||||
input := "Hello World"
|
input := "Hello World"
|
||||||
|
|
||||||
rpcMsg := ProtoToRPC(&pb.WakuMessage{
|
rpcMsg, err := ProtoToRPC(&pb.WakuMessage{
|
||||||
Payload: []byte(input),
|
Payload: []byte(input),
|
||||||
|
ContentTopic: "test",
|
||||||
})
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
jsonBytes, err := json.Marshal(rpcMsg)
|
jsonBytes, err := json.Marshal(rpcMsg)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
package rpc
|
package rpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"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 {
|
type RateLimitProof struct {
|
||||||
@ -23,49 +28,59 @@ type RPCWakuMessage struct {
|
|||||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProtoToRPC(input *pb.WakuMessage) *RPCWakuMessage {
|
func ProtoToRPC(input *pb.WakuMessage) (*RPCWakuMessage, error) {
|
||||||
if input == nil {
|
if input == nil {
|
||||||
return nil
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := input.Validate(); err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcWakuMsg := &RPCWakuMessage{
|
rpcWakuMsg := &RPCWakuMessage{
|
||||||
Payload: input.Payload,
|
Payload: input.Payload,
|
||||||
ContentTopic: input.ContentTopic,
|
ContentTopic: input.ContentTopic,
|
||||||
Version: input.Version,
|
Version: input.GetVersion(),
|
||||||
Timestamp: input.Timestamp,
|
Timestamp: input.GetTimestamp(),
|
||||||
Ephemeral: input.Ephemeral,
|
Ephemeral: input.GetEphemeral(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.RateLimitProof != nil {
|
if input.RateLimitProof != nil {
|
||||||
|
rateLimitProof := &rlnpb.RateLimitProof{}
|
||||||
|
err := proto.Unmarshal(input.RateLimitProof, rateLimitProof)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
rpcWakuMsg.RateLimitProof = &RateLimitProof{
|
rpcWakuMsg.RateLimitProof = &RateLimitProof{
|
||||||
Proof: input.RateLimitProof.Proof,
|
Proof: rateLimitProof.Proof,
|
||||||
MerkleRoot: input.RateLimitProof.MerkleRoot,
|
MerkleRoot: rateLimitProof.MerkleRoot,
|
||||||
Epoch: input.RateLimitProof.Epoch,
|
Epoch: rateLimitProof.Epoch,
|
||||||
ShareX: input.RateLimitProof.ShareX,
|
ShareX: rateLimitProof.ShareX,
|
||||||
ShareY: input.RateLimitProof.ShareY,
|
ShareY: rateLimitProof.ShareY,
|
||||||
Nullifier: input.RateLimitProof.Nullifier,
|
Nullifier: rateLimitProof.Nullifier,
|
||||||
RlnIdentifier: input.RateLimitProof.RlnIdentifier,
|
RlnIdentifier: rateLimitProof.RlnIdentifier,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rpcWakuMsg
|
return rpcWakuMsg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RPCWakuMessage) toProto() *pb.WakuMessage {
|
func (r *RPCWakuMessage) toProto() (*pb.WakuMessage, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil
|
return nil, errors.New("wakumessage is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: r.Payload,
|
Payload: r.Payload,
|
||||||
ContentTopic: r.ContentTopic,
|
ContentTopic: r.ContentTopic,
|
||||||
Version: r.Version,
|
Version: proto.Uint32(r.Version),
|
||||||
Timestamp: r.Timestamp,
|
Timestamp: proto.Int64(r.Timestamp),
|
||||||
Ephemeral: r.Ephemeral,
|
Ephemeral: proto.Bool(r.Ephemeral),
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.RateLimitProof != nil {
|
if r.RateLimitProof != nil {
|
||||||
msg.RateLimitProof = &pb.RateLimitProof{
|
rateLimitProof := &rlnpb.RateLimitProof{
|
||||||
Proof: r.RateLimitProof.Proof,
|
Proof: r.RateLimitProof.Proof,
|
||||||
MerkleRoot: r.RateLimitProof.MerkleRoot,
|
MerkleRoot: r.RateLimitProof.MerkleRoot,
|
||||||
Epoch: r.RateLimitProof.Epoch,
|
Epoch: r.RateLimitProof.Epoch,
|
||||||
@ -74,7 +89,14 @@ func (r *RPCWakuMessage) toProto() *pb.WakuMessage {
|
|||||||
Nullifier: r.RateLimitProof.Nullifier,
|
Nullifier: r.RateLimitProof.Nullifier,
|
||||||
RlnIdentifier: r.RateLimitProof.RlnIdentifier,
|
RlnIdentifier: r.RateLimitProof.RlnIdentifier,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b, err := proto.Marshal(rateLimitProof)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.RateLimitProof = b
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg
|
return msg, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,12 +19,13 @@ import (
|
|||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = utils.Logger().Named("basic2")
|
var log = utils.Logger().Named("basic2")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var cTopic, err = protocol.NewContentTopic("basic2", 1, "test", "proto")
|
var cTopic, err = protocol.NewContentTopic("basic2", "1", "test", "proto")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Invalid contentTopic")
|
fmt.Println("Invalid contentTopic")
|
||||||
return
|
return
|
||||||
@ -84,7 +85,6 @@ func randomHex(n int) (string, error) {
|
|||||||
|
|
||||||
func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, msgContent string) {
|
func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, msgContent string) {
|
||||||
var version uint32 = 0
|
var version uint32 = 0
|
||||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
|
||||||
|
|
||||||
p := new(payload.Payload)
|
p := new(payload.Payload)
|
||||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||||
@ -98,9 +98,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, contentTopic string, ms
|
|||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Version: version,
|
Version: proto.Uint32(version),
|
||||||
ContentTopic: contentTopic,
|
ContentTopic: contentTopic,
|
||||||
Timestamp: timestamp,
|
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
||||||
|
|||||||
@ -18,8 +18,10 @@ char *bobPubKey =
|
|||||||
"0x045eef61a98ba1cf44a2736fac91183ea2bd86e67de20fe4bff467a71249a8a0c05f795d"
|
"0x045eef61a98ba1cf44a2736fac91183ea2bd86e67de20fe4bff467a71249a8a0c05f795d"
|
||||||
"d7f28ced7c15eaa69c89d4212cc4f526ca5e9a62e88008f506d850cccd";
|
"d7f28ced7c15eaa69c89d4212cc4f526ca5e9a62e88008f506d850cccd";
|
||||||
|
|
||||||
void on_error(int ret, const char *result, void *user_data) {
|
void on_error(int ret, const char *result, void *user_data)
|
||||||
if (ret == 0) {
|
{
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,8 +29,10 @@ void on_error(int ret, const char *result, void *user_data) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_response(int ret, const char *result, void *user_data) {
|
void on_response(int ret, const char *result, void *user_data)
|
||||||
if (ret != 0) {
|
{
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
printf("function execution failed. Returned code: %d\n", ret);
|
printf("function execution failed. Returned code: %d\n", ret);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -46,7 +50,8 @@ void on_response(int ret, const char *result, void *user_data) {
|
|||||||
strcpy(*data_ref, result);
|
strcpy(*data_ref, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void callBack(int ret, const char *signal, void *user_data) {
|
void callBack(int ret, const char *signal, void *user_data)
|
||||||
|
{
|
||||||
// This callback will be executed each time a new message is received
|
// This callback will be executed each time a new message is received
|
||||||
|
|
||||||
// Example signal:
|
// Example signal:
|
||||||
@ -65,7 +70,8 @@ void callBack(int ret, const char *signal, void *user_data) {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0)
|
||||||
|
{
|
||||||
printf("function execution failed. Returned code: %d\n", ret);
|
printf("function execution failed. Returned code: %d\n", ret);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -73,13 +79,15 @@ void callBack(int ret, const char *signal, void *user_data) {
|
|||||||
const nx_json *json = nx_json_parse((char *)signal, 0);
|
const nx_json *json = nx_json_parse((char *)signal, 0);
|
||||||
const char *type = nx_json_get(json, "type")->text_value;
|
const char *type = nx_json_get(json, "type")->text_value;
|
||||||
|
|
||||||
if (strcmp(type, "message") == 0) {
|
if (strcmp(type, "message") == 0)
|
||||||
|
{
|
||||||
const nx_json *wakuMsgJson =
|
const nx_json *wakuMsgJson =
|
||||||
nx_json_get(nx_json_get(json, "event"), "wakuMessage");
|
nx_json_get(nx_json_get(json, "event"), "wakuMessage");
|
||||||
const char *contentTopic =
|
const char *contentTopic =
|
||||||
nx_json_get(wakuMsgJson, "contentTopic")->text_value;
|
nx_json_get(wakuMsgJson, "contentTopic")->text_value;
|
||||||
|
|
||||||
if (strcmp(contentTopic, "/example/1/default/rfc26") == 0) {
|
if (strcmp(contentTopic, "/example/1/default/rfc26") == 0)
|
||||||
|
{
|
||||||
char *msg = utils_extract_wakumessage_from_signal(wakuMsgJson);
|
char *msg = utils_extract_wakumessage_from_signal(wakuMsgJson);
|
||||||
|
|
||||||
// Decode a message using asymmetric encryption
|
// Decode a message using asymmetric encryption
|
||||||
@ -109,7 +117,8 @@ void callBack(int ret, const char *signal, void *user_data) {
|
|||||||
nx_json_free(json);
|
nx_json_free(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
// Set callback to be executed each time a message is received
|
// Set callback to be executed each time a message is received
|
||||||
waku_set_event_callback(callBack);
|
waku_set_event_callback(callBack);
|
||||||
|
|
||||||
@ -134,7 +143,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Build a content topic
|
// Build a content topic
|
||||||
char *contentTopic = NULL;
|
char *contentTopic = NULL;
|
||||||
waku_content_topic("example", 1, "default", "rfc26", on_response,
|
waku_content_topic("example", "1", "default", "rfc26", on_response,
|
||||||
(void *)&contentTopic);
|
(void *)&contentTopic);
|
||||||
printf("Content Topic: %s\n", contentTopic);
|
printf("Content Topic: %s\n", contentTopic);
|
||||||
|
|
||||||
@ -166,14 +175,15 @@ int main(int argc, char *argv[]) {
|
|||||||
// waku_store_query(query, NULL, 0, on_response, (void*)&query_result);
|
// waku_store_query(query, NULL, 0, on_response, (void*)&query_result);
|
||||||
// printf("%s\n", query_result);
|
// printf("%s\n", query_result);
|
||||||
char contentFilter[1000];
|
char contentFilter[1000];
|
||||||
sprintf(contentFilter,
|
sprintf(contentFilter,
|
||||||
"{\"pubsubTopic\":\"%s\",\"contentTopics\":[\"%s\"]}",
|
"{\"pubsubTopic\":\"%s\",\"contentTopics\":[\"%s\"]}",
|
||||||
defaultPubsubTopic, contentTopic);
|
defaultPubsubTopic, contentTopic);
|
||||||
waku_relay_subscribe(contentFilter, on_error, NULL);
|
waku_relay_subscribe(contentFilter, on_error, NULL);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int version = 1;
|
int version = 1;
|
||||||
while (i < 5) {
|
while (i < 5)
|
||||||
|
{
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
char wakuMsg[1000];
|
char wakuMsg[1000];
|
||||||
|
|||||||
@ -20,9 +20,9 @@ import (
|
|||||||
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
|
"github.com/waku-org/go-waku/waku/v2/protocol/lightpush"
|
||||||
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"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/protocol/store"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"github.com/waku-org/go-zerokit-rln/rln"
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ func (c *Chat) publish(ctx context.Context, message string) error {
|
|||||||
|
|
||||||
wakuMsg := &wpb.WakuMessage{
|
wakuMsg := &wpb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Version: version,
|
Version: proto.Uint32(version),
|
||||||
ContentTopic: options.ContentTopic,
|
ContentTopic: options.ContentTopic,
|
||||||
Timestamp: timestamp,
|
Timestamp: timestamp,
|
||||||
}
|
}
|
||||||
@ -315,7 +315,12 @@ func (c *Chat) publish(ctx context.Context, message string) error {
|
|||||||
return err
|
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 {
|
if c.options.LightPush.Enable {
|
||||||
@ -402,7 +407,7 @@ func (c *Chat) retrieveHistory(connectionWg *sync.WaitGroup) {
|
|||||||
c.ui.InfoMessage("0 historic messages available")
|
c.ui.InfoMessage("0 historic messages available")
|
||||||
} else {
|
} else {
|
||||||
for _, msg := range response.Messages {
|
for _, msg := range response.Messages {
|
||||||
c.C <- protocol.NewEnvelope(msg, msg.Timestamp, relay.DefaultWakuTopic)
|
c.C <- protocol.NewEnvelope(msg, msg.GetTimestamp(), relay.DefaultWakuTopic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ func getFlags() []cli.Flag {
|
|||||||
// Defaults
|
// Defaults
|
||||||
options.Fleet = fleetProd
|
options.Fleet = fleetProd
|
||||||
|
|
||||||
testCT, err := protocol.NewContentTopic("toy-chat", 3, "mingde", "proto")
|
testCT, err := protocol.NewContentTopic("toy-chat", "3", "mingde", "proto")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("invalid contentTopic")
|
panic("invalid contentTopic")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("filter2")
|
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) {
|
func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||||
var version uint32 = 0
|
var version uint32 = 0
|
||||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
|
||||||
|
|
||||||
p := new(payload.Payload)
|
p := new(payload.Payload)
|
||||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||||
@ -154,9 +154,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
|||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Version: version,
|
Version: proto.Uint32(version),
|
||||||
ContentTopic: contentTopic,
|
ContentTopic: contentTopic,
|
||||||
Timestamp: timestamp,
|
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := wakuNode.Relay().Publish(ctx, msg, relay.WithPubSubTopic(pubSubTopic.String()))
|
_, 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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Timestamp = wakuNode.Timesource().Now().UnixNano()
|
msg.Timestamp = utils.GetUnixEpoch(wakuNode.Timesource())
|
||||||
|
|
||||||
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
_, err = wakuNode.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic())
|
||||||
if err != nil {
|
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/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = utils.Logger().Named("rln")
|
var log = utils.Logger().Named("rln")
|
||||||
@ -31,7 +32,7 @@ var contractAddress = "0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4"
|
|||||||
var keystorePath = "./rlnKeystore.json"
|
var keystorePath = "./rlnKeystore.json"
|
||||||
var keystorePassword = "password"
|
var keystorePassword = "password"
|
||||||
var membershipIndex = uint(0)
|
var membershipIndex = uint(0)
|
||||||
var contentTopic, _ = protocol.NewContentTopic("rln", 1, "test", "proto")
|
var contentTopic, _ = protocol.NewContentTopic("rln", "1", "test", "proto")
|
||||||
var pubsubTopic = protocol.DefaultPubsubTopic{}
|
var pubsubTopic = protocol.DefaultPubsubTopic{}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -105,7 +106,6 @@ func randomHex(n int) (string, error) {
|
|||||||
|
|
||||||
func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
||||||
var version uint32 = 0
|
var version uint32 = 0
|
||||||
var timestamp int64 = utils.GetUnixEpoch(wakuNode.Timesource())
|
|
||||||
|
|
||||||
p := new(payload.Payload)
|
p := new(payload.Payload)
|
||||||
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
p.Data = []byte(wakuNode.ID() + ": " + msgContent)
|
||||||
@ -119,9 +119,9 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
|||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Version: version,
|
Version: proto.Uint32(version),
|
||||||
ContentTopic: contentTopic.String(),
|
ContentTopic: contentTopic.String(),
|
||||||
Timestamp: timestamp,
|
Timestamp: utils.GetUnixEpoch(wakuNode.Timesource()),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = wakuNode.RLNRelay().AppendRLNProof(msg, wakuNode.Timesource().Now())
|
err = wakuNode.RLNRelay().AppendRLNProof(msg, wakuNode.Timesource().Now())
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
];
|
];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
# FIXME: This needs to be manually changed when updating modules.
|
# FIXME: This needs to be manually changed when updating modules.
|
||||||
vendorSha256 = "sha256-4xChSKAkwwrFp5/ZMnhtvsR4drVfw1cLE3YXwVHeW0A=";
|
vendorSha256 = "sha256-1m5byn1CVD8Awzbo9XY94FgitC+uetTfon/8bBh5DiE=";
|
||||||
# Fix for 'nix run' trying to execute 'go-waku'.
|
# Fix for 'nix run' trying to execute 'go-waku'.
|
||||||
meta = { mainProgram = "waku"; };
|
meta = { mainProgram = "waku"; };
|
||||||
};
|
};
|
||||||
|
|||||||
@ -194,12 +194,11 @@ func waku_peer_cnt(cb C.WakuCallBack, userData unsafe.Pointer) C.int {
|
|||||||
// Create a content topic string according to RFC 23
|
// Create a content topic string according to RFC 23
|
||||||
//
|
//
|
||||||
//export waku_content_topic
|
//export waku_content_topic
|
||||||
func waku_content_topic(applicationName *C.char, applicationVersion C.uint, contentTopicName *C.char, encoding *C.char, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
|
func waku_content_topic(applicationName *C.char, applicationVersion *C.char, contentTopicName *C.char, encoding *C.char, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
|
||||||
contentTopic, _ := protocol.NewContentTopic(C.GoString(applicationName), uint32(applicationVersion), C.GoString(contentTopicName), C.GoString(encoding))
|
contentTopic, _ := protocol.NewContentTopic(C.GoString(applicationName), C.GoString(applicationVersion), C.GoString(contentTopicName), C.GoString(encoding))
|
||||||
return onSuccesfulResponse(contentTopic.String(), cb, userData)
|
return onSuccesfulResponse(contentTopic.String(), cb, userData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the default pubsub topic used in waku2: /waku/2/default-waku/proto
|
// Get the default pubsub topic used in waku2: /waku/2/default-waku/proto
|
||||||
//
|
//
|
||||||
//export waku_default_pubsub_topic
|
//export waku_default_pubsub_topic
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/waku-org/go-waku/waku/v2/payload"
|
"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/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func wakuMessage(messageJSON string) (*pb.WakuMessage, error) {
|
func wakuMessage(messageJSON string) (*pb.WakuMessage, error) {
|
||||||
@ -26,7 +27,7 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload := payload.Payload{
|
msgPayload := payload.Payload{
|
||||||
Data: msg.Payload,
|
Data: msg.Payload,
|
||||||
Key: &payload.KeyInfo{
|
Key: &payload.KeyInfo{
|
||||||
Kind: payload.Symmetric,
|
Kind: payload.Symmetric,
|
||||||
@ -38,7 +39,7 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.Key.SymKey = keyBytes
|
msgPayload.Key.SymKey = keyBytes
|
||||||
|
|
||||||
if optionalSigningKey != "" {
|
if optionalSigningKey != "" {
|
||||||
signingKeyBytes, err := utils.DecodeHexString(optionalSigningKey)
|
signingKeyBytes, err := utils.DecodeHexString(optionalSigningKey)
|
||||||
@ -46,14 +47,14 @@ func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
msgPayload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Version = 1
|
msg.Version = proto.Uint32(payload.V1Encryption)
|
||||||
msg.Payload, err = payload.Encode(1)
|
msg.Payload, err = msgPayload.Encode(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload := payload.Payload{
|
msgPayload := payload.Payload{
|
||||||
Data: msg.Payload,
|
Data: msg.Payload,
|
||||||
Key: &payload.KeyInfo{
|
Key: &payload.KeyInfo{
|
||||||
Kind: payload.Asymmetric,
|
Kind: payload.Asymmetric,
|
||||||
@ -84,7 +85,7 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.Key.PubKey, err = unmarshalPubkey(keyBytes)
|
msgPayload.Key.PubKey, err = unmarshalPubkey(keyBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -95,14 +96,14 @@ func EncodeAsymmetric(messageJSON string, publicKey string, optionalSigningKey s
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
msgPayload.Key.PrivKey, err = crypto.ToECDSA(signingKeyBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Version = 1
|
msg.Version = proto.Uint32(payload.V1Encryption)
|
||||||
msg.Payload, err = payload.Encode(1)
|
msg.Payload, err = msgPayload.Encode(payload.V1Encryption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -148,11 +149,11 @@ func DecodeSymmetric(messageJSON string, symmetricKey string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Version == 0 {
|
if msg.GetVersion() == payload.Unencrypted {
|
||||||
return marshalJSON(v0Response{
|
return marshalJSON(v0Response{
|
||||||
Data: msg.Payload,
|
Data: msg.Payload,
|
||||||
})
|
})
|
||||||
} else if msg.Version > 1 {
|
} else if msg.GetVersion() != payload.V1Encryption {
|
||||||
return "", errors.New("unsupported wakumessage version")
|
return "", errors.New("unsupported wakumessage version")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,11 +191,11 @@ func DecodeAsymmetric(messageJSON string, privateKey string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Version == 0 {
|
if msg.GetVersion() == payload.Unencrypted {
|
||||||
return marshalJSON(v0Response{
|
return marshalJSON(v0Response{
|
||||||
Data: msg.Payload,
|
Data: msg.Payload,
|
||||||
})
|
})
|
||||||
} else if msg.Version > 1 {
|
} else if msg.GetVersion() != payload.V1Encryption {
|
||||||
return "", errors.New("unsupported wakumessage version")
|
return "", errors.New("unsupported wakumessage version")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,8 +73,8 @@ func PeerCnt() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ContentTopic creates a content topic string according to RFC 23
|
// ContentTopic creates a content topic string according to RFC 23
|
||||||
func ContentTopic(applicationName string, applicationVersion int, contentTopicName string, encoding string) string {
|
func ContentTopic(applicationName string, applicationVersion string, contentTopicName string, encoding string) string {
|
||||||
contentTopic, _ := protocol.NewContentTopic(applicationName, uint32(applicationVersion), contentTopicName, encoding)
|
contentTopic, _ := protocol.NewContentTopic(applicationName, applicationVersion, contentTopicName, encoding)
|
||||||
return contentTopic.String()
|
return contentTopic.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -335,8 +335,8 @@ func PeerCnt() (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ContentTopic creates a content topic string according to RFC 23
|
// ContentTopic creates a content topic string according to RFC 23
|
||||||
func ContentTopic(applicationName string, applicationVersion int, contentTopicName string, encoding string) string {
|
func ContentTopic(applicationName string, applicationVersion string, contentTopicName string, encoding string) string {
|
||||||
contentTopic, _ := protocol.NewContentTopic(applicationName, uint32(applicationVersion), contentTopicName, encoding)
|
contentTopic, _ := protocol.NewContentTopic(applicationName, applicationVersion, contentTopicName, encoding)
|
||||||
return contentTopic.String()
|
return contentTopic.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,11 +22,11 @@ type storePagingOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type storeMessagesArgs struct {
|
type storeMessagesArgs struct {
|
||||||
Topic string `json:"pubsubTopic,omitempty"`
|
Topic string `json:"pubsubTopic,omitempty"`
|
||||||
ContentTopics []string `json:"contentTopics,omitempty"`
|
ContentTopics []string `json:"contentTopics,omitempty"`
|
||||||
StartTime int64 `json:"startTime,omitempty"`
|
StartTime *int64 `json:"startTime,omitempty"`
|
||||||
EndTime int64 `json:"endTime,omitempty"`
|
EndTime *int64 `json:"endTime,omitempty"`
|
||||||
PagingOptions storePagingOptions `json:"pagingOptions,omitempty"`
|
PagingOptions *storePagingOptions `json:"pagingOptions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type storeMessagesReply struct {
|
type storeMessagesReply struct {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/stretchr/testify/require"
|
"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/node"
|
||||||
"github.com/waku-org/go-waku/waku/v2/payload"
|
"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{
|
msg := &pb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
Version: version,
|
Version: proto.Uint32(version),
|
||||||
ContentTopic: contentTopic,
|
ContentTopic: contentTopic,
|
||||||
Timestamp: timestamp,
|
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
|
// 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
|
var payload []byte
|
||||||
if len(optionalPayload) > 0 {
|
if len(optionalPayload) > 0 {
|
||||||
payload = []byte(optionalPayload[0])
|
payload = []byte(optionalPayload[0])
|
||||||
} else {
|
} else {
|
||||||
payload = []byte{1, 2, 3}
|
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
|
// RandomHex returns a random hex string of n bytes
|
||||||
|
|||||||
@ -92,7 +92,7 @@ func _1_messagesDownSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ func _1_messagesUpSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 452, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe4, 0x17, 0xde, 0xd4, 0x55, 0x47, 0x7f, 0x61, 0xe6, 0xbd, 0x2e, 0x89, 0xb5, 0x7, 0xe1, 0x31, 0x1b, 0xd3, 0x20, 0x3d, 0x3e, 0x68, 0x54, 0xfe, 0xd3, 0x62, 0x51, 0x87, 0x5f, 0xbf, 0x57, 0x64}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ func _2_messages_indexDownSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ func _2_messages_indexUpSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ func _3_rendezvousUpSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ func _4_signed_peer_recordDownSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ func _4_signed_peer_recordUpSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func docGo() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ func _1_messagesDownSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.down.sql", size: 124, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xff, 0x4a, 0x8e, 0xa9, 0xd9, 0xa8, 0xa4, 0x73, 0x3a, 0x54, 0xe4, 0x35, 0xfd, 0xea, 0x87, 0x4c, 0xa, 0x5c, 0xc0, 0xc9, 0xe7, 0x8, 0x8c, 0x6f, 0x60, 0x9e, 0x54, 0x77, 0x59, 0xd0, 0x2b, 0xfe}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ func _1_messagesUpSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "1_messages.up.sql", size: 464, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4, 0xd8, 0x47, 0x7b, 0xe, 0x47, 0x2a, 0x4b, 0x48, 0x36, 0x23, 0x93, 0x28, 0xb3, 0x1e, 0x5, 0x76, 0x64, 0x73, 0xb, 0x2b, 0x5b, 0x10, 0x62, 0x36, 0x21, 0x6f, 0xa3, 0x3c, 0xdd, 0xe2, 0xcf}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ func _2_messages_indexDownSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.down.sql", size: 60, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6e, 0xcb, 0x70, 0x82, 0x33, 0x13, 0x70, 0xd5, 0xbd, 0x3e, 0x68, 0x9, 0x4f, 0x78, 0xa9, 0xc, 0xd6, 0xf4, 0x64, 0xa0, 0x8c, 0xe4, 0x0, 0x15, 0x71, 0xf0, 0x5, 0xdb, 0xa6, 0xf2, 0x12, 0x60}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ func _2_messages_indexUpSql() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "2_messages_index.up.sql", size: 226, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xce, 0xb1, 0xc8, 0x2d, 0xa8, 0x6f, 0x83, 0xfb, 0xf2, 0x40, 0x30, 0xe9, 0xd, 0x18, 0x54, 0xe8, 0xf5, 0xf5, 0xc4, 0x5b, 0xf5, 0xa4, 0x94, 0x50, 0x56, 0x4a, 0xc8, 0x73, 0x3f, 0xf1, 0x56, 0xce}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ func _3_rendezvousDownSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ func _3_rendezvousUpSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ func _4_signed_peer_recordDownSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ func _4_signed_peer_recordUpSql() (*asset, error) {
|
|||||||
return nil, err
|
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}}
|
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
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func docGo() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(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}}
|
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import (
|
|||||||
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageProvider is an interface that provides access to store/retrieve messages from a persistence store.
|
// 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 {
|
if d.maxDuration > 0 {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
sqlStmt := `DELETE FROM message WHERE receiverTimestamp < $1`
|
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 {
|
if err != nil {
|
||||||
d.metrics.RecordError(retPolicyFailure)
|
d.metrics.RecordError(retPolicyFailure)
|
||||||
return err
|
return err
|
||||||
@ -287,11 +287,11 @@ func (d *DBStore) Validate(env *protocol.Envelope) error {
|
|||||||
lowerBound := n.Add(-MaxTimeVariance)
|
lowerBound := n.Add(-MaxTimeVariance)
|
||||||
|
|
||||||
// Ensure that messages don't "jump" to the front of the queue with future timestamps
|
// 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
|
return ErrFutureMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
if env.Message().Timestamp < lowerBound.UnixNano() {
|
if env.Message().GetTimestamp() < lowerBound.UnixNano() {
|
||||||
return ErrMessageTooOld
|
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)
|
dbKey := NewDBKey(uint64(cursor.SenderTime), uint64(cursor.ReceiverTime), env.PubsubTopic(), env.Index().Digest)
|
||||||
|
|
||||||
start := time.Now()
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -361,15 +361,17 @@ func (d *DBStore) handleQueryCursor(query *pb.HistoryQuery, paramCnt *int, condi
|
|||||||
parameters = append(parameters, timeDBKey.Bytes())
|
parameters = append(parameters, timeDBKey.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
if query.StartTime != 0 {
|
startTime := query.GetStartTime()
|
||||||
|
if startTime != 0 {
|
||||||
if !usesCursor || query.PagingInfo.Direction == pb.PagingInfo_BACKWARD {
|
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 {
|
if !usesCursor || query.PagingInfo.Direction == pb.PagingInfo_FORWARD {
|
||||||
handleTimeParam(query.EndTime+1, "<")
|
handleTimeParam(endTime+1, "<")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return conditions, parameters, nil
|
return conditions, parameters, nil
|
||||||
@ -564,8 +566,14 @@ func (d *DBStore) GetStoredMessage(row *sql.Rows) (StoredMessage, error) {
|
|||||||
msg := new(wpb.WakuMessage)
|
msg := new(wpb.WakuMessage)
|
||||||
msg.ContentTopic = contentTopic
|
msg.ContentTopic = contentTopic
|
||||||
msg.Payload = payload
|
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{
|
record := StoredMessage{
|
||||||
ID: id,
|
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/protocol/store"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createTestMsg(version uint32) *pb.WakuMessage {
|
func createTestMsg(version uint32) *pb.WakuMessage {
|
||||||
message := new(pb.WakuMessage)
|
message := new(pb.WakuMessage)
|
||||||
message.Payload = []byte{0, 1, 2}
|
message.Payload = []byte{0, 1, 2}
|
||||||
message.Version = version
|
message.Version = proto.Uint32(version)
|
||||||
message.Timestamp = 123456
|
message.Timestamp = proto.Int64(123456)
|
||||||
message.ContentTopic = "abc"
|
message.ContentTopic = "abc"
|
||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
@ -207,7 +208,7 @@ func Test500(t *testing.T) {
|
|||||||
for i := 1; i <= maxMsgs; i++ {
|
for i := 1; i <= maxMsgs; i++ {
|
||||||
msg := createTestMsg(0)
|
msg := createTestMsg(0)
|
||||||
msg.Payload = int2Bytes(i)
|
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 {
|
if _, err := wakuNode2.Relay().Publish(ctx, msg, relay.WithDefaultPubsubTopic()); err != nil {
|
||||||
require.Fail(t, "Could not publish all messages")
|
require.Fail(t, "Could not publish all messages")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,9 @@ const (
|
|||||||
None KeyKind = "None"
|
None KeyKind = "None"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const Unencrypted = 0
|
||||||
|
const V1Encryption = 1
|
||||||
|
|
||||||
// Payload contains the data of the message to encode
|
// Payload contains the data of the message to encode
|
||||||
type Payload struct {
|
type Payload struct {
|
||||||
Data []byte // Raw message payload
|
Data []byte // Raw message payload
|
||||||
@ -94,7 +97,7 @@ func EncodeWakuMessage(message *pb.WakuMessage, keyInfo *KeyInfo) error {
|
|||||||
Key: keyInfo,
|
Key: keyInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
encodedBytes, err := payload.Encode(message.Version)
|
encodedBytes, err := payload.Encode(message.GetVersion())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -106,7 +109,7 @@ func EncodeWakuMessage(message *pb.WakuMessage, keyInfo *KeyInfo) error {
|
|||||||
// DecodePayload decodes a WakuMessage depending on the version parameter.
|
// DecodePayload decodes a WakuMessage depending on the version parameter.
|
||||||
// 0 for raw unencrypted data, and 1 for using WakuV1 decoding
|
// 0 for raw unencrypted data, and 1 for using WakuV1 decoding
|
||||||
func DecodePayload(message *pb.WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, error) {
|
func DecodePayload(message *pb.WakuMessage, keyInfo *KeyInfo) (*DecodedPayload, error) {
|
||||||
switch message.Version {
|
switch message.GetVersion() {
|
||||||
case uint32(0):
|
case uint32(0):
|
||||||
return &DecodedPayload{Data: message.Payload}, nil
|
return &DecodedPayload{Data: message.Payload}, nil
|
||||||
case uint32(1):
|
case uint32(1):
|
||||||
|
|||||||
@ -7,13 +7,14 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createTestMsg(version uint32) *pb.WakuMessage {
|
func createTestMsg(version uint32) *pb.WakuMessage {
|
||||||
message := new(pb.WakuMessage)
|
message := new(pb.WakuMessage)
|
||||||
message.Payload = []byte{0, 1, 2}
|
message.Payload = []byte{0, 1, 2}
|
||||||
message.Version = version
|
message.Version = proto.Uint32(version)
|
||||||
message.Timestamp = 123456
|
message.Timestamp = proto.Int64(123456)
|
||||||
return message
|
return message
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,8 +36,8 @@ func TestEncodeDecodePayload(t *testing.T) {
|
|||||||
|
|
||||||
message := new(pb.WakuMessage)
|
message := new(pb.WakuMessage)
|
||||||
message.Payload = encodedPayload
|
message.Payload = encodedPayload
|
||||||
message.Version = version
|
message.Version = proto.Uint32(version)
|
||||||
message.Timestamp = 123456
|
message.Timestamp = proto.Int64(123456)
|
||||||
|
|
||||||
decodedPayload, err := DecodePayload(message, keyInfo)
|
decodedPayload, err := DecodePayload(message, keyInfo)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ var ErrInvalidGeneration = errors.New("generation should be a number")
|
|||||||
type ContentTopic struct {
|
type ContentTopic struct {
|
||||||
ContentTopicParams
|
ContentTopicParams
|
||||||
ApplicationName string
|
ApplicationName string
|
||||||
ApplicationVersion uint32
|
ApplicationVersion string
|
||||||
ContentTopicName string
|
ContentTopicName string
|
||||||
Encoding string
|
Encoding string
|
||||||
}
|
}
|
||||||
@ -35,12 +35,13 @@ type ContentTopicOption func(*ContentTopicParams)
|
|||||||
|
|
||||||
// String formats a content topic in string format as per RFC 23.
|
// String formats a content topic in string format as per RFC 23.
|
||||||
func (ct ContentTopic) String() string {
|
func (ct ContentTopic) String() string {
|
||||||
return fmt.Sprintf("/%s/%d/%s/%s", ct.ApplicationName, ct.ApplicationVersion, ct.ContentTopicName, ct.Encoding)
|
return fmt.Sprintf("/%s/%s/%s/%s", ct.ApplicationName, ct.ApplicationVersion, ct.ContentTopicName, ct.Encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewContentTopic creates a new content topic based on params specified.
|
// NewContentTopic creates a new content topic based on params specified.
|
||||||
// Returns ErrInvalidGeneration if an unsupported generation is specified.
|
// Returns ErrInvalidGeneration if an unsupported generation is specified.
|
||||||
func NewContentTopic(applicationName string, applicationVersion uint32,
|
// Note that this is recommended to be used for autosharding where contentTopic format is enforced as per https://rfc.vac.dev/spec/51/#content-topics-format-for-autosharding
|
||||||
|
func NewContentTopic(applicationName string, applicationVersion string,
|
||||||
contentTopicName string, encoding string, opts ...ContentTopicOption) (ContentTopic, error) {
|
contentTopicName string, encoding string, opts ...ContentTopicOption) (ContentTopic, error) {
|
||||||
|
|
||||||
params := new(ContentTopicParams)
|
params := new(ContentTopicParams)
|
||||||
@ -83,18 +84,19 @@ func (ct ContentTopic) Equal(ct2 ContentTopic) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StringToContentTopic can be used to create a ContentTopic object from a string
|
// StringToContentTopic can be used to create a ContentTopic object from a string
|
||||||
|
// Note that this has to be used only when following the rfc format of contentTopic, which is currently validated only for Autosharding.
|
||||||
|
// For static and named-sharding, contentTopic can be of any format and hence it is not recommended to use this function.
|
||||||
|
// This can be updated if required to handle such a case.
|
||||||
func StringToContentTopic(s string) (ContentTopic, error) {
|
func StringToContentTopic(s string) (ContentTopic, error) {
|
||||||
p := strings.Split(s, "/")
|
p := strings.Split(s, "/")
|
||||||
switch len(p) {
|
switch len(p) {
|
||||||
case 5:
|
case 5:
|
||||||
vNum, err := strconv.ParseUint(p[2], 10, 32)
|
if len(p[1]) == 0 || len(p[2]) == 0 || len(p[3]) == 0 || len(p[4]) == 0 {
|
||||||
if err != nil {
|
|
||||||
return ContentTopic{}, ErrInvalidFormat
|
return ContentTopic{}, ErrInvalidFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContentTopic{
|
return ContentTopic{
|
||||||
ApplicationName: p[1],
|
ApplicationName: p[1],
|
||||||
ApplicationVersion: uint32(vNum),
|
ApplicationVersion: p[2],
|
||||||
ContentTopicName: p[3],
|
ContentTopicName: p[3],
|
||||||
Encoding: p[4],
|
Encoding: p[4],
|
||||||
}, nil
|
}, nil
|
||||||
@ -106,15 +108,13 @@ func StringToContentTopic(s string) (ContentTopic, error) {
|
|||||||
if err != nil || generation > 0 {
|
if err != nil || generation > 0 {
|
||||||
return ContentTopic{}, ErrInvalidGeneration
|
return ContentTopic{}, ErrInvalidGeneration
|
||||||
}
|
}
|
||||||
vNum, err := strconv.ParseUint(p[3], 10, 32)
|
if len(p[2]) == 0 || len(p[3]) == 0 || len(p[4]) == 0 || len(p[5]) == 0 {
|
||||||
if err != nil {
|
|
||||||
return ContentTopic{}, ErrInvalidFormat
|
return ContentTopic{}, ErrInvalidFormat
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContentTopic{
|
return ContentTopic{
|
||||||
ContentTopicParams: ContentTopicParams{Generation: generation},
|
ContentTopicParams: ContentTopicParams{Generation: generation},
|
||||||
ApplicationName: p[2],
|
ApplicationName: p[2],
|
||||||
ApplicationVersion: uint32(vNum),
|
ApplicationVersion: p[3],
|
||||||
ContentTopicName: p[4],
|
ContentTopicName: p[4],
|
||||||
Encoding: p[5],
|
Encoding: p[5],
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@ -27,7 +27,7 @@ func NewEnvelope(msg *wpb.WakuMessage, receiverTime int64, pubSubTopic string) *
|
|||||||
index: &pb.Index{
|
index: &pb.Index{
|
||||||
Digest: digest[:],
|
Digest: digest[:],
|
||||||
ReceiverTime: receiverTime,
|
ReceiverTime: receiverTime,
|
||||||
SenderTime: msg.Timestamp,
|
SenderTime: msg.GetTimestamp(),
|
||||||
PubsubTopic: pubSubTopic,
|
PubsubTopic: pubSubTopic,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package protocol
|
package protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -12,7 +11,7 @@ import (
|
|||||||
func TestEnvelope(t *testing.T) {
|
func TestEnvelope(t *testing.T) {
|
||||||
e := NewEnvelope(
|
e := NewEnvelope(
|
||||||
&pb.WakuMessage{ContentTopic: "ContentTopic"},
|
&pb.WakuMessage{ContentTopic: "ContentTopic"},
|
||||||
utils.GetUnixEpoch(),
|
*utils.GetUnixEpoch(),
|
||||||
"test",
|
"test",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +21,6 @@ func TestEnvelope(t *testing.T) {
|
|||||||
topic := e.PubsubTopic()
|
topic := e.PubsubTopic()
|
||||||
require.Equal(t, "test", topic)
|
require.Equal(t, "test", topic)
|
||||||
hash := e.Hash()
|
hash := e.Hash()
|
||||||
fmt.Println(hash)
|
|
||||||
|
|
||||||
require.Equal(
|
require.Equal(
|
||||||
t,
|
t,
|
||||||
|
|||||||
@ -139,7 +139,7 @@ func (wf *WakuFilterLightNode) onRequest(ctx context.Context) func(network.Strea
|
|||||||
|
|
||||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||||
|
|
||||||
messagePush := &pb.MessagePushV2{}
|
messagePush := &pb.MessagePush{}
|
||||||
err := reader.ReadMsg(messagePush)
|
err := reader.ReadMsg(messagePush)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("reading message push", zap.Error(err))
|
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 {
|
if filterSubscribeResponse.StatusCode != http.StatusOK {
|
||||||
wf.metrics.RecordError(errorResponse)
|
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
|
return &err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ func (wf *WakuFilterLightNode) incorrectSubscribeRequest(ctx context.Context, pa
|
|||||||
|
|
||||||
if filterSubscribeResponse.StatusCode != http.StatusOK {
|
if filterSubscribeResponse.StatusCode != http.StatusOK {
|
||||||
wf.metrics.RecordError(errorResponse)
|
wf.metrics.RecordError(errorResponse)
|
||||||
err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.StatusDesc)
|
err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.GetStatusDesc())
|
||||||
return &err
|
return &err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -193,3 +193,69 @@ func (s *FilterTestSuite) TestUnsubscribeErrorHandling() {
|
|||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *FilterTestSuite) TestUnsubscribeAllWithoutContentTopics() {
|
||||||
|
|
||||||
|
var messages = prepareData(2, false, true, true)
|
||||||
|
|
||||||
|
// Subscribe with 2 content topics
|
||||||
|
for _, m := range messages {
|
||||||
|
s.subDetails = s.subscribe(m.pubSubTopic, m.contentTopic, s.fullNodeHost.ID())
|
||||||
|
}
|
||||||
|
|
||||||
|
// All messages should be received
|
||||||
|
s.waitForMessages(func() {
|
||||||
|
s.publishMessages(messages)
|
||||||
|
}, s.subDetails, messages)
|
||||||
|
|
||||||
|
// Unsubscribe all with peer specification
|
||||||
|
_, err := s.lightNode.UnsubscribeAll(s.ctx, WithPeer(s.fullNodeHost.ID()))
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
// Messages should not be received for any contentTopics
|
||||||
|
for _, m := range messages {
|
||||||
|
s.waitForTimeout(func() {
|
||||||
|
s.publishMsg(m.pubSubTopic, m.contentTopic, m.payload)
|
||||||
|
}, s.subDetails[0].C)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *FilterTestSuite) TestUnsubscribeAllDiffPubSubContentTopics() {
|
||||||
|
|
||||||
|
s.ctx, s.ctxCancel = context.WithTimeout(context.Background(), 20*time.Second)
|
||||||
|
|
||||||
|
s.lightNode = s.makeWakuFilterLightNode(true, true)
|
||||||
|
|
||||||
|
s.relayNode, s.fullNode = s.makeWakuFilterFullNode(s.testTopic, true, true)
|
||||||
|
|
||||||
|
// Connect nodes
|
||||||
|
s.lightNodeHost.Peerstore().AddAddr(s.fullNodeHost.ID(), tests.GetHostAddress(s.fullNode.h), peerstore.PermanentAddrTTL)
|
||||||
|
err := s.lightNodeHost.Peerstore().AddProtocols(s.fullNodeHost.ID(), FilterSubscribeID_v20beta1)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
messages := prepareData(2, true, true, true)
|
||||||
|
|
||||||
|
// Subscribe
|
||||||
|
for _, m := range messages {
|
||||||
|
s.subDetails = append(s.subDetails, s.subscribe(m.pubSubTopic, m.contentTopic, s.fullNodeHost.ID())...)
|
||||||
|
_, err = s.relayNode.Subscribe(context.Background(), protocol.NewContentFilter(m.pubSubTopic))
|
||||||
|
s.Require().NoError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// All messages should be received
|
||||||
|
s.waitForMessages(func() {
|
||||||
|
s.publishMessages(messages)
|
||||||
|
}, s.subDetails, messages)
|
||||||
|
|
||||||
|
// Unsubscribe all without any specification
|
||||||
|
_, err = s.lightNode.UnsubscribeAll(s.ctx)
|
||||||
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
// No messages can be received with previous subscriptions
|
||||||
|
for i, m := range messages {
|
||||||
|
s.waitForTimeout(func() {
|
||||||
|
s.publishMsg(m.pubSubTopic, m.contentTopic, m.payload)
|
||||||
|
}, s.subDetails[i].C)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.31.0
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v4.23.4
|
// protoc v4.24.4
|
||||||
// source: waku_filter_v2.proto
|
// source: filter.proto
|
||||||
|
|
||||||
// 12/WAKU2-FILTER rfc: https://rfc.vac.dev/spec/12/
|
// 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 {
|
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 {
|
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 {
|
func (x FilterSubscribeRequest_FilterSubscribeType) Number() protoreflect.EnumNumber {
|
||||||
@ -72,7 +72,7 @@ func (x FilterSubscribeRequest_FilterSubscribeType) Number() protoreflect.EnumNu
|
|||||||
|
|
||||||
// Deprecated: Use FilterSubscribeRequest_FilterSubscribeType.Descriptor instead.
|
// Deprecated: Use FilterSubscribeRequest_FilterSubscribeType.Descriptor instead.
|
||||||
func (FilterSubscribeRequest_FilterSubscribeType) EnumDescriptor() ([]byte, []int) {
|
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
|
// Protocol identifier: /vac/waku/filter-subscribe/2.0.0-beta1
|
||||||
@ -82,7 +82,7 @@ type FilterSubscribeRequest struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
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
|
// Filter criteria
|
||||||
PubsubTopic *string `protobuf:"bytes,10,opt,name=pubsub_topic,json=pubsubTopic,proto3,oneof" json:"pubsub_topic,omitempty"`
|
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"`
|
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() {
|
func (x *FilterSubscribeRequest) Reset() {
|
||||||
*x = FilterSubscribeRequest{}
|
*x = FilterSubscribeRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ func (x *FilterSubscribeRequest) String() string {
|
|||||||
func (*FilterSubscribeRequest) ProtoMessage() {}
|
func (*FilterSubscribeRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *FilterSubscribeRequest) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -117,7 +117,7 @@ func (x *FilterSubscribeRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use FilterSubscribeRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use FilterSubscribeRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*FilterSubscribeRequest) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *FilterSubscribeRequest) GetRequestId() string {
|
||||||
@ -153,15 +153,15 @@ type FilterSubscribeResponse struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,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"`
|
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"`
|
StatusDesc *string `protobuf:"bytes,11,opt,name=status_desc,json=statusDesc,proto3,oneof" json:"status_desc,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *FilterSubscribeResponse) Reset() {
|
func (x *FilterSubscribeResponse) Reset() {
|
||||||
*x = FilterSubscribeResponse{}
|
*x = FilterSubscribeResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ func (x *FilterSubscribeResponse) String() string {
|
|||||||
func (*FilterSubscribeResponse) ProtoMessage() {}
|
func (*FilterSubscribeResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *FilterSubscribeResponse) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -187,7 +187,7 @@ func (x *FilterSubscribeResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use FilterSubscribeResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use FilterSubscribeResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*FilterSubscribeResponse) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *FilterSubscribeResponse) GetRequestId() string {
|
||||||
@ -205,14 +205,14 @@ func (x *FilterSubscribeResponse) GetStatusCode() uint32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *FilterSubscribeResponse) GetStatusDesc() string {
|
func (x *FilterSubscribeResponse) GetStatusDesc() string {
|
||||||
if x != nil {
|
if x != nil && x.StatusDesc != nil {
|
||||||
return x.StatusDesc
|
return *x.StatusDesc
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1
|
// Protocol identifier: /vac/waku/filter-push/2.0.0-beta1
|
||||||
type MessagePushV2 struct {
|
type MessagePush struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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"`
|
PubsubTopic *string `protobuf:"bytes,2,opt,name=pubsub_topic,json=pubsubTopic,proto3,oneof" json:"pubsub_topic,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MessagePushV2) Reset() {
|
func (x *MessagePush) Reset() {
|
||||||
*x = MessagePushV2{}
|
*x = MessagePush{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MessagePushV2) String() string {
|
func (x *MessagePush) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*MessagePushV2) ProtoMessage() {}
|
func (*MessagePush) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *MessagePushV2) ProtoReflect() protoreflect.Message {
|
func (x *MessagePush) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_waku_filter_v2_proto_msgTypes[2]
|
mi := &file_filter_proto_msgTypes[2]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -248,95 +248,99 @@ func (x *MessagePushV2) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use MessagePushV2.ProtoReflect.Descriptor instead.
|
// Deprecated: Use MessagePush.ProtoReflect.Descriptor instead.
|
||||||
func (*MessagePushV2) Descriptor() ([]byte, []int) {
|
func (*MessagePush) Descriptor() ([]byte, []int) {
|
||||||
return file_waku_filter_v2_proto_rawDescGZIP(), []int{2}
|
return file_filter_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MessagePushV2) GetWakuMessage() *pb.WakuMessage {
|
func (x *MessagePush) GetWakuMessage() *pb.WakuMessage {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.WakuMessage
|
return x.WakuMessage
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MessagePushV2) GetPubsubTopic() string {
|
func (x *MessagePush) GetPubsubTopic() string {
|
||||||
if x != nil && x.PubsubTopic != nil {
|
if x != nil && x.PubsubTopic != nil {
|
||||||
return *x.PubsubTopic
|
return *x.PubsubTopic
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var File_waku_filter_v2_proto protoreflect.FileDescriptor
|
var File_filter_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_waku_filter_v2_proto_rawDesc = []byte{
|
var file_filter_proto_rawDesc = []byte{
|
||||||
0x0a, 0x14, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x32,
|
0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x77, 0x61, 0x6b, 0x75,
|
0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x1a, 0x1d,
|
||||||
0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc,
|
0x77, 0x61, 0x6b, 0x75, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x76, 0x31, 0x2f,
|
||||||
0x02, 0x0a, 0x16, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x02,
|
||||||
0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71,
|
0x0a, 0x16, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72,
|
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75,
|
||||||
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,
|
|
||||||
0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65,
|
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,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x6e, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65,
|
||||||
0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74,
|
0x72, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3a, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x66, 0x69,
|
||||||
0x75, 0x73, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73,
|
0x6c, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, 0x75,
|
||||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, 0x73, 0x63, 0x22, 0x7c, 0x0a, 0x0d, 0x4d, 0x65, 0x73,
|
0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46,
|
||||||
0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x56, 0x32, 0x12, 0x32, 0x0a, 0x0c, 0x77, 0x61,
|
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,
|
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,
|
0x32, 0x1c, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e,
|
||||||
0x65, 0x52, 0x0b, 0x77, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x26,
|
0x76, 0x31, 0x2e, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b,
|
||||||
0x0a, 0x0c, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02,
|
0x77, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x0c, 0x70,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f,
|
0x75, 0x62, 0x73, 0x75, 0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x70, 0x69, 0x63, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x75, 0x62, 0x73, 0x75,
|
0x09, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x54, 0x6f, 0x70, 0x69, 0x63,
|
||||||
0x62, 0x5f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
file_waku_filter_v2_proto_rawDescOnce sync.Once
|
file_filter_proto_rawDescOnce sync.Once
|
||||||
file_waku_filter_v2_proto_rawDescData = file_waku_filter_v2_proto_rawDesc
|
file_filter_proto_rawDescData = file_filter_proto_rawDesc
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_waku_filter_v2_proto_rawDescGZIP() []byte {
|
func file_filter_proto_rawDescGZIP() []byte {
|
||||||
file_waku_filter_v2_proto_rawDescOnce.Do(func() {
|
file_filter_proto_rawDescOnce.Do(func() {
|
||||||
file_waku_filter_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_filter_v2_proto_rawDescData)
|
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_filter_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_waku_filter_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
var file_filter_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||||
var file_waku_filter_v2_proto_goTypes = []interface{}{
|
var file_filter_proto_goTypes = []interface{}{
|
||||||
(FilterSubscribeRequest_FilterSubscribeType)(0), // 0: pb.FilterSubscribeRequest.FilterSubscribeType
|
(FilterSubscribeRequest_FilterSubscribeType)(0), // 0: waku.filter.v2.FilterSubscribeRequest.FilterSubscribeType
|
||||||
(*FilterSubscribeRequest)(nil), // 1: pb.FilterSubscribeRequest
|
(*FilterSubscribeRequest)(nil), // 1: waku.filter.v2.FilterSubscribeRequest
|
||||||
(*FilterSubscribeResponse)(nil), // 2: pb.FilterSubscribeResponse
|
(*FilterSubscribeResponse)(nil), // 2: waku.filter.v2.FilterSubscribeResponse
|
||||||
(*MessagePushV2)(nil), // 3: pb.MessagePushV2
|
(*MessagePush)(nil), // 3: waku.filter.v2.MessagePush
|
||||||
(*pb.WakuMessage)(nil), // 4: pb.WakuMessage
|
(*pb.WakuMessage)(nil), // 4: waku.message.v1.WakuMessage
|
||||||
}
|
}
|
||||||
var file_waku_filter_v2_proto_depIdxs = []int32{
|
var file_filter_proto_depIdxs = []int32{
|
||||||
0, // 0: pb.FilterSubscribeRequest.filter_subscribe_type:type_name -> pb.FilterSubscribeRequest.FilterSubscribeType
|
0, // 0: waku.filter.v2.FilterSubscribeRequest.filter_subscribe_type:type_name -> waku.filter.v2.FilterSubscribeRequest.FilterSubscribeType
|
||||||
4, // 1: pb.MessagePushV2.waku_message:type_name -> pb.WakuMessage
|
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 output_type
|
||||||
2, // [2:2] is the sub-list for method input_type
|
2, // [2:2] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
2, // [2:2] is the sub-list for extension 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
|
0, // [0:2] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_waku_filter_v2_proto_init() }
|
func init() { file_filter_proto_init() }
|
||||||
func file_waku_filter_v2_proto_init() {
|
func file_filter_proto_init() {
|
||||||
if File_waku_filter_v2_proto != nil {
|
if File_filter_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
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 {
|
switch v := v.(*FilterSubscribeRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -362,7 +366,7 @@ func file_waku_filter_v2_proto_init() {
|
|||||||
return nil
|
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 {
|
switch v := v.(*FilterSubscribeResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -374,8 +378,8 @@ func file_waku_filter_v2_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_waku_filter_v2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
file_filter_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*MessagePushV2); i {
|
switch v := v.(*MessagePush); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -387,25 +391,26 @@ func file_waku_filter_v2_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_waku_filter_v2_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
file_filter_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||||
file_waku_filter_v2_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
file_filter_proto_msgTypes[1].OneofWrappers = []interface{}{}
|
||||||
|
file_filter_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_waku_filter_v2_proto_rawDesc,
|
RawDescriptor: file_filter_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 3,
|
NumMessages: 3,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
GoTypes: file_waku_filter_v2_proto_goTypes,
|
GoTypes: file_filter_proto_goTypes,
|
||||||
DependencyIndexes: file_waku_filter_v2_proto_depIdxs,
|
DependencyIndexes: file_filter_proto_depIdxs,
|
||||||
EnumInfos: file_waku_filter_v2_proto_enumTypes,
|
EnumInfos: file_filter_proto_enumTypes,
|
||||||
MessageInfos: file_waku_filter_v2_proto_msgTypes,
|
MessageInfos: file_filter_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_waku_filter_v2_proto = out.File
|
File_filter_proto = out.File
|
||||||
file_waku_filter_v2_proto_rawDesc = nil
|
file_filter_proto_rawDesc = nil
|
||||||
file_waku_filter_v2_proto_goTypes = nil
|
file_filter_proto_goTypes = nil
|
||||||
file_waku_filter_v2_proto_depIdxs = nil
|
file_filter_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MessagePushV2) Validate() error {
|
func (x *MessagePush) Validate() error {
|
||||||
if x.WakuMessage == nil {
|
if x.WakuMessage == nil {
|
||||||
return errMissingMessage
|
return errMissingMessage
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ func TestValidateResponse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateMessagePush(t *testing.T) {
|
func TestValidateMessagePush(t *testing.T) {
|
||||||
msgPush := &MessagePushV2{}
|
msgPush := &MessagePush{}
|
||||||
require.ErrorIs(t, msgPush.Validate(), errMissingMessage)
|
require.ErrorIs(t, msgPush.Validate(), errMissingMessage)
|
||||||
msgPush.WakuMessage = &pb.WakuMessage{
|
msgPush.WakuMessage = &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
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 {
|
if len(description) != 0 {
|
||||||
response.StatusDesc = description[0]
|
response.StatusDesc = &description[0]
|
||||||
} else {
|
} else {
|
||||||
response.StatusDesc = http.StatusText(statusCode)
|
desc := http.StatusText(statusCode)
|
||||||
|
response.StatusDesc = &desc
|
||||||
}
|
}
|
||||||
|
|
||||||
writer := pbio.NewDelimitedWriter(stream)
|
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),
|
zap.String("contentTopic", env.Message().ContentTopic),
|
||||||
)
|
)
|
||||||
pubSubTopic := env.PubsubTopic()
|
pubSubTopic := env.PubsubTopic()
|
||||||
messagePush := &pb.MessagePushV2{
|
messagePush := &pb.MessagePush{
|
||||||
PubsubTopic: &pubSubTopic,
|
PubsubTopic: &pubSubTopic,
|
||||||
WakuMessage: env.Message(),
|
WakuMessage: env.Message(),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
package pb
|
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()
|
peerID := stream.Conn().RemotePeer()
|
||||||
logger := wf.log.With(logging.HostID("peer", peerID))
|
logger := wf.log.With(logging.HostID("peer", peerID))
|
||||||
|
|
||||||
filterRPCRequest := &pb.FilterRPC{}
|
filterRPCRequest := &pb.FilterRpc{}
|
||||||
|
|
||||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
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 {
|
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))
|
logger := wf.log.With(logging.HostID("peer", subscriber.peer))
|
||||||
|
|
||||||
stream, err := wf.h.NewStream(ctx, subscriber.peer, FilterID_v20beta1)
|
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())
|
requestID := hex.EncodeToString(protocol.GenerateRequestID())
|
||||||
|
|
||||||
writer := pbio.NewDelimitedWriter(stream)
|
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))
|
wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC))
|
||||||
err = writer.WriteMsg(filterRPC)
|
err = writer.WriteMsg(filterRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -332,7 +332,7 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer := pbio.NewDelimitedWriter(stream)
|
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)
|
err = writer.WriteMsg(filterRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wf.metrics.RecordError(writeRequestFailure)
|
wf.metrics.RecordError(writeRequestFailure)
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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")
|
errMissingResponse = errors.New("missing Response field")
|
||||||
)
|
)
|
||||||
|
|
||||||
func (x *PushRPC) ValidateRequest() error {
|
func (x *PushRpc) ValidateRequest() error {
|
||||||
if x.RequestId == "" {
|
if x.RequestId == "" {
|
||||||
return errMissingRequestID
|
return errMissingRequestID
|
||||||
}
|
}
|
||||||
|
|
||||||
if x.Query == nil {
|
if x.Request == nil {
|
||||||
return errMissingQuery
|
return errMissingQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if x.Query.PubsubTopic == "" {
|
if x.Request.PubsubTopic == "" {
|
||||||
return errMissingPubsubTopic
|
return errMissingPubsubTopic
|
||||||
}
|
}
|
||||||
|
|
||||||
if x.Query.Message == nil {
|
if x.Request.Message == nil {
|
||||||
return errMissingMessage
|
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 == "" {
|
if x.RequestId == "" {
|
||||||
return errMissingRequestID
|
return errMissingRequestID
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,15 +8,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateRequest(t *testing.T) {
|
func TestValidateRequest(t *testing.T) {
|
||||||
request := PushRPC{}
|
request := PushRpc{}
|
||||||
require.ErrorIs(t, request.ValidateRequest(), errMissingRequestID)
|
require.ErrorIs(t, request.ValidateRequest(), errMissingRequestID)
|
||||||
request.RequestId = "test"
|
request.RequestId = "test"
|
||||||
require.ErrorIs(t, request.ValidateRequest(), errMissingQuery)
|
require.ErrorIs(t, request.ValidateRequest(), errMissingQuery)
|
||||||
request.Query = &PushRequest{}
|
request.Request = &PushRequest{}
|
||||||
require.ErrorIs(t, request.ValidateRequest(), errMissingPubsubTopic)
|
require.ErrorIs(t, request.ValidateRequest(), errMissingPubsubTopic)
|
||||||
request.Query.PubsubTopic = "test"
|
request.Request.PubsubTopic = "test"
|
||||||
require.ErrorIs(t, request.ValidateRequest(), errMissingMessage)
|
require.ErrorIs(t, request.ValidateRequest(), errMissingMessage)
|
||||||
request.Query.Message = &pb.WakuMessage{
|
request.Request.Message = &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: "test",
|
ContentTopic: "test",
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ func TestValidateRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateResponse(t *testing.T) {
|
func TestValidateResponse(t *testing.T) {
|
||||||
response := PushRPC{}
|
response := PushRpc{}
|
||||||
require.ErrorIs(t, response.ValidateResponse("test"), errMissingRequestID)
|
require.ErrorIs(t, response.ValidateResponse("test"), errMissingRequestID)
|
||||||
response.RequestId = "test1"
|
response.RequestId = "test1"
|
||||||
require.ErrorIs(t, response.ValidateResponse("test"), errRequestIDMismatch)
|
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) {
|
func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream) {
|
||||||
return func(stream network.Stream) {
|
return func(stream network.Stream) {
|
||||||
logger := wakuLP.log.With(logging.HostID("peer", stream.Conn().RemotePeer()))
|
logger := wakuLP.log.With(logging.HostID("peer", stream.Conn().RemotePeer()))
|
||||||
requestPushRPC := &pb.PushRPC{}
|
requestPushRPC := &pb.PushRpc{}
|
||||||
|
|
||||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||||
|
|
||||||
@ -99,13 +99,14 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
responsePushRPC := &pb.PushRPC{
|
responsePushRPC := &pb.PushRpc{
|
||||||
RequestId: requestPushRPC.RequestId,
|
RequestId: requestPushRPC.RequestId,
|
||||||
Response: &pb.PushResponse{},
|
Response: &pb.PushResponse{},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := requestPushRPC.ValidateRequest(); err != nil {
|
if err := requestPushRPC.ValidateRequest(); err != nil {
|
||||||
responsePushRPC.Response.Info = err.Error()
|
responseMsg := err.Error()
|
||||||
|
responsePushRPC.Response.Info = &responseMsg
|
||||||
wakuLP.metrics.RecordError(requestBodyFailure)
|
wakuLP.metrics.RecordError(requestBodyFailure)
|
||||||
wakuLP.reply(stream, responsePushRPC, logger)
|
wakuLP.reply(stream, responsePushRPC, logger)
|
||||||
return
|
return
|
||||||
@ -115,8 +116,8 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
|||||||
|
|
||||||
logger.Info("push request")
|
logger.Info("push request")
|
||||||
|
|
||||||
pubSubTopic := requestPushRPC.Query.PubsubTopic
|
pubSubTopic := requestPushRPC.Request.PubsubTopic
|
||||||
message := requestPushRPC.Query.Message
|
message := requestPushRPC.Request.Message
|
||||||
|
|
||||||
wakuLP.metrics.RecordMessage()
|
wakuLP.metrics.RecordMessage()
|
||||||
|
|
||||||
@ -127,11 +128,13 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("publishing message", zap.Error(err))
|
logger.Error("publishing message", zap.Error(err))
|
||||||
wakuLP.metrics.RecordError(messagePushFailure)
|
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
|
return
|
||||||
} else {
|
} else {
|
||||||
responsePushRPC.Response.IsSuccess = true
|
responsePushRPC.Response.IsSuccess = true
|
||||||
responsePushRPC.Response.Info = "OK"
|
responseMsg := "OK"
|
||||||
|
responsePushRPC.Response.Info = &responseMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
wakuLP.reply(stream, responsePushRPC, logger)
|
wakuLP.reply(stream, responsePushRPC, logger)
|
||||||
@ -143,12 +146,12 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(network.Stream)
|
|||||||
if responsePushRPC.Response.IsSuccess {
|
if responsePushRPC.Response.IsSuccess {
|
||||||
logger.Info("request success")
|
logger.Info("request success")
|
||||||
} else {
|
} 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)
|
writer := pbio.NewDelimitedWriter(stream)
|
||||||
err := writer.WriteMsg(responsePushRPC)
|
err := writer.WriteMsg(responsePushRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -180,7 +183,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, p
|
|||||||
wakuLP.metrics.RecordError(dialFailure)
|
wakuLP.metrics.RecordError(dialFailure)
|
||||||
return nil, err
|
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)
|
writer := pbio.NewDelimitedWriter(stream)
|
||||||
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
|
||||||
@ -195,7 +198,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, p
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pushResponseRPC := &pb.PushRPC{}
|
pushResponseRPC := &pb.PushRpc{}
|
||||||
err = reader.ReadMsg(pushResponseRPC)
|
err = reader.ReadMsg(pushResponseRPC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("reading response", zap.Error(err))
|
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 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
|
// Checking that msg hash is correct
|
||||||
hash, err := client.Publish(ctx, msg2, lpOptions...)
|
hash, err := client.Publish(ctx, msg2, lpOptions...)
|
||||||
require.NoError(t, err)
|
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()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ func TestWakuLightPushAutoSharding(t *testing.T) {
|
|||||||
// Verifying successful request
|
// Verifying successful request
|
||||||
hash1, err := client.Publish(ctx, msg1, lpOptions...)
|
hash1, err := client.Publish(ctx, msg1, lpOptions...)
|
||||||
require.NoError(t, err)
|
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()
|
wg.Wait()
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.31.0
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v3.21.12
|
// protoc v4.24.4
|
||||||
// source: waku_metadata.proto
|
// source: waku_metadata.proto
|
||||||
|
|
||||||
|
// rfc: https://rfc.vac.dev/spec/66/
|
||||||
|
|
||||||
package pb
|
package pb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -134,20 +136,21 @@ var File_waku_metadata_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_waku_metadata_proto_rawDesc = []byte{
|
var file_waku_metadata_proto_rawDesc = []byte{
|
||||||
0x0a, 0x13, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e,
|
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,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x74, 0x61,
|
||||||
0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x22, 0x60, 0x0a, 0x13, 0x57, 0x61, 0x6b, 0x75, 0x4d,
|
||||||
0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22,
|
||||||
0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49,
|
0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02,
|
0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x88,
|
||||||
0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b,
|
0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03,
|
||||||
0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x57,
|
0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63,
|
||||||
0x61, 0x6b, 0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x57, 0x61, 0x6b,
|
||||||
0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69,
|
0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74,
|
0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
|
||||||
0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64,
|
0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42,
|
0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18,
|
||||||
0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x62, 0x06,
|
0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x62, 0x06, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
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_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_waku_metadata_proto_goTypes = []interface{}{
|
var file_waku_metadata_proto_goTypes = []interface{}{
|
||||||
(*WakuMetadataRequest)(nil), // 0: pb.WakuMetadataRequest
|
(*WakuMetadataRequest)(nil), // 0: waku.metadata.v1.WakuMetadataRequest
|
||||||
(*WakuMetadataResponse)(nil), // 1: pb.WakuMetadataResponse
|
(*WakuMetadataResponse)(nil), // 1: waku.metadata.v1.WakuMetadataResponse
|
||||||
}
|
}
|
||||||
var file_waku_metadata_proto_depIdxs = []int32{
|
var file_waku_metadata_proto_depIdxs = []int32{
|
||||||
0, // [0:0] is the sub-list for method output_type
|
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/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
"github.com/waku-org/go-waku/waku/v2/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NoiseMessenger interface {
|
type NoiseMessenger interface {
|
||||||
@ -106,7 +107,7 @@ func (r *NoiseWakuRelay) Subscribe(ctx context.Context, contentTopic string) <-c
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if env.Message().ContentTopic != contentTopic || env.Message().Version != 2 {
|
if env.Message().ContentTopic != contentTopic || env.Message().GetVersion() != NoiseEncryption {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ func (r *NoiseWakuRelay) Publish(ctx context.Context, contentTopic string, paylo
|
|||||||
}
|
}
|
||||||
|
|
||||||
message.ContentTopic = contentTopic
|
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))
|
_, err = r.relay.Publish(ctx, message, relay.WithPubSubTopic(r.pubsubTopic))
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -5,12 +5,15 @@ import (
|
|||||||
|
|
||||||
n "github.com/waku-org/go-noise"
|
n "github.com/waku-org/go-noise"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"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
|
// DecodePayloadV2 decodes a WakuMessage to a PayloadV2
|
||||||
// Currently, this is just a wrapper over deserializePayloadV2 and encryption/decryption is done on top (no KeyInfo)
|
// 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) {
|
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 nil, errors.New("wrong message version while decoding payload")
|
||||||
}
|
}
|
||||||
return n.DeserializePayloadV2(message.Payload)
|
return n.DeserializePayloadV2(message.Payload)
|
||||||
@ -26,6 +29,6 @@ func EncodePayloadV2(payload2 *n.PayloadV2) (*pb.WakuMessage, error) {
|
|||||||
|
|
||||||
return &pb.WakuMessage{
|
return &pb.WakuMessage{
|
||||||
Payload: serializedPayload2,
|
Payload: serializedPayload2,
|
||||||
Version: 2,
|
Version: proto.Uint32(NoiseEncryption),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
29
waku/v2/protocol/pb/codec.go
Normal file
29
waku/v2/protocol/pb/codec.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *WakuMessage) MarshalJSON() ([]byte, error) {
|
||||||
|
return (protojson.MarshalOptions{}).Marshal(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Unmarshal(data []byte) (*WakuMessage, error) {
|
||||||
|
msg := &WakuMessage{}
|
||||||
|
err := proto.Unmarshal(data, msg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = msg.Validate()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *WakuMessage) UnmarshalJSON(data []byte) error {
|
||||||
|
return (protojson.UnmarshalOptions{}).Unmarshal(data, m)
|
||||||
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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/stretchr/testify/require"
|
||||||
"github.com/waku-org/go-waku/waku/v2/hash"
|
"github.com/waku-org/go-waku/waku/v2/hash"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHash(t *testing.T) {
|
func TestHash(t *testing.T) {
|
||||||
@ -18,8 +19,8 @@ func TestEnvelopeHash(t *testing.T) {
|
|||||||
msg := new(WakuMessage)
|
msg := new(WakuMessage)
|
||||||
msg.ContentTopic = "Test"
|
msg.ContentTopic = "Test"
|
||||||
msg.Payload = []byte("Hello World")
|
msg.Payload = []byte("Hello World")
|
||||||
msg.Timestamp = 123456789123456789
|
msg.Timestamp = proto.Int64(123456789123456789)
|
||||||
msg.Version = 1
|
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}
|
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")
|
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.Payload = []byte("\x01\x02\x03\x04TEST\x05\x06\x07\x08")
|
||||||
|
|
||||||
msg.Meta = []byte{}
|
msg.Meta = []byte{}
|
||||||
msg.Timestamp = 123456789123456789
|
msg.Timestamp = proto.Int64(123456789123456789)
|
||||||
msg.Version = 1
|
msg.Version = proto.Uint32(1)
|
||||||
|
|
||||||
messageHash := msg.Hash(pubsubTopic)
|
messageHash := msg.Hash(pubsubTopic)
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ func Test13ByteMeta(t *testing.T) {
|
|||||||
msg.ContentTopic = "/waku/2/default-content/proto"
|
msg.ContentTopic = "/waku/2/default-content/proto"
|
||||||
msg.Payload = []byte("\x01\x02\x03\x04TEST\x05\x06\x07\x08")
|
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.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)
|
messageHash := msg.Hash(pubsubTopic)
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ func TestZeroLenPayload(t *testing.T) {
|
|||||||
msg.ContentTopic = "/waku/2/default-content/proto"
|
msg.ContentTopic = "/waku/2/default-content/proto"
|
||||||
msg.Payload = []byte{}
|
msg.Payload = []byte{}
|
||||||
msg.Meta = []byte("\x73\x75\x70\x65\x72\x2d\x73\x65\x63\x72\x65\x74")
|
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)
|
messageHash := msg.Hash(pubsubTopic)
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,6 @@ package pb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxMetaAttrLength = 64
|
const MaxMetaAttrLength = 64
|
||||||
@ -29,19 +27,3 @@ func (msg *WakuMessage) Validate() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Unmarshal(data []byte) (*WakuMessage, error) {
|
|
||||||
msg := &WakuMessage{}
|
|
||||||
err := proto.Unmarshal(data, msg)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = msg.Validate()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return msg, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -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 {
|
for _, p := range response.PeerInfos {
|
||||||
enrRecord := &enr.Record{}
|
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 {
|
if err != nil {
|
||||||
wakuPX.log.Error("converting bytes to enr", zap.Error(err))
|
wakuPX.log.Error("converting bytes to enr", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/hashicorp/golang-lru/simplelru"
|
"github.com/hashicorp/golang-lru/simplelru"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/pb"
|
||||||
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
// simpleLRU internal uses container/list, which is ring buffer(double linked list)
|
// simpleLRU internal uses container/list, which is ring buffer(double linked list)
|
||||||
@ -17,14 +18,16 @@ type enrCache struct {
|
|||||||
data *simplelru.LRU
|
data *simplelru.LRU
|
||||||
rng *rand.Rand
|
rng *rand.Rand
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
|
log *zap.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
// err on negative size
|
// err on negative size
|
||||||
func newEnrCache(size int) (*enrCache, error) {
|
func newEnrCache(size int, log *zap.Logger) (*enrCache, error) {
|
||||||
inner, err := simplelru.NewLRU(size, nil)
|
inner, err := simplelru.NewLRU(size, nil)
|
||||||
return &enrCache{
|
return &enrCache{
|
||||||
data: inner,
|
data: inner,
|
||||||
rng: rand.New(rand.NewSource(rand.Int63())),
|
rng: rand.New(rand.NewSource(rand.Int63())),
|
||||||
|
log: log.Named("enr-cache"),
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +38,7 @@ func (c *enrCache) updateCache(node *enode.Node) {
|
|||||||
currNode, ok := c.data.Get(node.ID())
|
currNode, ok := c.data.Get(node.ID())
|
||||||
if !ok || node.Seq() > currNode.(*enode.Node).Seq() {
|
if !ok || node.Seq() > currNode.(*enode.Node).Seq() {
|
||||||
c.data.Add(node.ID(), node)
|
c.data.Add(node.ID(), node)
|
||||||
|
c.log.Debug("discovered px peer via discv5", zap.Stringer("enr", node))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +71,7 @@ func (c *enrCache) getENRs(neededPeers int) ([]*pb.PeerInfo, error) {
|
|||||||
}
|
}
|
||||||
writer.Flush()
|
writer.Flush()
|
||||||
result = append(result, &pb.PeerInfo{
|
result = append(result, &pb.PeerInfo{
|
||||||
ENR: b.Bytes(),
|
Enr: b.Bytes(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.26.0
|
// protoc-gen-go v1.31.0
|
||||||
// protoc v3.21.12
|
// protoc v4.24.4
|
||||||
// source: waku_peer_exchange.proto
|
// 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
|
package pb
|
||||||
|
|
||||||
@ -25,13 +28,13 @@ type PeerInfo struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *PeerInfo) Reset() {
|
||||||
*x = PeerInfo{}
|
*x = PeerInfo{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -44,7 +47,7 @@ func (x *PeerInfo) String() string {
|
|||||||
func (*PeerInfo) ProtoMessage() {}
|
func (*PeerInfo) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PeerInfo) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -57,12 +60,12 @@ func (x *PeerInfo) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.
|
||||||
func (*PeerInfo) Descriptor() ([]byte, []int) {
|
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 {
|
if x != nil {
|
||||||
return x.ENR
|
return x.Enr
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -72,13 +75,13 @@ type PeerExchangeQuery struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *PeerExchangeQuery) Reset() {
|
||||||
*x = PeerExchangeQuery{}
|
*x = PeerExchangeQuery{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -91,7 +94,7 @@ func (x *PeerExchangeQuery) String() string {
|
|||||||
func (*PeerExchangeQuery) ProtoMessage() {}
|
func (*PeerExchangeQuery) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PeerExchangeQuery) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -104,7 +107,7 @@ func (x *PeerExchangeQuery) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PeerExchangeQuery.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PeerExchangeQuery.ProtoReflect.Descriptor instead.
|
||||||
func (*PeerExchangeQuery) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *PeerExchangeQuery) GetNumPeers() uint64 {
|
||||||
@ -119,13 +122,13 @@ type PeerExchangeResponse struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *PeerExchangeResponse) Reset() {
|
||||||
*x = PeerExchangeResponse{}
|
*x = PeerExchangeResponse{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -138,7 +141,7 @@ func (x *PeerExchangeResponse) String() string {
|
|||||||
func (*PeerExchangeResponse) ProtoMessage() {}
|
func (*PeerExchangeResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PeerExchangeResponse) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -151,7 +154,7 @@ func (x *PeerExchangeResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PeerExchangeResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PeerExchangeResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*PeerExchangeResponse) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *PeerExchangeResponse) GetPeerInfos() []*PeerInfo {
|
||||||
@ -173,7 +176,7 @@ type PeerExchangeRPC struct {
|
|||||||
func (x *PeerExchangeRPC) Reset() {
|
func (x *PeerExchangeRPC) Reset() {
|
||||||
*x = PeerExchangeRPC{}
|
*x = PeerExchangeRPC{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -186,7 +189,7 @@ func (x *PeerExchangeRPC) String() string {
|
|||||||
func (*PeerExchangeRPC) ProtoMessage() {}
|
func (*PeerExchangeRPC) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *PeerExchangeRPC) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -199,7 +202,7 @@ func (x *PeerExchangeRPC) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use PeerExchangeRPC.ProtoReflect.Descriptor instead.
|
// Deprecated: Use PeerExchangeRPC.ProtoReflect.Descriptor instead.
|
||||||
func (*PeerExchangeRPC) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *PeerExchangeRPC) GetQuery() *PeerExchangeQuery {
|
||||||
@ -216,53 +219,60 @@ func (x *PeerExchangeRPC) GetResponse() *PeerExchangeResponse {
|
|||||||
return nil
|
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{
|
var file_peer_exchange_proto_rawDesc = []byte{
|
||||||
0x0a, 0x18, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68,
|
0x0a, 0x13, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e,
|
||||||
0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x1c,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72,
|
||||||
0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x45, 0x4e,
|
0x5f, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68,
|
||||||
0x52, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x45, 0x4e, 0x52, 0x22, 0x2f, 0x0a, 0x11,
|
0x61, 0x31, 0x22, 0x1c, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10,
|
||||||
0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72,
|
0x0a, 0x03, 0x65, 0x6e, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x65, 0x6e, 0x72,
|
||||||
0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20,
|
0x22, 0x30, 0x0a, 0x11, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||||
0x01, 0x28, 0x04, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x22, 0x42, 0x0a,
|
0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x75, 0x6d, 0x5f, 0x70, 0x65, 0x65,
|
||||||
0x14, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73,
|
0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66,
|
0x72, 0x73, 0x22, 0x5c, 0x0a, 0x14, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e,
|
||||||
0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65,
|
0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x70, 0x65,
|
||||||
0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
|
0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25,
|
||||||
0x73, 0x22, 0x74, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x63, 0x68, 0x61,
|
||||||
0x65, 0x52, 0x50, 0x43, 0x12, 0x2b, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20,
|
0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x65,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63,
|
0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73,
|
||||||
0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72,
|
0x22, 0xa6, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
||||||
0x79, 0x12, 0x34, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20,
|
0x65, 0x52, 0x50, 0x43, 0x12, 0x44, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x63,
|
0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x5f,
|
||||||
0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x08, 0x72,
|
0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x76, 0x32, 0x61, 0x6c, 0x70, 0x68, 0x61,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
file_waku_peer_exchange_proto_rawDescOnce sync.Once
|
file_peer_exchange_proto_rawDescOnce sync.Once
|
||||||
file_waku_peer_exchange_proto_rawDescData = file_waku_peer_exchange_proto_rawDesc
|
file_peer_exchange_proto_rawDescData = file_peer_exchange_proto_rawDesc
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_waku_peer_exchange_proto_rawDescGZIP() []byte {
|
func file_peer_exchange_proto_rawDescGZIP() []byte {
|
||||||
file_waku_peer_exchange_proto_rawDescOnce.Do(func() {
|
file_peer_exchange_proto_rawDescOnce.Do(func() {
|
||||||
file_waku_peer_exchange_proto_rawDescData = protoimpl.X.CompressGZIP(file_waku_peer_exchange_proto_rawDescData)
|
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_peer_exchange_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
var file_waku_peer_exchange_proto_goTypes = []interface{}{
|
var file_peer_exchange_proto_goTypes = []interface{}{
|
||||||
(*PeerInfo)(nil), // 0: pb.PeerInfo
|
(*PeerInfo)(nil), // 0: waku.peer_exchange.v2alpha1.PeerInfo
|
||||||
(*PeerExchangeQuery)(nil), // 1: pb.PeerExchangeQuery
|
(*PeerExchangeQuery)(nil), // 1: waku.peer_exchange.v2alpha1.PeerExchangeQuery
|
||||||
(*PeerExchangeResponse)(nil), // 2: pb.PeerExchangeResponse
|
(*PeerExchangeResponse)(nil), // 2: waku.peer_exchange.v2alpha1.PeerExchangeResponse
|
||||||
(*PeerExchangeRPC)(nil), // 3: pb.PeerExchangeRPC
|
(*PeerExchangeRPC)(nil), // 3: waku.peer_exchange.v2alpha1.PeerExchangeRPC
|
||||||
}
|
}
|
||||||
var file_waku_peer_exchange_proto_depIdxs = []int32{
|
var file_peer_exchange_proto_depIdxs = []int32{
|
||||||
0, // 0: pb.PeerExchangeResponse.peerInfos:type_name -> pb.PeerInfo
|
0, // 0: waku.peer_exchange.v2alpha1.PeerExchangeResponse.peer_infos:type_name -> waku.peer_exchange.v2alpha1.PeerInfo
|
||||||
1, // 1: pb.PeerExchangeRPC.query:type_name -> pb.PeerExchangeQuery
|
1, // 1: waku.peer_exchange.v2alpha1.PeerExchangeRPC.query:type_name -> waku.peer_exchange.v2alpha1.PeerExchangeQuery
|
||||||
2, // 2: pb.PeerExchangeRPC.response:type_name -> pb.PeerExchangeResponse
|
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 output_type
|
||||||
3, // [3:3] is the sub-list for method input_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 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
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_waku_peer_exchange_proto_init() }
|
func init() { file_peer_exchange_proto_init() }
|
||||||
func file_waku_peer_exchange_proto_init() {
|
func file_peer_exchange_proto_init() {
|
||||||
if File_waku_peer_exchange_proto != nil {
|
if File_peer_exchange_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
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 {
|
switch v := v.(*PeerInfo); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -288,7 +298,7 @@ func file_waku_peer_exchange_proto_init() {
|
|||||||
return nil
|
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 {
|
switch v := v.(*PeerExchangeQuery); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -300,7 +310,7 @@ func file_waku_peer_exchange_proto_init() {
|
|||||||
return nil
|
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 {
|
switch v := v.(*PeerExchangeResponse); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -312,7 +322,7 @@ func file_waku_peer_exchange_proto_init() {
|
|||||||
return nil
|
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 {
|
switch v := v.(*PeerExchangeRPC); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -329,18 +339,18 @@ func file_waku_peer_exchange_proto_init() {
|
|||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_waku_peer_exchange_proto_rawDesc,
|
RawDescriptor: file_peer_exchange_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 4,
|
NumMessages: 4,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
GoTypes: file_waku_peer_exchange_proto_goTypes,
|
GoTypes: file_peer_exchange_proto_goTypes,
|
||||||
DependencyIndexes: file_waku_peer_exchange_proto_depIdxs,
|
DependencyIndexes: file_peer_exchange_proto_depIdxs,
|
||||||
MessageInfos: file_waku_peer_exchange_proto_msgTypes,
|
MessageInfos: file_peer_exchange_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_waku_peer_exchange_proto = out.File
|
File_peer_exchange_proto = out.File
|
||||||
file_waku_peer_exchange_proto_rawDesc = nil
|
file_peer_exchange_proto_rawDesc = nil
|
||||||
file_waku_peer_exchange_proto_goTypes = nil
|
file_peer_exchange_proto_goTypes = nil
|
||||||
file_waku_peer_exchange_proto_depIdxs = 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;
|
|
||||||
}
|
|
||||||
@ -53,19 +53,21 @@ type WakuPeerExchange struct {
|
|||||||
// Takes an optional peermanager if WakuPeerExchange is being created along with WakuNode.
|
// Takes an optional peermanager if WakuPeerExchange is being created along with WakuNode.
|
||||||
// If using libp2p host, then pass peermanager as nil
|
// If using libp2p host, then pass peermanager as nil
|
||||||
func NewWakuPeerExchange(disc *discv5.DiscoveryV5, peerConnector PeerConnector, pm *peermanager.PeerManager, reg prometheus.Registerer, log *zap.Logger) (*WakuPeerExchange, error) {
|
func NewWakuPeerExchange(disc *discv5.DiscoveryV5, peerConnector PeerConnector, pm *peermanager.PeerManager, reg prometheus.Registerer, log *zap.Logger) (*WakuPeerExchange, error) {
|
||||||
newEnrCache, err := newEnrCache(MaxCacheSize)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
wakuPX := new(WakuPeerExchange)
|
wakuPX := new(WakuPeerExchange)
|
||||||
wakuPX.disc = disc
|
wakuPX.disc = disc
|
||||||
wakuPX.metrics = newMetrics(reg)
|
wakuPX.metrics = newMetrics(reg)
|
||||||
wakuPX.log = log.Named("wakupx")
|
wakuPX.log = log.Named("wakupx")
|
||||||
wakuPX.enrCache = newEnrCache
|
|
||||||
wakuPX.peerConnector = peerConnector
|
wakuPX.peerConnector = peerConnector
|
||||||
wakuPX.pm = pm
|
wakuPX.pm = pm
|
||||||
wakuPX.CommonService = service.NewCommonService()
|
wakuPX.CommonService = service.NewCommonService()
|
||||||
|
|
||||||
|
newEnrCache, err := newEnrCache(MaxCacheSize, wakuPX.log)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
wakuPX.enrCache = newEnrCache
|
||||||
|
|
||||||
return wakuPX, nil
|
return wakuPX, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +161,6 @@ func (wakuPX *WakuPeerExchange) iterate(ctx context.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
wakuPX.log.Debug("Discovered px peers via discv5")
|
|
||||||
wakuPX.enrCache.updateCache(iterator.Node())
|
wakuPX.enrCache.updateCache(iterator.Node())
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|||||||
@ -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)
|
b.Submit(env)
|
||||||
|
|
||||||
wg.Wait()
|
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)
|
b.Submit(env)
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
@ -81,7 +81,7 @@ func TestBroadcastUnregisterSub(t *testing.T) {
|
|||||||
specificSub := b.Register(protocol.NewContentFilter("abc"))
|
specificSub := b.Register(protocol.NewContentFilter("abc"))
|
||||||
specificSub.Unsubscribe()
|
specificSub.Unsubscribe()
|
||||||
//
|
//
|
||||||
env := protocol.NewEnvelope(&pb.WakuMessage{}, utils.GetUnixEpoch(), "abc")
|
env := protocol.NewEnvelope(&pb.WakuMessage{}, *utils.GetUnixEpoch(), "abc")
|
||||||
b.Submit(env)
|
b.Submit(env)
|
||||||
// no message on specific sub
|
// no message on specific sub
|
||||||
require.Nil(t, <-specificSub.Ch)
|
require.Nil(t, <-specificSub.Ch)
|
||||||
@ -96,7 +96,7 @@ func TestBroadcastNoOneListening(t *testing.T) {
|
|||||||
require.NoError(t, b.Start(context.Background()))
|
require.NoError(t, b.Start(context.Background()))
|
||||||
_ = b.RegisterForAll() // no one listening on channel
|
_ = 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.Submit(env)
|
b.Submit(env)
|
||||||
b.Stop()
|
b.Stop()
|
||||||
|
|||||||
@ -21,10 +21,10 @@ import (
|
|||||||
|
|
||||||
func msgHash(pubSubTopic string, msg *pb.WakuMessage) []byte {
|
func msgHash(pubSubTopic string, msg *pb.WakuMessage) []byte {
|
||||||
timestampBytes := make([]byte, 8)
|
timestampBytes := make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(timestampBytes, uint64(msg.Timestamp))
|
binary.LittleEndian.PutUint64(timestampBytes, uint64(msg.GetTimestamp()))
|
||||||
|
|
||||||
var ephemeralByte byte
|
var ephemeralByte byte
|
||||||
if msg.Ephemeral {
|
if msg.GetEphemeral() {
|
||||||
ephemeralByte = 1
|
ephemeralByte = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,12 +101,12 @@ func (w *WakuRelay) AddSignedTopicValidator(topic string, publicKey *ecdsa.Publi
|
|||||||
const messageWindowDuration = time.Minute * 5
|
const messageWindowDuration = time.Minute * 5
|
||||||
|
|
||||||
func withinTimeWindow(t timesource.Timesource, msg *pb.WakuMessage) bool {
|
func withinTimeWindow(t timesource.Timesource, msg *pb.WakuMessage) bool {
|
||||||
if msg.Timestamp == 0 {
|
if msg.GetTimestamp() == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
now := t.Now()
|
now := t.Now()
|
||||||
msgTime := time.Unix(0, msg.Timestamp)
|
msgTime := time.Unix(0, msg.GetTimestamp())
|
||||||
|
|
||||||
return now.Sub(msgTime).Abs() <= messageWindowDuration
|
return now.Sub(msgTime).Abs() <= messageWindowDuration
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
|
proto "google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FakeTimesource struct {
|
type FakeTimesource struct {
|
||||||
@ -46,8 +47,8 @@ func TestMsgHash(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: payload,
|
Payload: payload,
|
||||||
ContentTopic: contentTopic,
|
ContentTopic: contentTopic,
|
||||||
Timestamp: timestamp.UnixNano(),
|
Timestamp: proto.Int64(timestamp.UnixNano()),
|
||||||
Ephemeral: ephemeral,
|
Ephemeral: proto.Bool(ephemeral),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := SignMessage(prvKey, msg, protectedPubSubTopic)
|
err := SignMessage(prvKey, msg, protectedPubSubTopic)
|
||||||
|
|||||||
@ -219,7 +219,7 @@ func (w *WakuRelay) subscribeToPubsubTopic(topic string) (subs *pubsub.Subscript
|
|||||||
return nil, err
|
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
|
return sub, nil
|
||||||
@ -292,6 +292,9 @@ func (w *WakuRelay) GetSubscriptionWithPubsubTopic(pubsubTopic string, contentTo
|
|||||||
cSubs := w.contentSubs[pubsubTopic]
|
cSubs := w.contentSubs[pubsubTopic]
|
||||||
for _, sub := range cSubs {
|
for _, sub := range cSubs {
|
||||||
if sub.contentFilter.Equals(contentFilter) {
|
if sub.contentFilter.Equals(contentFilter) {
|
||||||
|
if sub.noConsume { //This check is to ensure that default no-consumer subscription is not returned
|
||||||
|
continue
|
||||||
|
}
|
||||||
return sub, nil
|
return sub, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,6 +311,9 @@ func (w *WakuRelay) GetSubscription(contentTopic string) (*Subscription, error)
|
|||||||
cSubs := w.contentSubs[pubsubTopic]
|
cSubs := w.contentSubs[pubsubTopic]
|
||||||
for _, sub := range cSubs {
|
for _, sub := range cSubs {
|
||||||
if sub.contentFilter.Equals(contentFilter) {
|
if sub.contentFilter.Equals(contentFilter) {
|
||||||
|
if sub.noConsume { //This check is to ensure that default no-consumer subscription is not returned
|
||||||
|
continue
|
||||||
|
}
|
||||||
return sub, nil
|
return sub, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package relay
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -13,6 +12,7 @@ import (
|
|||||||
"github.com/libp2p/go-libp2p/core/peerstore"
|
"github.com/libp2p/go-libp2p/core/peerstore"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/stretchr/testify/require"
|
"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/tests"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol"
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
||||||
@ -52,16 +52,13 @@ func TestWakuRelay(t *testing.T) {
|
|||||||
bytesToSend := []byte{1}
|
bytesToSend := []byte{1}
|
||||||
go func() {
|
go func() {
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
env := <-subs[0].Ch
|
||||||
msg := <-subs[0].Ch
|
t.Log("received msg", logging.HexString("hash", env.Hash()))
|
||||||
fmt.Println("msg received ", msg)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: bytesToSend,
|
Payload: bytesToSend,
|
||||||
Version: 0,
|
|
||||||
ContentTopic: "test",
|
ContentTopic: "test",
|
||||||
Timestamp: 0,
|
|
||||||
}
|
}
|
||||||
_, err = relay.Publish(context.Background(), msg, WithPubSubTopic(testTopic))
|
_, err = relay.Publish(context.Background(), msg, WithPubSubTopic(testTopic))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -115,7 +112,7 @@ func TestGossipsubScore(t *testing.T) {
|
|||||||
for {
|
for {
|
||||||
_, err := sub.Next(context.Background())
|
_, err := sub.Next(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -194,7 +191,6 @@ func waitForMsg(t *testing.T, ch chan *protocol.Envelope, cTopicExpected string)
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
select {
|
select {
|
||||||
case env := <-ch:
|
case env := <-ch:
|
||||||
fmt.Println("msg received", env)
|
|
||||||
require.Equal(t, cTopicExpected, env.Message().GetContentTopic())
|
require.Equal(t, cTopicExpected, env.Message().GetContentTopic())
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(5 * time.Second):
|
||||||
t.Error("Message timeout")
|
t.Error("Message timeout")
|
||||||
@ -251,9 +247,7 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
|||||||
|
|
||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: bytesToSend,
|
Payload: bytesToSend,
|
||||||
Version: 0,
|
|
||||||
ContentTopic: testcTopic,
|
ContentTopic: testcTopic,
|
||||||
Timestamp: 0,
|
|
||||||
}
|
}
|
||||||
_, err = relay.Publish(context.Background(), msg)
|
_, err = relay.Publish(context.Background(), msg)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -268,9 +262,7 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
|||||||
|
|
||||||
msg1 := &pb.WakuMessage{
|
msg1 := &pb.WakuMessage{
|
||||||
Payload: bytesToSend,
|
Payload: bytesToSend,
|
||||||
Version: 0,
|
|
||||||
ContentTopic: testcTopic1,
|
ContentTopic: testcTopic1,
|
||||||
Timestamp: 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = relay.Publish(context.Background(), msg1, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
_, err = relay.Publish(context.Background(), msg1, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
||||||
@ -295,9 +287,8 @@ func TestWakuRelayAutoShard(t *testing.T) {
|
|||||||
|
|
||||||
msg2 := &pb.WakuMessage{
|
msg2 := &pb.WakuMessage{
|
||||||
Payload: bytesToSend,
|
Payload: bytesToSend,
|
||||||
Version: 0,
|
|
||||||
ContentTopic: testcTopic1,
|
ContentTopic: testcTopic1,
|
||||||
Timestamp: 1,
|
Timestamp: utils.GetUnixEpoch(),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = relay.Publish(context.Background(), msg2, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
_, err = relay.Publish(context.Background(), msg2, WithPubSubTopic(subs[0].contentFilter.PubsubTopic))
|
||||||
|
|||||||
@ -3,7 +3,9 @@ package rln
|
|||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
"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"
|
"github.com/waku-org/go-zerokit-rln/rln"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type messageValidationResult int
|
type messageValidationResult int
|
||||||
@ -37,20 +39,27 @@ func toRLNSignal(wakuMessage *pb.WakuMessage) []byte {
|
|||||||
return append(wakuMessage.Payload, contentTopicBytes...)
|
return append(wakuMessage.Payload, contentTopicBytes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func toRateLimitProof(msg *pb.WakuMessage) *rln.RateLimitProof {
|
// Bytres2RateLimitProof converts a slice of bytes into a RateLimitProof instance
|
||||||
if msg == nil || msg.RateLimitProof == nil {
|
func BytesToRateLimitProof(data []byte) (*rln.RateLimitProof, error) {
|
||||||
return nil
|
if data == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
rateLimitProof := &rlnpb.RateLimitProof{}
|
||||||
|
err := proto.Unmarshal(data, rateLimitProof)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result := &rln.RateLimitProof{
|
result := &rln.RateLimitProof{
|
||||||
Proof: rln.ZKSNARK(rln.Bytes128(msg.RateLimitProof.Proof)),
|
Proof: rln.ZKSNARK(rln.Bytes128(rateLimitProof.Proof)),
|
||||||
MerkleRoot: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.MerkleRoot)),
|
MerkleRoot: rln.MerkleNode(rln.Bytes32(rateLimitProof.MerkleRoot)),
|
||||||
Epoch: rln.Epoch(rln.Bytes32(msg.RateLimitProof.Epoch)),
|
Epoch: rln.Epoch(rln.Bytes32(rateLimitProof.Epoch)),
|
||||||
ShareX: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.ShareX)),
|
ShareX: rln.MerkleNode(rln.Bytes32(rateLimitProof.ShareX)),
|
||||||
ShareY: rln.MerkleNode(rln.Bytes32(msg.RateLimitProof.ShareY)),
|
ShareY: rln.MerkleNode(rln.Bytes32(rateLimitProof.ShareY)),
|
||||||
Nullifier: rln.Nullifier(rln.Bytes32(msg.RateLimitProof.Nullifier)),
|
Nullifier: rln.Nullifier(rln.Bytes32(rateLimitProof.Nullifier)),
|
||||||
RLNIdentifier: rln.RLNIdentifier(rln.Bytes32(msg.RateLimitProof.RlnIdentifier)),
|
RLNIdentifier: rln.RLNIdentifier(rln.Bytes32(rateLimitProof.RlnIdentifier)),
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,10 +101,11 @@ var (
|
|||||||
type invalidCategory string
|
type invalidCategory string
|
||||||
|
|
||||||
var (
|
var (
|
||||||
invalidNoProof invalidCategory = "no_proof"
|
invalidNoProof invalidCategory = "no_proof"
|
||||||
invalidEpoch invalidCategory = "invalid_epoch"
|
invalidEpoch invalidCategory = "invalid_epoch"
|
||||||
invalidRoot invalidCategory = "invalid_root"
|
invalidRoot invalidCategory = "invalid_root"
|
||||||
invalidProof invalidCategory = "invalid_proof"
|
invalidProof invalidCategory = "invalid_proof"
|
||||||
|
proofExtractionErr invalidCategory = "invalid_proof_extract_err"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Metrics exposes the functions required to update prometheus metrics for lightpush protocol
|
// 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/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"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/rln/group_manager/static"
|
"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/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
r "github.com/waku-org/go-zerokit-rln/rln"
|
r "github.com/waku-org/go-zerokit-rln/rln"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWakuRLNRelaySuite(t *testing.T) {
|
func TestWakuRLNRelaySuite(t *testing.T) {
|
||||||
@ -114,13 +116,23 @@ func (s *WakuRLNRelaySuite) TestUpdateLogAndHasDuplicate() {
|
|||||||
shareY3[i] = shareX3[i]
|
shareY3[i] = shareX3[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
wm1 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier1[:], ShareX: shareX1[:], ShareY: shareY1[:]}}
|
rlpProof1, err := proto.Marshal(&rlnpb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier1[:], ShareX: shareX1[:], ShareY: shareY1[:]})
|
||||||
wm2 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier2[:], ShareX: shareX2[:], ShareY: shareY2[:]}}
|
s.Require().NoError(err)
|
||||||
wm3 := &pb.WakuMessage{RateLimitProof: &pb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier3[:], ShareX: shareX3[:], ShareY: shareY3[:]}}
|
|
||||||
|
|
||||||
msgProof1 := toRateLimitProof(wm1)
|
rlpProof2, err := proto.Marshal(&rlnpb.RateLimitProof{Epoch: epoch[:], Nullifier: nullifier2[:], ShareX: shareX2[:], ShareY: shareY2[:]})
|
||||||
msgProof2 := toRateLimitProof(wm2)
|
s.Require().NoError(err)
|
||||||
msgProof3 := toRateLimitProof(wm3)
|
|
||||||
|
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)
|
md1, err := rlnInstance.ExtractMetadata(*msgProof1)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|||||||
@ -11,9 +11,11 @@ import (
|
|||||||
"github.com/waku-org/go-waku/logging"
|
"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/pb"
|
||||||
"github.com/waku-org/go-waku/waku/v2/protocol/rln/group_manager"
|
"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-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-zerokit-rln/rln"
|
"github.com/waku-org/go-zerokit-rln/rln"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WakuRLNRelay struct {
|
type WakuRLNRelay struct {
|
||||||
@ -106,7 +108,12 @@ func (rlnRelay *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime
|
|||||||
epoch = rln.CalcEpoch(rlnRelay.timesource.Now())
|
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 {
|
if msgProof == nil {
|
||||||
// message does not contain a proof
|
// message does not contain a proof
|
||||||
rlnRelay.log.Debug("invalid message: 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)) {
|
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)
|
rlnRelay.metrics.RecordInvalidMessage(invalidRoot)
|
||||||
return invalidMessage, nil
|
return invalidMessage, nil
|
||||||
}
|
}
|
||||||
@ -206,7 +213,12 @@ func (rlnRelay *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTim
|
|||||||
}
|
}
|
||||||
rlnRelay.metrics.RecordProofGeneration(time.Since(start))
|
rlnRelay.metrics.RecordProofGeneration(time.Since(start))
|
||||||
|
|
||||||
msg.RateLimitProof = proof
|
b, err := proto.Marshal(proof)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.RateLimitProof = b
|
||||||
|
|
||||||
return nil
|
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()
|
identityCredentials, err := rlnRelay.GroupManager.IdentityCredentials()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -275,7 +287,7 @@ func (rlnRelay *WakuRLNRelay) generateProof(input []byte, epoch rln.Epoch) (*pb.
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &pb.RateLimitProof{
|
return &rlnpb.RateLimitProof{
|
||||||
Proof: proof.Proof[:],
|
Proof: proof.Proof[:],
|
||||||
MerkleRoot: proof.MerkleRoot[:],
|
MerkleRoot: proof.MerkleRoot[:],
|
||||||
Epoch: proof.Epoch[:],
|
Epoch: proof.Epoch[:],
|
||||||
|
|||||||
@ -225,7 +225,7 @@ func FromBitVector(buf []byte) (RelayShards, error) {
|
|||||||
// This is based on Autosharding algorithm defined in RFC 51
|
// This is based on Autosharding algorithm defined in RFC 51
|
||||||
func GetShardFromContentTopic(topic ContentTopic, shardCount int) StaticShardingPubsubTopic {
|
func GetShardFromContentTopic(topic ContentTopic, shardCount int) StaticShardingPubsubTopic {
|
||||||
bytes := []byte(topic.ApplicationName)
|
bytes := []byte(topic.ApplicationName)
|
||||||
bytes = append(bytes, []byte(fmt.Sprintf("%d", topic.ApplicationVersion))...)
|
bytes = append(bytes, []byte(topic.ApplicationVersion)...)
|
||||||
|
|
||||||
hash := hash.SHA256(bytes)
|
hash := hash.SHA256(bytes)
|
||||||
//We only use the last 64 bits of the hash as having more shards is unlikely.
|
//We only use the last 64 bits of the hash as having more shards is unlikely.
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
package pb
|
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/protocol/relay"
|
||||||
"github.com/waku-org/go-waku/waku/v2/timesource"
|
"github.com/waku-org/go-waku/waku/v2/timesource"
|
||||||
"github.com/waku-org/go-waku/waku/v2/utils"
|
"github.com/waku-org/go-waku/waku/v2/utils"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFindLastSeenMessage(t *testing.T) {
|
func TestFindLastSeenMessage(t *testing.T) {
|
||||||
now := utils.GetUnixEpoch()
|
now := *utils.GetUnixEpoch()
|
||||||
msg1 := protocol.NewEnvelope(tests.CreateWakuMessage("1", now+1), utils.GetUnixEpoch(), "test")
|
msg1 := protocol.NewEnvelope(tests.CreateWakuMessage("1", proto.Int64(now+1)), *utils.GetUnixEpoch(), "test")
|
||||||
msg2 := protocol.NewEnvelope(tests.CreateWakuMessage("2", now+2), utils.GetUnixEpoch(), "test")
|
msg2 := protocol.NewEnvelope(tests.CreateWakuMessage("2", proto.Int64(now+2)), *utils.GetUnixEpoch(), "test")
|
||||||
msg3 := protocol.NewEnvelope(tests.CreateWakuMessage("3", now+3), utils.GetUnixEpoch(), "test")
|
msg3 := protocol.NewEnvelope(tests.CreateWakuMessage("3", proto.Int64(now+3)), *utils.GetUnixEpoch(), "test")
|
||||||
msg4 := protocol.NewEnvelope(tests.CreateWakuMessage("4", now+4), utils.GetUnixEpoch(), "test")
|
msg4 := protocol.NewEnvelope(tests.CreateWakuMessage("4", proto.Int64(now+4)), *utils.GetUnixEpoch(), "test")
|
||||||
msg5 := protocol.NewEnvelope(tests.CreateWakuMessage("5", now+5), 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 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger())
|
||||||
_ = s.storeMessage(msg1)
|
_ = s.storeMessage(msg1)
|
||||||
@ -35,7 +36,7 @@ func TestFindLastSeenMessage(t *testing.T) {
|
|||||||
lastSeen, err := s.findLastSeen()
|
lastSeen, err := s.findLastSeen()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Equal(t, msg5.Message().Timestamp, lastSeen)
|
require.Equal(t, msg5.Message().GetTimestamp(), lastSeen)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResume(t *testing.T) {
|
func TestResume(t *testing.T) {
|
||||||
@ -53,15 +54,15 @@ func TestResume(t *testing.T) {
|
|||||||
|
|
||||||
defer s1.Stop()
|
defer s1.Stop()
|
||||||
|
|
||||||
now := utils.GetUnixEpoch()
|
now := *utils.GetUnixEpoch()
|
||||||
for i := 0; i < 10; i++ {
|
for i := int64(0); i < 10; i++ {
|
||||||
var contentTopic = "1"
|
var contentTopic = "1"
|
||||||
if i%2 == 0 {
|
if i%2 == 0 {
|
||||||
contentTopic = "2"
|
contentTopic = "2"
|
||||||
}
|
}
|
||||||
|
|
||||||
wakuMessage := tests.CreateWakuMessage(contentTopic, now+int64(i+1))
|
wakuMessage := tests.CreateWakuMessage(contentTopic, proto.Int64(now+i+1))
|
||||||
msg := protocol.NewEnvelope(wakuMessage, utils.GetUnixEpoch(), "test")
|
msg := protocol.NewEnvelope(wakuMessage, *utils.GetUnixEpoch(), "test")
|
||||||
_ = s1.storeMessage(msg)
|
_ = s1.storeMessage(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,9 +118,9 @@ func TestResumeWithListOfPeers(t *testing.T) {
|
|||||||
|
|
||||||
defer s1.Stop()
|
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"))
|
host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -162,9 +163,9 @@ func TestResumeWithoutSpecifyingPeer(t *testing.T) {
|
|||||||
|
|
||||||
defer s1.Stop()
|
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"))
|
host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -20,8 +20,8 @@ import (
|
|||||||
type Query struct {
|
type Query struct {
|
||||||
PubsubTopic string
|
PubsubTopic string
|
||||||
ContentTopics []string
|
ContentTopics []string
|
||||||
StartTime int64
|
StartTime *int64
|
||||||
EndTime int64
|
EndTime *int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result represents a valid response from a store node
|
// 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) {
|
func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error) {
|
||||||
|
|
||||||
params := new(HistoryRequestParameters)
|
params := new(HistoryRequestParameters)
|
||||||
params.s = store
|
params.s = store
|
||||||
|
|
||||||
|
|||||||
@ -19,36 +19,36 @@ func TestIndexComputation(t *testing.T) {
|
|||||||
Timestamp: utils.GetUnixEpoch(),
|
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.NotZero(t, idx.ReceiverTime)
|
||||||
require.Equal(t, msg.Timestamp, idx.SenderTime)
|
require.Equal(t, msg.GetTimestamp(), idx.SenderTime)
|
||||||
require.NotZero(t, idx.Digest)
|
require.NotZero(t, idx.Digest)
|
||||||
require.Len(t, idx.Digest, 32)
|
require.Len(t, idx.Digest, 32)
|
||||||
|
|
||||||
msg1 := &wpb.WakuMessage{
|
msg1 := &wpb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
Timestamp: 123,
|
Timestamp: proto.Int64(123),
|
||||||
ContentTopic: testContentTopic,
|
ContentTopic: testContentTopic,
|
||||||
}
|
}
|
||||||
idx1 := protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), "test").Index()
|
idx1 := protocol.NewEnvelope(msg1, *utils.GetUnixEpoch(), "test").Index()
|
||||||
|
|
||||||
msg2 := &wpb.WakuMessage{
|
msg2 := &wpb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
Timestamp: 123,
|
Timestamp: proto.Int64(123),
|
||||||
ContentTopic: testContentTopic,
|
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)
|
require.Equal(t, idx1.Digest, idx2.Digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSampleList(s int) []*protocol.Envelope {
|
func createSampleList(s int) []*protocol.Envelope {
|
||||||
var result []*protocol.Envelope
|
var result []*protocol.Envelope
|
||||||
for i := 0; i < s; i++ {
|
for i := 1; i <= s; i++ {
|
||||||
msg :=
|
msg :=
|
||||||
&wpb.WakuMessage{
|
&wpb.WakuMessage{
|
||||||
Payload: []byte{byte(i)},
|
Payload: []byte{byte(i)},
|
||||||
Timestamp: int64(i),
|
Timestamp: proto.Int64(int64(i)),
|
||||||
}
|
}
|
||||||
result = append(result, protocol.NewEnvelope(msg, int64(i), "abc"))
|
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)
|
messages, newPagingInfo, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, messages, 2)
|
require.Len(t, messages, 2)
|
||||||
|
require.Equal(t, msgList[0].Message(), messages[0])
|
||||||
|
|
||||||
require.True(t, proto.Equal(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.True(t, proto.Equal(msgList[1].Message(), messages[1]))
|
||||||
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
require.Equal(t, msgList[1].Index(), newPagingInfo.Cursor)
|
||||||
@ -120,7 +122,7 @@ func TestForwardPagination(t *testing.T) {
|
|||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an invalid cursor
|
// test for an invalid cursor
|
||||||
invalidIndex := protocol.NewEnvelope(&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}
|
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_FORWARD}
|
||||||
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
||||||
@ -207,7 +209,7 @@ func TestBackwardPagination(t *testing.T) {
|
|||||||
require.Nil(t, newPagingInfo.Cursor)
|
require.Nil(t, newPagingInfo.Cursor)
|
||||||
|
|
||||||
// test for an invalid cursor
|
// test for an invalid cursor
|
||||||
invalidIndex := protocol.NewEnvelope(&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}
|
pagingInfo = &pb.PagingInfo{PageSize: 10, Cursor: invalidIndex, Direction: pb.PagingInfo_BACKWARD}
|
||||||
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
_, _, err = findMessages(&pb.HistoryQuery{PagingInfo: pagingInfo}, db)
|
||||||
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
require.ErrorIs(t, err, persistence.ErrInvalidCursor)
|
||||||
|
|||||||
@ -22,20 +22,18 @@ func TestStorePersistence(t *testing.T) {
|
|||||||
msg := &pb.WakuMessage{
|
msg := &pb.WakuMessage{
|
||||||
Payload: []byte{1, 2, 3},
|
Payload: []byte{1, 2, 3},
|
||||||
ContentTopic: defaultContentTopic,
|
ContentTopic: defaultContentTopic,
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
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)
|
require.NoError(t, err)
|
||||||
|
|
||||||
msg2 := &pb.WakuMessage{
|
msg2 := &pb.WakuMessage{
|
||||||
Payload: []byte{4, 5, 6},
|
Payload: []byte{4, 5, 6},
|
||||||
ContentTopic: defaultContentTopic,
|
ContentTopic: defaultContentTopic,
|
||||||
Version: 0,
|
|
||||||
Timestamp: utils.GetUnixEpoch(),
|
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)
|
require.NoError(t, err)
|
||||||
|
|
||||||
allMsgs, err := db.GetAll()
|
allMsgs, err := db.GetAll()
|
||||||
@ -44,6 +42,6 @@ func TestStorePersistence(t *testing.T) {
|
|||||||
require.True(t, proto.Equal(msg, allMsgs[0].Message))
|
require.True(t, proto.Equal(msg, allMsgs[0].Message))
|
||||||
|
|
||||||
// Storing a duplicated message should not crash. It's okay to generate an error log in this case
|
// Storing a duplicated message should not crash. It's okay to generate an error log in this case
|
||||||
err = s1.storeMessage(protocol.NewEnvelope(msg, utils.GetUnixEpoch(), defaultPubSubTopic))
|
err = s1.storeMessage(protocol.NewEnvelope(msg, *utils.GetUnixEpoch(), defaultPubSubTopic))
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user