Documentation ¶
Overview ¶
Package router provides the routing and entry point for the go-dvote API
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildReply ¶
func BuildReply(response transports.MessageAPI, request RouterRequest) transports.Message
BuildReply builds a response message (set ID, Timestamp and Signature)
Types ¶
type HexBytes ¶
type HexBytes []byte
HexBytes is a []byte which encodes as hexadecimal in json, as opposed to the base64 default.
func (HexBytes) MarshalJSON ¶
func (*HexBytes) UnmarshalJSON ¶
type RequestMessage ¶
type RequestMessage struct { MessageAPI json.RawMessage `json:"request"` ID string `json:"id"` Signature HexBytes `json:"signature"` }
type ResponseMessage ¶
type ResponseMessage struct { MessageAPI json.RawMessage `json:"response"` ID string `json:"id"` Signature HexBytes `json:"signature"` }
type Router ¶
type Router struct { Transports map[string]transports.Transport // contains filtered or unexported fields }
Router holds a router object
func NewRouter ¶
func NewRouter(inbound <-chan transports.Message, transports map[string]transports.Transport, signer *ethereum.SignKeys, messageTypeFunc func() transports.MessageAPI) *Router
NewRouter creates a router multiplexer instance
func (*Router) AddAuthKey ¶
AddAuthKey adds a new pubkey address that will have access to private methods
func (*Router) AddHandler ¶
func (r *Router) AddHandler(method, namespace string, handler func(RouterRequest), private, skipSignature bool) error
AddHandler adds a new function handler for serving a specific method identified by name.
func (*Router) DelAuthKey ¶
DelAuthKey deletes a pubkey address from the authorized list
func (*Router) SendError ¶
func (r *Router) SendError(request RouterRequest, errMsg string)
SendError formats and sends an error message
type RouterRequest ¶
type RouterRequest struct { transports.MessageContext Message transports.MessageAPI Method string Id string Authenticated bool Address ethcommon.Address SignaturePublicKey []byte Private bool Signer *ethereum.SignKeys }
Click to show internal directories.
Click to hide internal directories.