Documentation
¶
Overview ¶
Package network implements the RPC server for the ATLYS protocol
Index ¶
- type Config
- type NodeStatus
- type P2PNetwork
- func (n *P2PNetwork) Broadcast(protocolID protocol.ID, msg []byte) error
- func (n *P2PNetwork) GetPeerCount() int
- func (n *P2PNetwork) GetValidatorCount() int
- func (n *P2PNetwork) IsValidator(peerID peer.ID) bool
- func (n *P2PNetwork) RegisterProtocol(id protocol.ID, handler ProtocolHandler)
- func (n *P2PNetwork) Start() error
- func (n *P2PNetwork) Stop() error
- func (n *P2PNetwork) UpdateValidatorStatus(peerID peer.ID, status NodeStatus)
- type Protocol
- type ProtocolHandler
- type RPCConfig
- type RPCError
- type RPCResponse
- type RPCServer
- type ValidatorNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeStatus ¶
type NodeStatus int
const ( StatusDisconnected NodeStatus = iota StatusConnecting StatusConnected StatusActive )
type P2PNetwork ¶
type P2PNetwork struct {
// contains filtered or unexported fields
}
func NewP2PNetwork ¶
func NewP2PNetwork(cfg *Config) (*P2PNetwork, error)
func (*P2PNetwork) Broadcast ¶
func (n *P2PNetwork) Broadcast(protocolID protocol.ID, msg []byte) error
func (*P2PNetwork) GetPeerCount ¶
func (n *P2PNetwork) GetPeerCount() int
func (*P2PNetwork) GetValidatorCount ¶
func (n *P2PNetwork) GetValidatorCount() int
func (*P2PNetwork) IsValidator ¶
func (n *P2PNetwork) IsValidator(peerID peer.ID) bool
func (*P2PNetwork) RegisterProtocol ¶
func (n *P2PNetwork) RegisterProtocol(id protocol.ID, handler ProtocolHandler)
func (*P2PNetwork) Start ¶
func (n *P2PNetwork) Start() error
func (*P2PNetwork) Stop ¶
func (n *P2PNetwork) Stop() error
func (*P2PNetwork) UpdateValidatorStatus ¶
func (n *P2PNetwork) UpdateValidatorStatus(peerID peer.ID, status NodeStatus)
type Protocol ¶
type Protocol struct { ID protocol.ID Handler ProtocolHandler }
type ProtocolHandler ¶
type RPCConfig ¶
type RPCConfig struct { ListenAddr string ReadTimeout time.Duration WriteTimeout time.Duration MaxHeaderBytes int EnableTLS bool CertFile string KeyFile string }
RPCConfig contains configuration parameters for the RPC server
type RPCError ¶
type RPCError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
RPCError represents a JSON-RPC error
type RPCResponse ¶
type RPCResponse struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Result interface{} `json:"result,omitempty"` Error *RPCError `json:"error,omitempty"` }
RPCResponse represents a standardized JSON-RPC response
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
RPCServer handles RPC requests for the ATLYS protocol
func NewRPCServer ¶
NewRPCServer creates a new instance of the RPC server
type ValidatorNode ¶
Click to show internal directories.
Click to hide internal directories.