gethservice

package
v0.0.0-...-54ce2c8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusSecureMessagingProtocolAPIName is a name of the API namespace
	// with the protocol specific methods.
	StatusSecureMessagingProtocolAPIName = "ssm"
)

Variables

View Source
var (
	// ErrProtocolNotSet tells that the protocol was not set in the Service.
	ErrProtocolNotSet = errors.New("protocol is not set")
	// ErrMessengerNotSet tells that the messenger was not set in the Service.
	ErrMessengerNotSet = errors.New("messenger is not set")
)

Functions

This section is empty.

Types

type KeysGetter

type KeysGetter interface {
	PrivateKey() (*ecdsa.PrivateKey, error)
}

KeysGetter is an interface that specifies what kind of keys should an implementation provide.

type MessagesParams

type MessagesParams struct {
	protocol.Chat
}

MessagesParams is an object with JSON-serializable parameters for Messages method.

type PublicAPI

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

PublicAPI provides an JSON-RPC API to interact with the Status Messaging Protocol through a geth node.

func NewPublicAPI

func NewPublicAPI(s *Service) *PublicAPI

func (*PublicAPI) SendChatMessage

func (api *PublicAPI) SendChatMessage(ctx context.Context, chatID string, text string) (*protocol.MessengerResponse, error)

SendChatMessage sends a plain text message to specified chat. Chat should be added before sending message, otherwise error will be received.

type SendParams

type SendParams struct {
	protocol.Chat
}

SendParams is an object with JSON-serializable parameters for Send method.

type Service

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

Service is a wrapper around Protocol.

func New

func New(node *node.StatusNode, keys KeysGetter) *Service

New creates a new Service.

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs retrieves the list of RPC descriptors the service provides.

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols list a list of p2p protocols defined by this service.s

func (*Service) SetMessenger

func (s *Service) SetMessenger(m *protocol.Messenger)

SetMessenger sets a Messenger.

func (*Service) Start

func (s *Service) Start(server *p2p.Server) error

Start is called after all services have been constructed and the networking layer was also initialized to spawn any goroutines required by the service.

func (*Service) Stop

func (s *Service) Stop() error

Stop terminates all goroutines belonging to the service, blocking until they are all terminated.

Jump to

Keyboard shortcuts

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