Documentation ¶
Index ¶
- func NewNetServer() p2p.P2P
- func TLSDial(nodeAddr string) (net.Conn, error)
- type ConnectingNodes
- type InConnectionRecord
- type NetServer
- func (this *NetServer) AddInConnRecord(addr string)
- func (this *NetServer) AddNbrNode(remotePeer *peer.Peer)
- func (this *NetServer) AddOutConnRecord(addr string)
- func (this *NetServer) AddOutConnectingList(addr string) (added bool)
- func (this *NetServer) AddPeerConsAddress(addr string, p *peer.Peer)
- func (this *NetServer) AddPeerSyncAddress(addr string, p *peer.Peer)
- func (this *NetServer) AddrValid(addr string) bool
- 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) GetInConnRecordLen() int
- func (this *NetServer) GetIpCountInInConnRecord(ip string) uint
- 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) GetOutConnRecordLen() int
- func (this *NetServer) GetOutConnectingListLen() (count uint)
- func (this *NetServer) GetPeer(id uint64) *peer.Peer
- func (this *NetServer) GetPeerFromAddr(addr string) *peer.Peer
- func (this *NetServer) GetPeerSyncAddressCount() (count uint)
- 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) IsAddrFromConnecting(addr string) bool
- func (this *NetServer) IsAddrInInConnRecord(addr string) bool
- func (this *NetServer) IsAddrInOutConnRecord(addr string) bool
- func (this *NetServer) IsIPInInConnRecord(ip string) bool
- func (this *NetServer) IsNbrPeerAddr(addr string, isConsensus bool) bool
- func (this *NetServer) IsOwnAddress(addr string) 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) RemoveFromInConnRecord(addr string)
- func (this *NetServer) RemoveFromOutConnRecord(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) SetOwnAddress(addr string)
- func (this *NetServer) Start()
- func (this *NetServer) Xmit(msg types.Message, isCons bool)
- type OutConnectionRecord
- type PeerAddrMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectingNodes ¶
ConnectingNodes include all addr in connecting state
type InConnectionRecord ¶ added in v0.9.2
InConnectionRecord include all addr connected
type NetServer ¶
type NetServer struct { SyncChan chan *types.MsgPayload ConsChan chan *types.MsgPayload ConnectingNodes PeerAddrMap Np *peer.NbrPeers OwnAddress string //network`s own address(ip : sync port),which get from version check // contains filtered or unexported fields }
NetServer represent all the actions in net layer
func (*NetServer) AddInConnRecord ¶ added in v0.9.2
AddInConnRecord add in connection to inConnRecord
func (*NetServer) AddNbrNode ¶
AddNbrNode add peer to nbr peer list
func (*NetServer) AddOutConnRecord ¶ added in v0.9.2
AddOutConnRecord add out connection to outConnRecord
func (*NetServer) AddOutConnectingList ¶ added in v0.9.2
record the peer which is going to be dialed and sent version message but not in establish state
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) GetInConnRecordLen ¶ added in v0.9.2
GetInConnRecordLen return length of inConnRecordList
func (*NetServer) GetIpCountInInConnRecord ¶ added in v0.9.2
GetIpCountInInConnRecord return count of in connections with single ip
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) GetOutConnRecordLen ¶ added in v0.9.2
GetOutConnRecordLen return length of outConnRecord
func (*NetServer) GetOutConnectingListLen ¶ added in v0.9.2
record the peer which is going to be dialed and sent version message but not in establish state
func (*NetServer) GetPeerFromAddr ¶
find exist peer from addr map
func (*NetServer) GetPeerSyncAddressCount ¶ added in v0.9.2
GetPeerSyncAddressCount return length of cons addr from peer-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) IsAddrFromConnecting ¶ added in v0.9.4
check peer from connecting list
func (*NetServer) IsAddrInInConnRecord ¶ added in v0.9.2
IsAddrInInConnRecord return result whether addr is in inConnRecordList
func (*NetServer) IsAddrInOutConnRecord ¶ added in v0.9.2
IsAddrInOutConnRecord return result whether addr is in outConnRecord
func (*NetServer) IsIPInInConnRecord ¶ added in v0.9.2
IsIPInInConnRecord return result whether the IP is in inConnRecordList
func (*NetServer) IsNbrPeerAddr ¶
IsNbrPeerAddr return result whether the address is under connecting
func (*NetServer) IsOwnAddress ¶ added in v0.9.3
check own network address
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) RemoveFromInConnRecord ¶ added in v0.9.2
RemoveInConnRecord remove in connection from inConnRecordList
func (*NetServer) RemoveFromOutConnRecord ¶ added in v0.9.2
RemoveOutConnRecord remove out connection from outConnRecord
func (*NetServer) RemovePeerConsAddress ¶
RemovePeerConsAddress remove cons addr from peer-addr map
func (*NetServer) RemovePeerSyncAddress ¶
RemovePeerSyncAddress remove sync addr from peer-addr map
func (*NetServer) SetOwnAddress ¶ added in v0.9.3
Set own network address
type OutConnectionRecord ¶ added in v0.9.2
OutConnectionRecord include all addr accepted