rpc

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adder

type Adder func(msg *protocol.Envelope)

type AdminService

type AdminService struct {
	// contains filtered or unexported fields
}

func (*AdminService) GetV1Peers

func (a *AdminService) GetV1Peers(req *http.Request, args *GetPeersArgs, reply *PeersReply) error

func (*AdminService) PostV1Peers

func (a *AdminService) PostV1Peers(req *http.Request, args *PeersArgs, reply *SuccessReply) error

type Base64URLByte

type Base64URLByte []byte

func (*Base64URLByte) UnmarshalText

func (h *Base64URLByte) UnmarshalText(b []byte) error

UnmarshalText is used by json.Unmarshal to decode both url-safe and standard base64 encoded strings with and without padding

type CodecRequest

type CodecRequest struct {
	// contains filtered or unexported fields
}

CodecRequest decodes and encodes a single request.

func (*CodecRequest) Method

func (c *CodecRequest) Method() (string, error)

Method returns the RPC method for the current request.

The method uses a dotted notation as in "Service.Method".

func (*CodecRequest) ReadRequest

func (c *CodecRequest) ReadRequest(args interface{}) error

ReadRequest fills the request object for the RPC method.

func (*CodecRequest) WriteError

func (c *CodecRequest) WriteError(w http.ResponseWriter, _ int, err error)

func (*CodecRequest) WriteResponse

func (c *CodecRequest) WriteResponse(w http.ResponseWriter, reply interface{})

WriteResponse encodes the response and writes it to the ResponseWriter.

type ContentTopicArgs

type ContentTopicArgs struct {
	ContentTopic string `json:"contentTopic,omitempty"`
}

type DebugService

type DebugService struct {
	// contains filtered or unexported fields
}

func NewDebugService

func NewDebugService(node *node.WakuNode) *DebugService

func (*DebugService) GetV1Info

func (d *DebugService) GetV1Info(r *http.Request, args *InfoArgs, reply *InfoReply) error

func (*DebugService) GetV1Version

func (d *DebugService) GetV1Version(r *http.Request, args *InfoArgs, reply *VersionResponse) error

type Empty

type Empty struct {
}

type Error

type Error struct {
	Data interface{}
}

An Error is a wrapper for a JSON interface value. It can be used by either a service's handler func to write more complex JSON data to an error field of a server's response, or by a client to read it.

func (*Error) Error

func (e *Error) Error() string

type FilterContentArgs

type FilterContentArgs struct {
	Topic          string                            `json:"topic,omitempty"`
	ContentFilters []*pb.FilterRequest_ContentFilter `json:"contentFilters,omitempty"`
}

type FilterService

type FilterService struct {
	// contains filtered or unexported fields
}

func NewFilterService

func NewFilterService(node *node.WakuNode, cacheCapacity int, log *zap.Logger) *FilterService

func (*FilterService) DeleteV1Subscription

func (f *FilterService) DeleteV1Subscription(req *http.Request, args *FilterContentArgs, reply *SuccessReply) error

func (*FilterService) GetV1Messages

func (f *FilterService) GetV1Messages(req *http.Request, args *ContentTopicArgs, reply *MessagesReply) error

func (*FilterService) PostV1Subscription

func (f *FilterService) PostV1Subscription(req *http.Request, args *FilterContentArgs, reply *SuccessReply) error

func (*FilterService) Start

func (f *FilterService) Start()

func (*FilterService) Stop

func (f *FilterService) Stop()

type GetPeersArgs

type GetPeersArgs struct {
}

type InfoArgs

type InfoArgs struct {
}

type InfoReply

type InfoReply struct {
	ENRUri          string   `json:"enrUri,omitempty"`
	ListenAddresses []string `json:"listenAddresses,omitempty"`
}

type MessagesReply

type MessagesReply = []*RPCWakuMessage

type PeerReply

type PeerReply struct {
	Multiaddr string      `json:"multiaddr,omitempty"`
	Protocol  protocol.ID `json:"protocol,omitempty"`
	Connected bool        `json:"connected,omitempty"`
}

type PeersArgs

type PeersArgs struct {
	Peers []string `json:"peers,omitempty"`
}

type PeersReply

type PeersReply []PeerReply

type RPCWakuMessage

type RPCWakuMessage struct {
	Payload        server.Base64URLByte `json:"payload,omitempty"`
	ContentTopic   string               `json:"contentTopic,omitempty"`
	Version        uint32               `json:"version"`
	Timestamp      int64                `json:"timestamp,omitempty"`
	RateLimitProof *RateLimitProof      `json:"rateLimitProof,omitempty"`
	Ephemeral      bool                 `json:"ephemeral,omitempty"`
}

func ProtoToRPC

func ProtoToRPC(input *pb.WakuMessage) (*RPCWakuMessage, error)

type RateLimitProof

type RateLimitProof struct {
	Proof         Base64URLByte `json:"proof,omitempty"`
	MerkleRoot    Base64URLByte `json:"merkle_root,omitempty"`
	Epoch         Base64URLByte `json:"epoch,omitempty"`
	ShareX        Base64URLByte `json:"share_x,omitempty"`
	ShareY        Base64URLByte `json:"share_y,omitempty"`
	Nullifier     Base64URLByte `json:"nullifier,omitempty"`
	RlnIdentifier Base64URLByte `json:"rln_identifier,omitempty"`
}

type RelayAutoMessageArgs added in v0.9.0

type RelayAutoMessageArgs struct {
	Message *RPCWakuMessage `json:"message,omitempty"`
}

RelayAutoMessageArgs represents the requests used for posting messages

type RelayMessageArgs

type RelayMessageArgs struct {
	Topic   string          `json:"topic,omitempty"`
	Message *RPCWakuMessage `json:"message,omitempty"`
}

RelayMessageArgs represents the requests used for posting messages

type RelayService

type RelayService struct {
	// contains filtered or unexported fields
}

RelayService represents the JSON RPC service for WakuRelay

func NewRelayService

func NewRelayService(node *node.WakuNode, cacheCapacity int, log *zap.Logger) *RelayService

NewRelayService returns an instance of RelayService

func (*RelayService) DeleteV1AutoSubscription added in v0.9.0

func (r *RelayService) DeleteV1AutoSubscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error

DeleteV1AutoSubscription is invoked when the json rpc request uses the delete_waku_v2_relay_v1_auto_subscription Note that this method takes contentTopics as an argument instead of pubsubtopics and uses autosharding to derive pubsubTopics.

func (*RelayService) DeleteV1Subscription

func (r *RelayService) DeleteV1Subscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error

DeleteV1Subscription is invoked when the json rpc request uses the delete_waku_v2_relay_v1_subscription method

func (*RelayService) GetV1AutoMessages added in v0.9.0

func (r *RelayService) GetV1AutoMessages(req *http.Request, args *TopicArgs, reply *MessagesReply) error

GetV1AutoMessages is invoked when the json rpc request uses the get_waku_v2_relay_v1_auto_messages method Note that this method takes contentTopic as an argument instead of pubSubtopic and uses autosharding.

func (*RelayService) GetV1Messages

func (r *RelayService) GetV1Messages(req *http.Request, args *TopicArgs, reply *MessagesReply) error

GetV1Messages is invoked when the json rpc request uses the get_waku_v2_relay_v1_messages method

func (*RelayService) PostV1AutoMessage added in v0.9.0

func (r *RelayService) PostV1AutoMessage(req *http.Request, args *RelayAutoMessageArgs, reply *SuccessReply) error

PostV1AutoMessage is invoked when the json rpc request uses the post_waku_v2_relay_v1_auto_message

func (*RelayService) PostV1AutoSubscription added in v0.9.0

func (r *RelayService) PostV1AutoSubscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error

PostV1AutoSubscription is invoked when the json rpc request uses the post_waku_v2_relay_v1_auto_subscription Note that this method takes contentTopics as an argument instead of pubsubtopics and uses autosharding to derive pubsubTopics.

func (*RelayService) PostV1Message

func (r *RelayService) PostV1Message(req *http.Request, args *RelayMessageArgs, reply *SuccessReply) error

PostV1Message is invoked when the json rpc request uses the post_waku_v2_relay_v1_message method

func (*RelayService) PostV1Subscription

func (r *RelayService) PostV1Subscription(req *http.Request, args *TopicsArgs, reply *SuccessReply) error

PostV1Subscription is invoked when the json rpc request uses the post_waku_v2_relay_v1_subscription method

func (*RelayService) Start

func (r *RelayService) Start()

Start starts the RelayService

func (*RelayService) Stop

func (r *RelayService) Stop()

Stop stops the RelayService

type SnakeCaseCodec

type SnakeCaseCodec struct {
}

SnakeCaseCodec creates a CodecRequest to process each request.

func NewSnakeCaseCodec

func NewSnakeCaseCodec() *SnakeCaseCodec

NewCodec returns a new SnakeCaseCodec Codec.

func (*SnakeCaseCodec) NewRequest

func (c *SnakeCaseCodec) NewRequest(r *http.Request) rpc.CodecRequest

NewRequest returns a CodecRequest.

type StoreMessagesArgs

type StoreMessagesArgs struct {
	Topic          string             `json:"pubsubTopic,omitempty"`
	ContentFilters []string           `json:"contentFilters,omitempty"`
	StartTime      *int64             `json:"startTime,omitempty"`
	EndTime        *int64             `json:"endTime,omitempty"`
	PagingOptions  StorePagingOptions `json:"pagingOptions,omitempty"`
}

type StoreMessagesReply

type StoreMessagesReply struct {
	Messages   []*RPCWakuMessage  `json:"messages,omitempty"`
	PagingInfo StorePagingOptions `json:"pagingInfo,omitempty"`
	Error      string             `json:"error,omitempty"`
}

type StorePagingOptions

type StorePagingOptions struct {
	PageSize uint64    `json:"pageSize,omitempty"`
	Cursor   *pb.Index `json:"cursor,omitempty"`
	Forward  bool      `json:"forward,omitempty"`
}

type StoreService

type StoreService struct {
	// contains filtered or unexported fields
}

func (*StoreService) GetV1Messages

func (s *StoreService) GetV1Messages(req *http.Request, args *StoreMessagesArgs, reply *StoreMessagesReply) error

type SuccessReply

type SuccessReply = bool

type TopicArgs

type TopicArgs struct {
	Topic string `json:"topic,omitempty"`
}

TopicArgs represents a request that contains a single topic

type TopicsArgs

type TopicsArgs struct {
	Topics []string `json:"topics,omitempty"`
}

TopicsArgs represents the lists of topics to use when subscribing / unsubscribing

type VersionResponse

type VersionResponse string

type WakuRPC

type WakuRPC struct {
	// contains filtered or unexported fields
}

func NewWakuRPC

func NewWakuRPC(node *node.WakuNode, address string, port int, enableAdmin bool, enablePProf bool, cacheCapacity int, log *zap.Logger) *WakuRPC

func (*WakuRPC) Start

func (r *WakuRPC) Start()

func (*WakuRPC) Stop

func (r *WakuRPC) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL