manage

package
v1.64.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2020 License: BSD-3-Clause Imports: 13 Imported by: 2

Documentation

Index

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) Get

func (s *ConnManager) Get(pid peer.ID) *peer.AddrInfo

func (*ConnManager) GetLatencyByPeer

func (s *ConnManager) GetLatencyByPeer(pids []peer.ID) map[string]time.Duration

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) Add

func (p *PeerInfoManager) Add(pid string, info *types.Peer)

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL