Documentation ¶
Index ¶
- Constants
- func MaddrFrom(ip string, port uint) (ma.Multiaddr, error)
- func NoopHandler(ctx context.Context, msg *pubsub.Message) error
- type Config
- type DataStream
- type Host
- func (h *Host) AddPeer(p peer.ID, proto protocol.ID)
- func (h *Host) AgentVersion(pid peer.ID) string
- func (h *Host) ConnSignal(ctx context.Context, pid peer.ID) chan error
- func (h *Host) DeliverMessage(msg *pubsub.Message)
- func (h *Host) DropRPC(rpc *pubsub.RPC, p peer.ID)
- func (h *Host) DuplicateMessage(msg *pubsub.Message)
- func (h *Host) FlushTrace(evtType string, payload any)
- func (h *Host) FlushTraceWithTimestamp(evtType string, timestamp time.Time, payload any)
- func (h *Host) Graft(p peer.ID, topic string)
- func (h *Host) InitGossipSub(ctx context.Context, opts ...pubsub.Option) (*pubsub.PubSub, error)
- func (h *Host) Join(topic string)
- func (h *Host) Leave(topic string)
- func (h *Host) PrivateListenMaddr() (ma.Multiaddr, error)
- func (h *Host) Prune(p peer.ID, topic string)
- func (h *Host) RecvRPC(rpc *pubsub.RPC)
- func (h *Host) RejectMessage(msg *pubsub.Message, reason string)
- func (h *Host) RemovePeer(p peer.ID)
- func (h *Host) SendRPC(rpc *pubsub.RPC, p peer.ID)
- func (h *Host) Serve(ctx context.Context) error
- func (h *Host) ThrottlePeer(p peer.ID)
- func (h *Host) Trace(evt *pubsubpb.TraceEvent)
- func (h *Host) TracedTopicHandler(handler TopicHandler) TopicHandler
- func (h *Host) UndeliverableMessage(msg *pubsub.Message)
- func (h *Host) UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot)
- func (h *Host) ValidateMessage(msg *pubsub.Message)
- func (h *Host) WaitForPublicAddress(ctx context.Context) error
- type NoopDataStream
- type ScoreKeeper
- type TopicHandler
- type TopicScore
- type TopicSubscription
- type TraceEvent
- type TraceEventPeerScore
Constants ¶
View Source
const PeerScoreEventType = "PEERSCORE"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataStream ¶
type Host ¶
func (*Host) AgentVersion ¶
AgentVersion returns the agent version of the given peer. If the agent version is not known, it returns an empty string.
func (*Host) ConnSignal ¶
ConnSignal signals the incoming connection of the given peer on the returned channel by just closing it. Alternatively, if the context has a deadline that's exceeded, the channel will emit the context error and then be closed.
func (*Host) DeliverMessage ¶
func (*Host) DuplicateMessage ¶
func (*Host) FlushTrace ¶
func (*Host) FlushTraceWithTimestamp ¶
func (*Host) InitGossipSub ¶
func (*Host) PrivateListenMaddr ¶
PrivateListenMaddr returns the first multiaddress in a private IP range that this host is listening on.
func (*Host) RemovePeer ¶
func (*Host) ThrottlePeer ¶
func (*Host) Trace ¶
func (h *Host) Trace(evt *pubsubpb.TraceEvent)
func (*Host) TracedTopicHandler ¶
func (h *Host) TracedTopicHandler(handler TopicHandler) TopicHandler
func (*Host) UndeliverableMessage ¶
func (*Host) UpdatePeerScore ¶
func (h *Host) UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot)
func (*Host) ValidateMessage ¶
type ScoreKeeper ¶
type ScoreKeeper struct {
// contains filtered or unexported fields
}
ScoreKeeper is a thread-safe local copy of the score per peer and per copy TODO: figure out if this is some sort of info that we want to expose through OpenTelemetry (Still good to have it)
func (*ScoreKeeper) Get ¶
func (sk *ScoreKeeper) Get() map[peer.ID]*pubsub.PeerScoreSnapshot
func (*ScoreKeeper) Update ¶
func (sk *ScoreKeeper) Update(scores map[peer.ID]*pubsub.PeerScoreSnapshot)
type TopicScore ¶
type TopicSubscription ¶
type TopicSubscription struct { Topic string LocalID peer.ID Sub *pubsub.Subscription Handler TopicHandler }
type TraceEvent ¶
type TraceEvent struct { Type string PeerID peer.ID Timestamp time.Time Payload any `json:"Data"` // cannot use field "Data" because of gk.Record method }
func (*TraceEvent) Data ¶
func (t *TraceEvent) Data() []byte
func (*TraceEvent) ExplicitHashKey ¶
func (t *TraceEvent) ExplicitHashKey() *string
func (*TraceEvent) PartitionKey ¶
func (t *TraceEvent) PartitionKey() string
type TraceEventPeerScore ¶
Click to show internal directories.
Click to hide internal directories.