Documentation ¶
Index ¶
- type Handler
- type PingArgs
- type RpcServer
- func (rpcServer *RpcServer) AddOrUpdatePeer(rawAddress string, publicKeyType string, publicKeyMining string, ...) error
- func (rpcServer *RpcServer) CombineID(rawAddress string, publicKey string) string
- func (rpcServer *RpcServer) Init(config *RpcServerConfig)
- func (rpcServer *RpcServer) PeerHeartBeat(heartbeatTimeout int)
- func (rpcServer *RpcServer) RemovePeerByPbk(publicKey string)
- func (rpcServer *RpcServer) Start() error
- type RpcServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
type RpcServer ¶
type RpcServer struct { Config RpcServerConfig // config for RPC server // contains filtered or unexported fields }
rpcServer provides a concurrent safe RPC server to a bootnode server.
func (*RpcServer) AddOrUpdatePeer ¶
func (rpcServer *RpcServer) AddOrUpdatePeer(rawAddress string, publicKeyType string, publicKeyMining string, signDataB58 string) error
AddOrUpdatePeer - push a connected peer in to list of mem or update an old peer node
func (*RpcServer) CombineID ¶
CombineID - return string = rawAddress of peer + public key in base58check encode of node(run as committee) in case node is not running like a committee, we dont have public key of user who running node from this, we can check who is committee in network from bootnode if node provide data for bootnode about key
func (*RpcServer) Init ¶
func (rpcServer *RpcServer) Init(config *RpcServerConfig)
func (*RpcServer) PeerHeartBeat ¶
PeerHeartBeat - loop forever after heartbeatInterval to check peers which are not connected to remove from bootnode use Last Ping time to compare with time.now
func (*RpcServer) RemovePeerByPbk ¶
RemovePeerByPbk - remove peer from mem of bootnode
type RpcServerConfig ¶
type RpcServerConfig struct {
Port int // rpc port
}