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) AddPeerAddress(addr string, p *peer.Peer)
- func (this *NetServer) AddrValid(addr string) bool
- func (this *NetServer) Connect(addr string) error
- func (this *NetServer) DelNbrNode(id uint64) (*peer.Peer, bool)
- func (this *NetServer) GetConnectionCnt() uint32
- 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() 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) GetPeerAddressCount() (count uint)
- func (this *NetServer) GetPeerFromAddr(addr string) *peer.Peer
- func (this *NetServer) GetPort() uint16
- func (this *NetServer) GetRelay() bool
- func (this *NetServer) GetServices() uint64
- 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) 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) RemovePeerAddress(addr string)
- func (this *NetServer) Send(p *peer.Peer, msg types.Message) error
- func (this *NetServer) SetHeight(height uint64)
- func (this *NetServer) SetOwnAddress(addr string)
- func (this *NetServer) Start()
- func (this *NetServer) Xmit(msg types.Message)
- 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 ¶
InConnectionRecord include all addr connected
type NetServer ¶
type NetServer struct { NetChan 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 ¶
AddInConnRecord add in connection to inConnRecord
func (*NetServer) AddNbrNode ¶
AddNbrNode add peer to nbr peer list
func (*NetServer) AddOutConnRecord ¶
AddOutConnRecord add out connection to outConnRecord
func (*NetServer) AddOutConnectingList ¶
record the peer which is going to be dialed and sent version message but not in establish state
func (*NetServer) AddPeerAddress ¶
AddPeerAddress 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) GetHttpInfoPort ¶
GetHttpInfoPort return the port support info via http
func (*NetServer) GetInConnRecordLen ¶
GetInConnRecordLen return length of inConnRecordList
func (*NetServer) GetIpCountInInConnRecord ¶
GetIpCountInInConnRecord return count of in connections with single ip
func (*NetServer) GetMsgChan ¶
func (this *NetServer) GetMsgChan() 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 ¶
GetOutConnRecordLen return length of outConnRecord
func (*NetServer) GetOutConnectingListLen ¶
record the peer which is going to be dialed and sent version message but not in establish state
func (*NetServer) GetPeerAddressCount ¶
GetPeerAddressCount return length of cons addr from peer-addr map
func (*NetServer) GetPeerFromAddr ¶
find exist peer from addr map
func (*NetServer) GetServices ¶
GetServices return the service state of self peer
func (*NetServer) GetVersion ¶
GetVersion return self peer`s version
func (*NetServer) IsAddrFromConnecting ¶
check peer from connecting list
func (*NetServer) IsAddrInInConnRecord ¶
IsAddrInInConnRecord return result whether addr is in inConnRecordList
func (*NetServer) IsAddrInOutConnRecord ¶
IsAddrInOutConnRecord return result whether addr is in outConnRecord
func (*NetServer) IsIPInInConnRecord ¶
IsIPInInConnRecord return result whether the IP is in inConnRecordList
func (*NetServer) IsNbrPeerAddr ¶
IsNbrPeerAddr return result whether the address is under connecting
func (*NetServer) IsOwnAddress ¶
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 ¶
RemoveInConnRecord remove in connection from inConnRecordList
func (*NetServer) RemoveFromOutConnRecord ¶
RemoveOutConnRecord remove out connection from outConnRecord
func (*NetServer) RemovePeerAddress ¶
RemovePeerAddress remove sync addr from peer-addr map
func (*NetServer) SetOwnAddress ¶
Set own network address
type OutConnectionRecord ¶
OutConnectionRecord include all addr accepted