Documentation ¶
Index ¶
- Constants
- Variables
- func NewDispatchManager(impl *netPluginIMpl) *dispatchManager
- func NewNetPluginIMpl(io *IoContext) *netPluginIMpl
- func NewSyncManager(impl *netPluginIMpl, span uint32) *syncManager
- type ChainSizeMessage
- type Connection
- type GoAwayMessage
- type GoAwayReason
- type HandshakeMessage
- type IdListMode
- type MessageReflectTypes
- type NetMessage
- type NetMessageType
- type NetPlugin
- func (n *NetPlugin) Connect(host string) string
- func (n *NetPlugin) Connections() []*PeerStatus
- func (n *NetPlugin) Disconnect(host string) string
- func (n *NetPlugin) PluginInitialize(c *cli.Context)
- func (n *NetPlugin) PluginShutdown()
- func (n *NetPlugin) PluginStartup()
- func (n *NetPlugin) SetProgramOptions(options *[]cli.Flag)
- func (n *NetPlugin) Status(host string) PeerStatus
- type NoticeMessage
- type OrderedBlockIDs
- type OrderedTransactionIDs
- type PackedTransactionMessage
- type PeerStatus
- type RequestMessage
- type SignedBlockMessage
- type SyncRequestMessage
- type TimeMessage
Constants ¶
View Source
const NetPlug = PluginTypeName("NetPlugin")
Variables ¶
View Source
var FcLog = log.GetLoggerMap()["net_plugin"]
View Source
var ReasonStr = map[GoAwayReason]string{ // contains filtered or unexported fields }
Functions ¶
func NewDispatchManager ¶
func NewDispatchManager(impl *netPluginIMpl) *dispatchManager
func NewNetPluginIMpl ¶
func NewNetPluginIMpl(io *IoContext) *netPluginIMpl
func NewSyncManager ¶
func NewSyncManager(impl *netPluginIMpl, span uint32) *syncManager
Types ¶
type ChainSizeMessage ¶
type ChainSizeMessage struct { LastIrreversibleBlockNum uint32 `json:"last_irreversible_block_num"` LastIrreversibleBlockID common.BlockIdType `json:"last_irreversible_block_id"` HeadNum uint32 `json:"head_num"` HeadID common.BlockIdType `json:"head_id"` }
func (*ChainSizeMessage) GetType ¶
func (c *ChainSizeMessage) GetType() NetMessageType
func (*ChainSizeMessage) String ¶
func (c *ChainSizeMessage) String() string
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnectionByConn ¶
func NewConnectionByConn(socket *asio.ReactiveSocket, c net.Conn, impl *netPluginIMpl) *Connection
func NewConnectionByEndPoint ¶
func NewConnectionByEndPoint(endpoint string, impl *netPluginIMpl) *Connection
func (*Connection) PeerName ¶
func (c *Connection) PeerName() string
type GoAwayMessage ¶
type GoAwayMessage struct { Reason GoAwayReason `json:"reason"` NodeID common.NodeIdType `json:"node_id"` //for duplicate notification }
func (*GoAwayMessage) GetType ¶
func (g *GoAwayMessage) GetType() NetMessageType
func (*GoAwayMessage) String ¶
func (g *GoAwayMessage) String() string
type GoAwayReason ¶
type GoAwayReason uint32
type HandshakeMessage ¶
type HandshakeMessage struct { NetworkVersion uint16 `json:"network_version"` // incremental value above a computed base ChainID common.ChainIdType `json:"chain_id"` // used to identify chain NodeID common.NodeIdType `json:"node_id"` // used to identify peers and prevent self-connect Key ecc.PublicKey `json:"key"` // authentication key; may be a producer or peer key, or empty Time common.TimePoint `json:"time"` Token crypto.Sha256 `json:"token"` // digest of time to prove we own the private `key` Signature ecc.Signature `json:"sig"` // signature for the digest P2PAddress string `json:"p2p_address"` LastIrreversibleBlockNum uint32 `json:"last_irreversible_block_num"` LastIrreversibleBlockID common.BlockIdType `json:"last_irreversible_block_id"` HeadNum uint32 `json:"head_num"` HeadID common.BlockIdType `json:"head_id"` OS string `json:"os"` Agent string `json:"agent"` Generation uint16 `json:"generation"` }
func (*HandshakeMessage) GetType ¶
func (h *HandshakeMessage) GetType() NetMessageType
func (*HandshakeMessage) String ¶
func (h *HandshakeMessage) String() string
type IdListMode ¶
type IdListMode uint32
type MessageReflectTypes ¶
type NetMessage ¶
type NetMessage interface { GetType() NetMessageType String() string }
type NetMessageType ¶
type NetMessageType byte
const ( HandshakeMessageType NetMessageType = iota // 0 ChainSizeType GoAwayMessageType TimeMessageType NoticeMessageType // 4 RequestMessageType SyncRequestMessageType SignedBlockType PackedTransactionMessageType //8 )
func (NetMessageType) Name ¶
func (t NetMessageType) Name() (string, bool)
type NetPlugin ¶
type NetPlugin struct { AbstractPlugin // contains filtered or unexported fields }
func NewNetPlugin ¶
func (*NetPlugin) Connections ¶
func (n *NetPlugin) Connections() []*PeerStatus
func (*NetPlugin) Disconnect ¶
func (*NetPlugin) PluginInitialize ¶
func (*NetPlugin) PluginShutdown ¶
func (n *NetPlugin) PluginShutdown()
func (*NetPlugin) PluginStartup ¶
func (n *NetPlugin) PluginStartup()
func (*NetPlugin) SetProgramOptions ¶
func (*NetPlugin) Status ¶
func (n *NetPlugin) Status(host string) PeerStatus
type NoticeMessage ¶
type NoticeMessage struct { KnownTrx OrderedTransactionIDs `json:"known_trx"` KnownBlocks OrderedBlockIDs `json:"known_blocks"` }
func (*NoticeMessage) GetType ¶
func (n *NoticeMessage) GetType() NetMessageType
func (*NoticeMessage) String ¶
func (n *NoticeMessage) String() string
type OrderedBlockIDs ¶
type OrderedBlockIDs struct { Mode IdListMode `json:"mode"` Pending uint32 `json:"pending"` IDs []common.BlockIdType `json:"ids"` }
type OrderedTransactionIDs ¶
type OrderedTransactionIDs struct { Mode IdListMode `json:"mode"` Pending uint32 `json:"pending"` IDs []common.TransactionIdType `json:"ids"` }
type PackedTransactionMessage ¶
type PackedTransactionMessage struct {
types.PackedTransaction
}
func (*PackedTransactionMessage) GetType ¶
func (p *PackedTransactionMessage) GetType() NetMessageType
func (*PackedTransactionMessage) String ¶
func (p *PackedTransactionMessage) String() string
type PeerStatus ¶
type PeerStatus struct { Peer string `json:"peer"` Connecting bool `json:"connecting"` Syncing bool `json:"syncing"` LastHandshake HandshakeMessage `json:"last_handshake"` }
type RequestMessage ¶
type RequestMessage struct { ReqTrx OrderedTransactionIDs `json:"req_trx"` ReqBlocks OrderedBlockIDs `json:"req_blocks"` }
func (*RequestMessage) GetType ¶
func (r *RequestMessage) GetType() NetMessageType
func (RequestMessage) IsEmpty ¶
func (r RequestMessage) IsEmpty() bool
func (*RequestMessage) String ¶
func (r *RequestMessage) String() string
type SignedBlockMessage ¶
type SignedBlockMessage struct {
types.SignedBlock
}
func (*SignedBlockMessage) GetType ¶
func (s *SignedBlockMessage) GetType() NetMessageType
func (*SignedBlockMessage) String ¶
func (s *SignedBlockMessage) String() string
type SyncRequestMessage ¶
type SyncRequestMessage struct { StartBlock uint32 `json:"start_block"` EndBlock uint32 `json:"end_block"` }
func (*SyncRequestMessage) GetType ¶
func (s *SyncRequestMessage) GetType() NetMessageType
func (*SyncRequestMessage) String ¶
func (s *SyncRequestMessage) String() string
type TimeMessage ¶
type TimeMessage struct { Org common.TimePoint `json:"org"` //origin timestamp Rec common.TimePoint `json:"rec"` //receive timestamp Xmt common.TimePoint `json:"xmt"` //transmit timestamp Dst common.TimePoint `json:"dst"` //destination timestamp }
func (*TimeMessage) GetType ¶
func (t *TimeMessage) GetType() NetMessageType
func (*TimeMessage) String ¶
func (t *TimeMessage) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.