rpc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 35 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 AsymmetricMessageArgs

type AsymmetricMessageArgs struct {
	Topic     string          `json:"topic"`
	Message   *RPCWakuMessage `json:"message"`
	PublicKey string          `json:"publicKey"`
}

type AsymmetricMessagesArgs

type AsymmetricMessagesArgs struct {
	Topic      string `json:"topic"`
	PrivateKey string `json:"privateKey"`
}

type Base64URLByte added in v0.5.0

type Base64URLByte []byte

func (Base64URLByte) MarshalJSON added in v0.5.0

func (u Base64URLByte) MarshalJSON() ([]byte, error)

func (*Base64URLByte) UnmarshalText added in v0.5.0

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

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 KeyPairReply

type KeyPairReply struct {
	PrivateKey string `json:"privateKey"`
	PublicKey  string `json:"publicKey"`
}

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 PrivateService

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

func NewPrivateService

func NewPrivateService(node *node.WakuNode, cacheCapacity int, log *zap.Logger) *PrivateService

func (*PrivateService) GetV1AsymmetricKeypair

func (p *PrivateService) GetV1AsymmetricKeypair(req *http.Request, args *Empty, reply *KeyPairReply) error

func (*PrivateService) GetV1AsymmetricMessages

func (p *PrivateService) GetV1AsymmetricMessages(req *http.Request, args *AsymmetricMessagesArgs, reply *MessagesReply) error

func (*PrivateService) GetV1SymmetricKey

func (p *PrivateService) GetV1SymmetricKey(req *http.Request, args *Empty, reply *SymmetricKeyReply) error

func (*PrivateService) GetV1SymmetricMessages

func (p *PrivateService) GetV1SymmetricMessages(req *http.Request, args *SymmetricMessagesArgs, reply *MessagesReply) error

func (*PrivateService) PostV1AsymmetricMessage

func (p *PrivateService) PostV1AsymmetricMessage(req *http.Request, args *AsymmetricMessageArgs, reply *bool) error

func (*PrivateService) PostV1SymmetricMessage

func (p *PrivateService) PostV1SymmetricMessage(req *http.Request, args *SymmetricMessageArgs, reply *SuccessReply) error

func (*PrivateService) Start

func (p *PrivateService) Start()

func (*PrivateService) Stop

func (p *PrivateService) Stop()

type RPCWakuMessage

type RPCWakuMessage struct {
	Payload        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 added in v0.5.0

func ProtoToRPC(input *pb.WakuMessage) *RPCWakuMessage

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 RelayMessageArgs

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

type RelayService

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

func NewRelayService

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

func (*RelayService) DeleteV1Subscription

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

func (*RelayService) GetV1Messages

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

func (*RelayService) PostV1Message

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

func (*RelayService) PostV1Subscription

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

func (*RelayService) Start

func (r *RelayService) Start()

func (*RelayService) Stop

func (r *RelayService) Stop()

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 SymmetricKeyReply

type SymmetricKeyReply string

type SymmetricMessageArgs

type SymmetricMessageArgs struct {
	Topic   string          `json:"topic"`
	Message *RPCWakuMessage `json:"message"`
	SymKey  string          `json:"symkey"`
}

type SymmetricMessagesArgs

type SymmetricMessagesArgs struct {
	Topic  string `json:"topic"`
	SymKey string `json:"symkey"`
}

type TopicArgs

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

type TopicsArgs

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

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, enablePrivate 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