p2p

package
v0.0.0-...-3442dc8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DHTServiceType_Unknown = iota
	DHTServiceType_General
	DHTServiceType_Execute
	DHTServiceType_Propose
	DHTServiceType_Validate
)
View Source
const (
	GossipScoreThreshold             = -500
	PublishScoreThreshold            = -1000
	GraylistScoreThreshold           = -2500
	AcceptPXScoreThreshold           = 1000
	OpportunisticGraftScoreThreshold = 3.5
)

Variables

This section is empty.

Functions

func NewStreamReader

func NewStreamReader(rd ReaderDeadline, minSpeed int64, maxWait time.Duration) io.Reader

New creates an Incremental Reader Timeout, with minimum sustained speed of minSpeed bytes per second and with maximum wait of maxWait

Types

type DHTServiceType

type DHTServiceType int

type NetworkActiveNodeMock

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

func NewNetworkActiveNodeMock

func NewNetworkActiveNodeMock() *NetworkActiveNodeMock

func (*NetworkActiveNodeMock) GetActiveExecutorIDs

func (anmock *NetworkActiveNodeMock) GetActiveExecutorIDs() []string

func (*NetworkActiveNodeMock) GetActiveProposerIDs

func (anmock *NetworkActiveNodeMock) GetActiveProposerIDs() []string

func (*NetworkActiveNodeMock) GetActiveValidatorIDs

func (anmock *NetworkActiveNodeMock) GetActiveValidatorIDs() []string

type P2PDHTService

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

func NewP2PDHTService

func NewP2PDHTService(ctx context.Context, log tplog.Logger, dht *dht.IpfsDHT) *P2PDHTService

func (*P2PDHTService) Close

func (ps *P2PDHTService) Close() error

func (*P2PDHTService) GetAllPeerIDs

func (ps *P2PDHTService) GetAllPeerIDs() ([]peer.ID, error)

func (*P2PDHTService) GetNearestPeerIDs

func (ps *P2PDHTService) GetNearestPeerIDs(peerID peer.ID) ([]peer.ID, error)

func (*P2PDHTService) GetPeersWithFactor

func (ps *P2PDHTService) GetPeersWithFactor() ([]peer.ID, error)

type P2PPubSubService

type P2PPubSubService struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewP2PPubSubService

func NewP2PPubSubService(ctx context.Context, log tplog.Logger, topicValidation bool, pubSub *pubsub.PubSub, p2pService *P2PService) *P2PPubSubService

func (*P2PPubSubService) Publish

func (ps *P2PPubSubService) Publish(ctx context.Context, toModuleNames []string, topic string, data []byte) error

func (*P2PPubSubService) Subscribe

func (ps *P2PPubSubService) Subscribe(ctx context.Context, topic string, localIgnore bool, validators ...message.PubSubMessageValidator) error

func (*P2PPubSubService) UnSubscribe

func (ps *P2PPubSubService) UnSubscribe(topic string) error

type P2PService

type P2PService struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewP2PService

func NewP2PService(ctx context.Context, log tplog.Logger, config *configuration.NetworkConfiguration, sysActor *actor.ActorSystem, endPoint string, seed string, netActiveNode tpnetcmn.NetworkActiveNode) *P2PService

func (*P2PService) Close

func (p2p *P2PService) Close()

func (*P2PService) Connect

func (p2p *P2PService) Connect(listenAddr []string) error

func (*P2PService) ConnectToNode

func (p2p *P2PService) ConnectToNode(ctx context.Context, nodeNetAddr string) error

func (*P2PService) ConnectedPeers

func (p2p *P2PService) ConnectedPeers() []*tpnetcmn.RemotePeer

func (*P2PService) Connectedness

func (p2p *P2PService) Connectedness(nodeID string) (tpnetcmn.Connectedness, error)

func (*P2PService) CreateTopic

func (p2p *P2PService) CreateTopic(topic string)

func (*P2PService) DHTServiceOfProtocol

func (p2p *P2PService) DHTServiceOfProtocol(protocolID string) (*P2PDHTService, error)

func (*P2PService) DisConnectWithNode

func (p2p *P2PService) DisConnectWithNode(nodeID string) error

func (*P2PService) FindPeer

func (p2p *P2PService) FindPeer(ctx context.Context, nodeID string) (string, error)

func (*P2PService) ID

func (p2p *P2PService) ID() peer.ID

func (*P2PService) ListenAddr

func (p2p *P2PService) ListenAddr() []string

func (*P2PService) NatState

func (p2p *P2PService) NatState() (*tpnetcmn.NatInfo, error)

func (*P2PService) PeerDetailInfo

func (p2p *P2PService) PeerDetailInfo(nodeID string) (*tpnetcmn.PeerDetail, error)

func (*P2PService) PubSubScores

func (p2p *P2PService) PubSubScores() []tpnetcmn.PubsubScore

func (*P2PService) Publish

func (p2p *P2PService) Publish(ctx context.Context, toModuleNames []string, topic string, data []byte) error

func (*P2PService) Ready

func (p2p *P2PService) Ready() bool

func (*P2PService) RegisterModule

func (p2p *P2PService) RegisterModule(moduleName string, pid *actor.PID, msgMarshal codec.Marshaler)

func (*P2PService) Send

func (p2p *P2PService) Send(ctx context.Context, protocolID string, moduleName string, data []byte) error

func (*P2PService) SendWithResponse

func (p2p *P2PService) SendWithResponse(ctx context.Context, protocolID string, moduleName string, data []byte) ([]message.SendResponse, error)

func (*P2PService) Start

func (p2p *P2PService) Start()

func (*P2PService) Subscribe

func (p2p *P2PService) Subscribe(ctx context.Context, topic string, localIgnore bool, validators ...message.PubSubMessageValidator) error

func (*P2PService) UnRegisterModule

func (p2p *P2PService) UnRegisterModule(moduleName string, pid *actor.PID, msgMarshal codec.Marshaler)

func (*P2PService) UnSubscribe

func (p2p *P2PService) UnSubscribe(topic string) error

func (*P2PService) UpdateNetActiveNode

func (p2p *P2PService) UpdateNetActiveNode(netActiveNode tpnetcmn.NetworkActiveNode)

type P2PStreamService

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

func NewP2PStreamService

func NewP2PStreamService(ctx context.Context, log tplog.Logger, p2pService *P2PService) *P2PStreamService

type PeerScoreCache

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

func NewPeerScoreCache

func NewPeerScoreCache() *PeerScoreCache

func (*PeerScoreCache) Fetch

func (pc *PeerScoreCache) Fetch() map[peer.ID]*pubsub.PeerScoreSnapshot

func (*PeerScoreCache) Update

func (pc *PeerScoreCache) Update(scores map[peer.ID]*pubsub.PeerScoreSnapshot)

type ReaderDeadline

type ReaderDeadline interface {
	Read([]byte) (int, error)
	SetReadDeadline(time.Time) error
}

type StreamReader

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

func (*StreamReader) Read

func (sr *StreamReader) Read(buf []byte) (int, error)

Jump to

Keyboard shortcuts

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