Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LoggerHandler = HandlerFunc(func(msg PostProcessable) { data, error := json.Marshal(msg) if error != nil { fmt.Println("logger plugin err: ", error) return } fmt.Println("logger - message : ", string(data)) })
LoggerHandler logs the messages back and forth.
View Source
var StringLoggerHandler = HandlerFunc(func(msg PostProcessable) { fmt.Printf("Received message %T\n", msg.P2PMessageEnvelope.P2PMessage) })
StringLoggerHandler simply prints the messages as they go through the client.
Functions ¶
Types ¶
type Client ¶
type Client struct { API *eos.API ChainID eos.SHA256Bytes NetworkVersion int16 Conn net.Conn NodeID eos.SHA256Bytes // contains filtered or unexported fields }
func (*Client) RegisterHandler ¶
func (*Client) SendHandshake ¶
func (*Client) SendSyncRequest ¶
func (*Client) UnregisterHandler ¶
type Handler ¶
type Handler interface {
Handle(msg PostProcessable)
}
type HandlerFunc ¶
type HandlerFunc func(msg PostProcessable)
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(msg PostProcessable)
type PostProcessable ¶
type PostProcessable struct { Route *Route `json:"route"` P2PMessageEnvelope *eos.P2PMessageEnvelope `json:"p2p_message_envelope"` }
Click to show internal directories.
Click to hide internal directories.