Documentation
¶
Index ¶
- func NewNetServer(pubKey keypair.PublicKey) p2p.P2P
- func TLSDial(nodeAddr string) (net.Conn, error)
- type ConnectingNodes
- type NetServer
- func (this *NetServer) AddInConnectingList(addr string) (added bool)
- func (this *NetServer) AddNbrNode(remotePeer *peer.Peer)
- func (this *NetServer) AddPeerConsAddress(addr string, p *peer.Peer)
- func (this *NetServer) AddPeerSyncAddress(addr string, p *peer.Peer)
- func (this *NetServer) Connect(addr string, isConsensus bool) error
- func (this *NetServer) DelNbrNode(id uint64) (*peer.Peer, bool)
- func (this *NetServer) GetConnectionCnt() uint32
- func (this *NetServer) GetConsPort() uint16
- func (this *NetServer) GetHeight() uint64
- func (this *NetServer) GetHttpInfoPort() uint16
- func (this *NetServer) GetID() uint64
- func (this *NetServer) GetMsgChan(isConsensus bool) chan *types.MsgPayload
- func (this *NetServer) GetNeighborAddrs() []common.PeerAddr
- func (this *NetServer) GetNeighbors() []*peer.Peer
- func (this *NetServer) GetNp() *peer.NbrPeers
- func (this *NetServer) GetPeer(id uint64) *peer.Peer
- func (this *NetServer) GetPeerFromAddr(addr string) *peer.Peer
- func (this *NetServer) GetPubKey() keypair.PublicKey
- func (this *NetServer) GetRelay() bool
- func (this *NetServer) GetServices() uint64
- func (this *NetServer) GetSyncPort() uint16
- func (this *NetServer) GetTime() int64
- func (this *NetServer) GetVersion() uint32
- func (this *NetServer) Halt()
- func (this *NetServer) IsNbrPeerAddr(addr string, isConsensus bool) bool
- func (this *NetServer) IsPeerEstablished(p *peer.Peer) bool
- func (this *NetServer) NodeEstablished(id uint64) bool
- func (this *NetServer) RemoveFromConnectingList(addr string)
- func (this *NetServer) RemovePeerConsAddress(addr string)
- func (this *NetServer) RemovePeerSyncAddress(addr string)
- func (this *NetServer) Send(p *peer.Peer, msg types.Message, isConsensus bool) error
- func (this *NetServer) SetHeight(height uint64)
- func (this *NetServer) Start()
- func (this *NetServer) Xmit(msg types.Message, isCons bool)
- type PeerAddrMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetServer ¶
NewNetServer return the net object in p2p
Types ¶
type ConnectingNodes ¶
ConnectingNodes include all addr in connecting state
type NetServer ¶
type NetServer struct {
SyncChan chan *types.MsgPayload
ConsChan chan *types.MsgPayload
ConnectingNodes
PeerAddrMap
Np *peer.NbrPeers
// contains filtered or unexported fields
}
NetServer represent all the actions in net layer
func (*NetServer) AddInConnectingList ¶
record the peer which is going to be dialed and sent version message but not in establish state
func (*NetServer) AddNbrNode ¶
AddNbrNode add peer to nbr peer list
func (*NetServer) AddPeerConsAddress ¶
AddPeerConsAddress add cons addr to peer-addr map
func (*NetServer) AddPeerSyncAddress ¶
AddPeerSyncAddress add sync addr to peer-addr map
func (*NetServer) DelNbrNode ¶
DelNbrNode delete nbr peer by id
func (*NetServer) GetConnectionCnt ¶
GetConnectionCnt return the total number of valid connections
func (*NetServer) GetConsPort ¶
GetConsPort return the cons port
func (*NetServer) GetHttpInfoPort ¶
GetHttpInfoPort return the port support info via http
func (*NetServer) GetMsgChan ¶
func (this *NetServer) GetMsgChan(isConsensus bool) chan *types.MsgPayload
GetMsgChan return sync or consensus channel when msgrouter need msg input
func (*NetServer) GetNeighborAddrs ¶
GetNeighborAddrs return all the nbr peer`s addr
func (*NetServer) GetNeighbors ¶
GetNeighbors return all nbr peer
func (*NetServer) GetPeerFromAddr ¶
find exist peer from addr map
func (*NetServer) GetServices ¶
GetServices return the service state of self peer
func (*NetServer) GetSyncPort ¶
GetSyncPort return the sync port
func (*NetServer) GetVersion ¶
GetVersion return self peer`s version
func (*NetServer) IsNbrPeerAddr ¶
IsNbrPeerAddr return result whether the address is under connecting
func (*NetServer) IsPeerEstablished ¶
IsPeerEstablished return the establise state of given peer`s id
func (*NetServer) NodeEstablished ¶
NodeEstablished return whether a peer is establish with self according to id
func (*NetServer) RemoveFromConnectingList ¶
Remove the peer from connecting list if the connection is established
func (*NetServer) RemovePeerConsAddress ¶
RemovePeerConsAddress remove cons addr from peer-addr map
func (*NetServer) RemovePeerSyncAddress ¶
RemovePeerSyncAddress remove sync addr from peer-addr map