Documentation ¶
Index ¶
- type Ip
- type MemoryPeerStorage
- type PeerManager
- type PeerManagerImpl
- func (a *PeerManagerImpl) AddAddress(ctx context.Context, addr string)
- func (a *PeerManagerImpl) AddConnected(peer peer.Peer)
- func (a *PeerManagerImpl) AskPeers()
- func (a *PeerManagerImpl) Close()
- func (a *PeerManagerImpl) Connect(ctx context.Context, addr proto.TCPAddr) error
- func (a *PeerManagerImpl) Connected(p peer.Peer) (peer.Peer, bool)
- func (a *PeerManagerImpl) ConnectedCount() int
- func (a *PeerManagerImpl) Disconnect(p peer.Peer)
- func (a *PeerManagerImpl) EachConnected(f func(peer peer.Peer, score *big.Int))
- func (a *PeerManagerImpl) InOutCount() (in int, out int)
- func (a *PeerManagerImpl) IsSuspended(p peer.Peer) bool
- func (a *PeerManagerImpl) KnownPeers() ([]proto.TCPAddr, error)
- func (a *PeerManagerImpl) NewConnection(p peer.Peer) error
- func (a *PeerManagerImpl) PeerWithHighestScore() (peer.Peer, *big.Int, bool)
- func (a *PeerManagerImpl) RemoveSpawned(addr proto.TCPAddr)
- func (a *PeerManagerImpl) Run(ctx context.Context)
- func (a *PeerManagerImpl) Score(p peer.Peer) (*proto.Score, error)
- func (a *PeerManagerImpl) SetConnectPeers(connect bool)
- func (a *PeerManagerImpl) SpawnIncomingConnection(ctx context.Context, conn net.Conn) error
- func (a *PeerManagerImpl) SpawnOutgoingConnections(ctx context.Context)
- func (a *PeerManagerImpl) Spawned() []proto.IpPort
- func (a *PeerManagerImpl) Suspend(p peer.Peer, reason string)
- func (a *PeerManagerImpl) Suspended() []string
- func (a *PeerManagerImpl) UpdateKnownPeers(known []proto.TCPAddr) error
- func (a *PeerManagerImpl) UpdateScore(p peer.Peer, score *big.Int)
- type PeerSpawner
- type PeerSpawnerImpl
- type PeerStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryPeerStorage ¶
type MemoryPeerStorage struct {
// contains filtered or unexported fields
}
type PeerManager ¶
type PeerManager interface { Connected(peer.Peer) (peer.Peer, bool) NewConnection(peer.Peer) error ConnectedCount() int InOutCount() (in int, out int) EachConnected(func(peer.Peer, *proto.Score)) IsSuspended(peer.Peer) bool Suspend(peer.Peer, string) Suspended() []string AddConnected(peer.Peer) PeerWithHighestScore() (peer.Peer, *big.Int, bool) UpdateScore(p peer.Peer, score *proto.Score) UpdateKnownPeers([]proto.TCPAddr) error KnownPeers() ([]proto.TCPAddr, error) Close() SpawnOutgoingConnections(context.Context) SpawnIncomingConnection(ctx context.Context, conn net.Conn) error Spawned() []proto.IpPort Connect(context.Context, proto.TCPAddr) error Score(p peer.Peer) (*proto.Score, error) // for all connected node send GetPeersMessage AskPeers() Disconnect(peer.Peer) }
type PeerManagerImpl ¶
type PeerManagerImpl struct {
// contains filtered or unexported fields
}
func NewPeerManager ¶
func NewPeerManager(spawner PeerSpawner, storage PeerStorage, limitConnections int) *PeerManagerImpl
func (*PeerManagerImpl) AddAddress ¶
func (a *PeerManagerImpl) AddAddress(ctx context.Context, addr string)
func (*PeerManagerImpl) AddConnected ¶
func (a *PeerManagerImpl) AddConnected(peer peer.Peer)
func (*PeerManagerImpl) AskPeers ¶
func (a *PeerManagerImpl) AskPeers()
func (*PeerManagerImpl) Close ¶
func (a *PeerManagerImpl) Close()
func (*PeerManagerImpl) ConnectedCount ¶ added in v0.5.0
func (a *PeerManagerImpl) ConnectedCount() int
func (*PeerManagerImpl) Disconnect ¶
func (a *PeerManagerImpl) Disconnect(p peer.Peer)
func (*PeerManagerImpl) EachConnected ¶
func (a *PeerManagerImpl) EachConnected(f func(peer peer.Peer, score *big.Int))
func (*PeerManagerImpl) InOutCount ¶ added in v0.5.0
func (a *PeerManagerImpl) InOutCount() (in int, out int)
Count connected peers, in - incoming connections out - outgoing connections
func (*PeerManagerImpl) IsSuspended ¶
func (a *PeerManagerImpl) IsSuspended(p peer.Peer) bool
func (*PeerManagerImpl) KnownPeers ¶
func (a *PeerManagerImpl) KnownPeers() ([]proto.TCPAddr, error)
func (*PeerManagerImpl) NewConnection ¶ added in v0.5.0
func (a *PeerManagerImpl) NewConnection(p peer.Peer) error
func (*PeerManagerImpl) PeerWithHighestScore ¶
func (*PeerManagerImpl) RemoveSpawned ¶
func (a *PeerManagerImpl) RemoveSpawned(addr proto.TCPAddr)
func (*PeerManagerImpl) Run ¶
func (a *PeerManagerImpl) Run(ctx context.Context)
func (*PeerManagerImpl) SetConnectPeers ¶ added in v0.5.0
func (a *PeerManagerImpl) SetConnectPeers(connect bool)
func (*PeerManagerImpl) SpawnIncomingConnection ¶
func (*PeerManagerImpl) SpawnOutgoingConnections ¶
func (a *PeerManagerImpl) SpawnOutgoingConnections(ctx context.Context)
func (*PeerManagerImpl) Spawned ¶
func (a *PeerManagerImpl) Spawned() []proto.IpPort
func (*PeerManagerImpl) Suspended ¶
func (a *PeerManagerImpl) Suspended() []string
func (*PeerManagerImpl) UpdateKnownPeers ¶
func (a *PeerManagerImpl) UpdateKnownPeers(known []proto.TCPAddr) error
func (*PeerManagerImpl) UpdateScore ¶
func (a *PeerManagerImpl) UpdateScore(p peer.Peer, score *big.Int)
type PeerSpawner ¶
type PeerSpawnerImpl ¶
type PeerSpawnerImpl struct {
// contains filtered or unexported fields
}
func NewPeerSpawner ¶
func (*PeerSpawnerImpl) SpawnIncoming ¶
func (*PeerSpawnerImpl) SpawnOutgoing ¶
Click to show internal directories.
Click to hide internal directories.