Documentation ¶
Index ¶
- Constants
- type ConnManager
- func (s *ConnManager) AddNeighbors(pr *peer.AddrInfo)
- func (s *ConnManager) BoundSize() (insize int, outsize int)
- func (s *ConnManager) CheckDiraction(pid peer.ID) network.Direction
- func (s *ConnManager) Close()
- func (s *ConnManager) Delete(pid peer.ID)
- func (s *ConnManager) FetchConnPeers() []peer.ID
- func (s *ConnManager) FetchNearestPeers() []peer.ID
- func (s *ConnManager) Get(pid peer.ID) *peer.AddrInfo
- func (s *ConnManager) GetLatencyByPeer(pids []peer.ID) map[string]time.Duration
- func (s *ConnManager) InBounds() []peer.ID
- func (s *ConnManager) InboundSize() int
- func (s *ConnManager) IsNeighbors(pid peer.ID) bool
- func (s *ConnManager) MonitorAllPeers(seeds []string, host core.Host)
- func (s *ConnManager) OutBounds() []peer.ID
- func (s *ConnManager) OutboundSize() int
- func (s *ConnManager) RecoredLatency(pid peer.ID, ttl time.Duration)
- func (s *ConnManager) Size() int
- type PeerInfoManager
- func (p *PeerInfoManager) Add(pid string, info *types.Peer)
- func (p *PeerInfoManager) Close()
- func (p *PeerInfoManager) Copy(dest *types.Peer, source *types.P2PPeerInfo)
- func (p *PeerInfoManager) FetchPeerInfosInMin() []*types.Peer
- func (p *PeerInfoManager) GetPeerInfoInMin(key string) *types.Peer
- func (p *PeerInfoManager) MonitorPeerInfos()
Constants ¶
View Source
const ( MinBounds = 15 //最少连接节点数,包含连接被连接 MaxBounds = 50 //最大连接数包含连接被连接 MaxOutBounds = 30 //对外连接的最大节点数量 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnManager ¶
type ConnManager struct { Done chan struct{} // contains filtered or unexported fields }
func NewConnManager ¶
func NewConnManager(host core.Host, discovery *net.Discovery, tracker *metrics.BandwidthCounter, cfg *p2pty.P2PSubConfig) *ConnManager
func (*ConnManager) AddNeighbors ¶
func (s *ConnManager) AddNeighbors(pr *peer.AddrInfo)
func (*ConnManager) BoundSize ¶
func (s *ConnManager) BoundSize() (insize int, outsize int)
func (*ConnManager) CheckDiraction ¶
func (s *ConnManager) CheckDiraction(pid peer.ID) network.Direction
检查连接的节点ID是被连接的还是主动连接的
func (*ConnManager) Close ¶
func (s *ConnManager) Close()
func (*ConnManager) Delete ¶
func (s *ConnManager) Delete(pid peer.ID)
func (*ConnManager) FetchConnPeers ¶
func (s *ConnManager) FetchConnPeers() []peer.ID
FetchConnPeers 获取连接的Peer's ID 这个连接包含被连接的peer以及主动连接的peer.
func (*ConnManager) FetchNearestPeers ¶
func (s *ConnManager) FetchNearestPeers() []peer.ID
func (*ConnManager) GetLatencyByPeer ¶
func (*ConnManager) InBounds ¶
func (s *ConnManager) InBounds() []peer.ID
func (*ConnManager) InboundSize ¶
func (s *ConnManager) InboundSize() int
func (*ConnManager) IsNeighbors ¶
func (s *ConnManager) IsNeighbors(pid peer.ID) bool
func (*ConnManager) MonitorAllPeers ¶
func (s *ConnManager) MonitorAllPeers(seeds []string, host core.Host)
func (*ConnManager) OutBounds ¶
func (s *ConnManager) OutBounds() []peer.ID
func (*ConnManager) OutboundSize ¶
func (s *ConnManager) OutboundSize() int
func (*ConnManager) RecoredLatency ¶
func (s *ConnManager) RecoredLatency(pid peer.ID, ttl time.Duration)
func (*ConnManager) Size ¶
func (s *ConnManager) Size() int
type PeerInfoManager ¶
type PeerInfoManager struct {
// contains filtered or unexported fields
}
func NewPeerInfoManager ¶
func NewPeerInfoManager(cli queue.Client) *PeerInfoManager
func (*PeerInfoManager) Close ¶
func (p *PeerInfoManager) Close()
func (*PeerInfoManager) Copy ¶
func (p *PeerInfoManager) Copy(dest *types.Peer, source *types.P2PPeerInfo)
func (*PeerInfoManager) FetchPeerInfosInMin ¶
func (p *PeerInfoManager) FetchPeerInfosInMin() []*types.Peer
func (*PeerInfoManager) GetPeerInfoInMin ¶
func (p *PeerInfoManager) GetPeerInfoInMin(key string) *types.Peer
只获取
func (*PeerInfoManager) MonitorPeerInfos ¶
func (p *PeerInfoManager) MonitorPeerInfos()
Click to show internal directories.
Click to hide internal directories.