peermgr

package
v1.14.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0, MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxFilPeers = 320
	MinFilPeers = 128
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FilPeerEvt added in v1.8.0

type FilPeerEvt struct {
	Type FilPeerEvtType
	ID   peer.ID
}

type FilPeerEvtType added in v1.8.0

type FilPeerEvtType int
const (
	AddFilPeerEvt FilPeerEvtType = iota
	RemoveFilPeerEvt
)

type IPeerMgr

type IPeerMgr interface {
	AddFilecoinPeer(p peer.ID)
	GetPeerLatency(p peer.ID) (time.Duration, bool)
	SetPeerLatency(p peer.ID, latency time.Duration)
	Disconnect(p peer.ID)
	Stop(ctx context.Context) error
	Run(ctx context.Context)
}

type MockPeerMgr

type MockPeerMgr struct{}

func (MockPeerMgr) AddFilecoinPeer

func (m MockPeerMgr) AddFilecoinPeer(p peer.ID)

func (MockPeerMgr) Disconnect

func (m MockPeerMgr) Disconnect(p peer.ID)

func (MockPeerMgr) GetPeerLatency

func (m MockPeerMgr) GetPeerLatency(p peer.ID) (time.Duration, bool)

func (MockPeerMgr) Run

func (m MockPeerMgr) Run(ctx context.Context)

func (MockPeerMgr) SetPeerLatency

func (m MockPeerMgr) SetPeerLatency(p peer.ID, latency time.Duration)

func (MockPeerMgr) Stop

func (m MockPeerMgr) Stop(ctx context.Context) error

type PeerMgr

type PeerMgr struct {
	// contains filtered or unexported fields
}

func NewPeerMgr

func NewPeerMgr(h host.Host, dht *dht.IpfsDHT, period time.Duration, bootstrap []peer.AddrInfo) (*PeerMgr, error)

func (*PeerMgr) AddFilecoinPeer

func (pmgr *PeerMgr) AddFilecoinPeer(p peer.ID)

func (*PeerMgr) Disconnect

func (pmgr *PeerMgr) Disconnect(p peer.ID)

func (*PeerMgr) GetPeerLatency

func (pmgr *PeerMgr) GetPeerLatency(p peer.ID) (time.Duration, bool)

func (*PeerMgr) Run

func (pmgr *PeerMgr) Run(ctx context.Context)

func (*PeerMgr) SetPeerLatency

func (pmgr *PeerMgr) SetPeerLatency(p peer.ID, latency time.Duration)

func (*PeerMgr) Stop

func (pmgr *PeerMgr) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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