rpc

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 29 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 ByteArray added in v0.1.0

type ByteArray []byte

ByteArray is marshalled to a uint8 array

func (ByteArray) MarshalText added in v0.1.0

func (h ByteArray) MarshalText() ([]byte, error)

func (*ByteArray) UnmarshalText added in v0.1.0

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

type CodecRequest added in v0.1.0

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

CodecRequest decodes and encodes a single request.

func (*CodecRequest) Method added in v0.1.0

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 added in v0.1.0

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

ReadRequest fills the request object for the RPC method.

func (*CodecRequest) WriteError added in v0.1.0

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

func (*CodecRequest) WriteResponse added in v0.1.0

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 added in v0.2.0

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 added in v0.1.0

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 added in v0.1.0

func (e *Error) Error() string

type FilterContentArgs

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

type FilterService

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

func NewFilterService

func NewFilterService(node *node.WakuNode, 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 HexBytes added in v0.1.0

type HexBytes []byte

HexBytes is marshalled to a hex string

func (HexBytes) MarshalJSON added in v0.1.0

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

func (*HexBytes) UnmarshalText added in v0.1.0

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

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  string `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, 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 added in v0.1.0

func (p *PrivateService) Start()

func (*PrivateService) Stop added in v0.1.0

func (p *PrivateService) Stop()

type RPCWakuMessage added in v0.1.0

type RPCWakuMessage struct {
	Payload        ByteArray       `json:"payload,omitempty"`
	ContentTopic   string          `json:"contentTopic,omitempty"`
	Version        uint32          `json:"version"`
	Timestamp      int64           `json:"timestamp,omitempty"`
	RateLimitProof *RateLimitProof `json:"rateLimitProof,omitempty"`
}

func ProtoWakuMessageToRPCWakuMessage added in v0.1.0

func ProtoWakuMessageToRPCWakuMessage(input *pb.WakuMessage) *RPCWakuMessage

type RPCWakuRelayMessage added in v0.1.0

type RPCWakuRelayMessage struct {
	Payload        HexBytes        `json:"payload,omitempty"`
	ContentTopic   string          `json:"contentTopic,omitempty"`
	Timestamp      int64           `json:"timestamp,omitempty"`
	RateLimitProof *RateLimitProof `json:"rateLimitProof,omitempty"`
	Version        uint32          `json:"version"`
}

func ProtoWakuMessageToRPCWakuRelayMessage added in v0.1.0

func ProtoWakuMessageToRPCWakuRelayMessage(input *pb.WakuMessage) *RPCWakuRelayMessage

type RateLimitProof added in v0.2.0

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

type RelayMessageArgs

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

type RelayMessagesReply added in v0.1.0

type RelayMessagesReply = []*RPCWakuRelayMessage

type RelayService

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

func NewRelayService

func NewRelayService(node *node.WakuNode, 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 *RelayMessagesReply) 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, 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