Documentation
¶
Index ¶
Constants ¶
View Source
const (
PeerExchangeProtocol protocol.ID = "/nexuscore/peerexchange/1.0.0"
)
Protocol IDs (local copy to avoid import cycle)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeightExchangeHandler ¶
type HeightExchangeHandler struct{}
HeightExchangeHandler handles height exchange protocol
func NewHeightExchangeHandler ¶
func NewHeightExchangeHandler() *HeightExchangeHandler
func (*HeightExchangeHandler) HandleMessage ¶
func (*HeightExchangeHandler) Protocol ¶
func (h *HeightExchangeHandler) Protocol() protocol.ID
type PeerExchangeHandler ¶
type PeerExchangeHandler struct {
// contains filtered or unexported fields
}
PeerExchangeHandler handles peer exchange protocol
func NewPeerExchangeHandler ¶
func NewPeerExchangeHandler(h host.Host) *PeerExchangeHandler
func (*PeerExchangeHandler) HandleMessage ¶
func (*PeerExchangeHandler) Protocol ¶
func (h *PeerExchangeHandler) Protocol() protocol.ID
func (*PeerExchangeHandler) RequestPeers ¶
RequestPeers requests peers from a specific peer
type PeerInfo ¶
type PeerInfo struct {
ID peer.ID `json:"id"`
Addrs []multiaddr.Multiaddr `json:"addrs"`
LastSeen time.Time `json:"last_seen"`
}
PeerInfo represents information about a peer (local copy)
type PingHandler ¶
type PingHandler struct{}
PingHandler handles ping/pong protocol for connectivity testing
func NewPingHandler ¶
func NewPingHandler() *PingHandler
func (*PingHandler) HandleMessage ¶
func (*PingHandler) Protocol ¶
func (h *PingHandler) Protocol() protocol.ID
type ProtocolHandler ¶
type ProtocolHandler interface {
HandleMessage(ctx context.Context, peerID peer.ID, data []byte) error
Protocol() protocol.ID
}
ProtocolHandler handles custom protocol messages
type ProtocolManager ¶
type ProtocolManager struct {
// contains filtered or unexported fields
}
ProtocolManager manages all custom protocols
func NewProtocolManager ¶
func NewProtocolManager(h host.Host) *ProtocolManager
NewProtocolManager creates a new protocol manager
func (*ProtocolManager) RegisterHandler ¶
func (pm *ProtocolManager) RegisterHandler(handler ProtocolHandler)
RegisterHandler registers a protocol handler
type StatusHandler ¶
type StatusHandler struct {
// contains filtered or unexported fields
}
StatusHandler handles node status exchange
func NewStatusHandler ¶
func NewStatusHandler(getStatusFunc func() map[string]interface{}) *StatusHandler
func (*StatusHandler) HandleMessage ¶
func (*StatusHandler) Protocol ¶
func (h *StatusHandler) Protocol() protocol.ID
Click to show internal directories.
Click to hide internal directories.