Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Constructor
- type Context
- type Node
- type NodeInfo
- type PeerInfo
- type ProtocolManager
- func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)
- func (pm *ProtocolManager) BroadcastConfirmed(confirmed *types.Confirmed)
- func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
- func (pm *ProtocolManager) NodeInfo() *NodeInfo
- func (pm *ProtocolManager) Start(maxPeers int)
- func (pm *ProtocolManager) Stop()
- type Service
- type StopError
Constants ¶
View Source
const ( StatusMsg = iota + 1000 //1000 NewBlockHashesMsg //1001 TxMsg //1002 GetBlockHashesMsg //1003 BlockHashesMsg //1004 GetBlocksMsg //1005 BlocksMsg //1006 NewBlockMsg //1007 GetBlockHashesFromNumberMsg //1008 ConfirmedMsg //1009 )
Variables ¶
View Source
var ( ErrServiceUnknown = errors.New("unknown service") ErrNodeStopped = errors.New("node not started") ErrNodeRunning = errors.New("node already running") )
View Source
var DefaultName = "uranus"
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string DataDir string `mapstructure:"node-datadir"` Host string `mapstructure:"rpc-host"` Port int `mapstructure:"rpc-port"` Cors []string `mapstructure:"rpc-cors"` WSHost string `mapstructure:"ws-host"` WSPort int `mapstructure:"ws-port"` WSOrigins []string `mapstructure:"ws-origins"` P2P *p2p.Config }
Config config of node
func (*Config) Endpoint ¶
Endpoint resolves an endpoint based on the configured host interface and port parameters.
func (*Config) WSEndpoint ¶
WSEndpoint resolves a websocket endpoint based on the configured host interface and port parameters.
type Constructor ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context of service context
func (*Context) OpenDatabase ¶
OpenDatabase opens an existing database.
func (*Context) ResolvePath ¶
ResolvePath resolves a user path into the data directory .
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a container on which services can be registered.
func (*Node) Register ¶
func (n *Node) Register(constructor Constructor) error
Register injects a new service into the node's stack.
type ProtocolManager ¶
type ProtocolManager struct { SubProtocols []*p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶
func NewProtocolManager(mux *feed.TypeMux, config *params.ChainConfig, txpool *txpool.TxPool, blockchain *core.BlockChain, chaindb db.Database, engine consensus.Engine) (*ProtocolManager, error)
func (*ProtocolManager) BroadcastBlock ¶
func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)
func (*ProtocolManager) BroadcastConfirmed ¶
func (pm *ProtocolManager) BroadcastConfirmed(confirmed *types.Confirmed)
func (*ProtocolManager) BroadcastTxs ¶
func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
func (*ProtocolManager) NodeInfo ¶
func (pm *ProtocolManager) NodeInfo() *NodeInfo
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start(maxPeers int)
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop()
type Service ¶
type Service interface { // P2P protocols the service . Protocols() []*p2p.Protocol // APIs retrieves the list of RPC descriptors the service provides APIs() []rpc.API // Start start service before all services have been constructed and the networkinglayer was also initialized. Start(p2pServer *p2p.Server) error // Stop terminates all goroutines belonging to the service, blocking until they // are all terminated. Stop() error }
Service is an individual protocol that can be registered into a node.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.