Documentation ¶
Index ¶
- func NewWakuPeerstore(p peerstore.Peerstore) peerstore.Peerstore
- type ConnectionFailures
- type Origin
- type WakuPeerstore
- type WakuPeerstoreImpl
- func (ps *WakuPeerstoreImpl) AddAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration)
- func (ps *WakuPeerstoreImpl) AddAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration)
- func (ps *WakuPeerstoreImpl) AddConnFailure(p peer.AddrInfo)
- func (ps *WakuPeerstoreImpl) AddPrivKey(p peer.ID, privk ic.PrivKey) error
- func (ps *WakuPeerstoreImpl) AddProtocols(p peer.ID, proto ...protocol.ID) error
- func (ps *WakuPeerstoreImpl) AddPubKey(p peer.ID, pubk ic.PubKey) error
- func (ps *WakuPeerstoreImpl) AddPubSubTopic(p peer.ID, topic string) error
- func (ps *WakuPeerstoreImpl) AddrStream(ctx context.Context, p peer.ID) <-chan ma.Multiaddr
- func (ps *WakuPeerstoreImpl) Addrs(p peer.ID) []ma.Multiaddr
- func (ps *WakuPeerstoreImpl) ClearAddrs(p peer.ID)
- func (ps *WakuPeerstoreImpl) Close() error
- func (ps *WakuPeerstoreImpl) ConnFailures(p peer.AddrInfo) int
- func (ps *WakuPeerstoreImpl) ConsumePeerRecord(s *record.Envelope, ttl time.Duration) (accepted bool, err error)
- func (ps *WakuPeerstoreImpl) Direction(p peer.ID) (network.Direction, error)
- func (ps *WakuPeerstoreImpl) ENR(p peer.ID) (*enode.Node, error)
- func (ps *WakuPeerstoreImpl) FirstSupportedProtocol(p peer.ID, proto ...protocol.ID) (protocol.ID, error)
- func (ps *WakuPeerstoreImpl) Get(p peer.ID, key string) (interface{}, error)
- func (ps *WakuPeerstoreImpl) GetPeerRecord(p peer.ID) *record.Envelope
- func (ps *WakuPeerstoreImpl) GetProtocols(p peer.ID) ([]protocol.ID, error)
- func (ps *WakuPeerstoreImpl) LatencyEWMA(p peer.ID) time.Duration
- func (ps *WakuPeerstoreImpl) Origin(p peer.ID) (Origin, error)
- func (ps *WakuPeerstoreImpl) PeerInfo(peerID peer.ID) peer.AddrInfo
- func (ps *WakuPeerstoreImpl) Peers() peer.IDSlice
- func (ps *WakuPeerstoreImpl) PeersByOrigin(expectedOrigin Origin) peer.IDSlice
- func (ps *WakuPeerstoreImpl) PeersByPubSubTopic(pubSubTopic string, specificPeers ...peer.ID) peer.IDSlice
- func (ps *WakuPeerstoreImpl) PeersByPubSubTopics(pubSubTopics []string, specificPeers ...peer.ID) peer.IDSlice
- func (ps *WakuPeerstoreImpl) PeersWithAddrs() peer.IDSlice
- func (ps *WakuPeerstoreImpl) PeersWithKeys() peer.IDSlice
- func (ps *WakuPeerstoreImpl) PrivKey(p peer.ID) ic.PrivKey
- func (ps *WakuPeerstoreImpl) PubKey(p peer.ID) ic.PubKey
- func (ps *WakuPeerstoreImpl) PubSubTopics(p peer.ID) ([]string, error)
- func (ps *WakuPeerstoreImpl) Put(p peer.ID, key string, val interface{}) error
- func (ps *WakuPeerstoreImpl) RecordLatency(p peer.ID, t time.Duration)
- func (ps *WakuPeerstoreImpl) RemovePeer(p peer.ID)
- func (ps *WakuPeerstoreImpl) RemoveProtocols(p peer.ID, proto ...protocol.ID) error
- func (ps *WakuPeerstoreImpl) RemovePubSubTopic(p peer.ID, topic string) error
- func (ps *WakuPeerstoreImpl) ResetConnFailures(p peer.AddrInfo)
- func (ps *WakuPeerstoreImpl) SetAddr(p peer.ID, addr ma.Multiaddr, ttl time.Duration)
- func (ps *WakuPeerstoreImpl) SetAddrs(p peer.ID, addrs []ma.Multiaddr, ttl time.Duration)
- func (ps *WakuPeerstoreImpl) SetDirection(p peer.ID, direction network.Direction) error
- func (ps *WakuPeerstoreImpl) SetENR(p peer.ID, enr *enode.Node) error
- func (ps *WakuPeerstoreImpl) SetOrigin(p peer.ID, origin Origin) error
- func (ps *WakuPeerstoreImpl) SetProtocols(p peer.ID, proto ...protocol.ID) error
- func (ps *WakuPeerstoreImpl) SetPubSubTopics(p peer.ID, topics []string) error
- func (ps *WakuPeerstoreImpl) SupportsProtocols(p peer.ID, proto ...protocol.ID) ([]protocol.ID, error)
- func (ps *WakuPeerstoreImpl) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionFailures ¶
ConnectionFailures contains connection failure information towards all peers
type Origin ¶
type Origin int64
Origin is used to determine how the peer is identified, either it is statically added or discovered via one of the discovery protocols
type WakuPeerstore ¶
type WakuPeerstore interface { SetOrigin(p peer.ID, origin Origin) error Origin(p peer.ID) (Origin, error) PeersByOrigin(origin Origin) peer.IDSlice SetENR(p peer.ID, enr *enode.Node) error ENR(p peer.ID) (*enode.Node, error) AddConnFailure(p peer.AddrInfo) ResetConnFailures(p peer.AddrInfo) ConnFailures(p peer.AddrInfo) int SetDirection(p peer.ID, direction network.Direction) error Direction(p peer.ID) (network.Direction, error) AddPubSubTopic(p peer.ID, topic string) error RemovePubSubTopic(p peer.ID, topic string) error PubSubTopics(p peer.ID) ([]string, error) SetPubSubTopics(p peer.ID, topics []string) error PeersByPubSubTopics(pubSubTopics []string, specificPeers ...peer.ID) peer.IDSlice PeersByPubSubTopic(pubSubTopic string, specificPeers ...peer.ID) peer.IDSlice }
WakuPeerstore is an interface for implementing WakuPeerStore
type WakuPeerstoreImpl ¶
type WakuPeerstoreImpl struct {
// contains filtered or unexported fields
}
WakuPeerstoreImpl is a implementation of WakuPeerStore
func (*WakuPeerstoreImpl) AddConnFailure ¶
func (ps *WakuPeerstoreImpl) AddConnFailure(p peer.AddrInfo)
AddConnFailure increments connectionFailures for a peer
func (*WakuPeerstoreImpl) AddPrivKey ¶
func (*WakuPeerstoreImpl) AddProtocols ¶
func (*WakuPeerstoreImpl) AddPubSubTopic ¶
func (ps *WakuPeerstoreImpl) AddPubSubTopic(p peer.ID, topic string) error
AddPubSubTopic adds a new pubSubTopic for a peer
func (*WakuPeerstoreImpl) AddrStream ¶
func (*WakuPeerstoreImpl) ClearAddrs ¶
func (ps *WakuPeerstoreImpl) ClearAddrs(p peer.ID)
func (*WakuPeerstoreImpl) Close ¶
func (ps *WakuPeerstoreImpl) Close() error
func (*WakuPeerstoreImpl) ConnFailures ¶
func (ps *WakuPeerstoreImpl) ConnFailures(p peer.AddrInfo) int
ConnFailures fetches connectionFailures for a peer
func (*WakuPeerstoreImpl) ConsumePeerRecord ¶
func (*WakuPeerstoreImpl) Direction ¶
Direction fetches the connection direction (Inbound or outBound) for a specific peer
func (*WakuPeerstoreImpl) FirstSupportedProtocol ¶
func (*WakuPeerstoreImpl) Get ¶
func (ps *WakuPeerstoreImpl) Get(p peer.ID, key string) (interface{}, error)
func (*WakuPeerstoreImpl) GetPeerRecord ¶
func (ps *WakuPeerstoreImpl) GetPeerRecord(p peer.ID) *record.Envelope
GetPeerRecord returns a Envelope containing a PeerRecord for the given peer id, if one exists. Returns nil if no signed PeerRecord exists for the peer.
func (*WakuPeerstoreImpl) GetProtocols ¶
func (*WakuPeerstoreImpl) LatencyEWMA ¶
func (ps *WakuPeerstoreImpl) LatencyEWMA(p peer.ID) time.Duration
func (*WakuPeerstoreImpl) Origin ¶
func (ps *WakuPeerstoreImpl) Origin(p peer.ID) (Origin, error)
Origin fetches the origin for a specific peer.
func (*WakuPeerstoreImpl) PeerInfo ¶
func (ps *WakuPeerstoreImpl) PeerInfo(peerID peer.ID) peer.AddrInfo
func (*WakuPeerstoreImpl) Peers ¶
func (ps *WakuPeerstoreImpl) Peers() peer.IDSlice
func (*WakuPeerstoreImpl) PeersByOrigin ¶
func (ps *WakuPeerstoreImpl) PeersByOrigin(expectedOrigin Origin) peer.IDSlice
PeersByOrigin returns the list of peers for a specific origin
func (*WakuPeerstoreImpl) PeersByPubSubTopic ¶
func (ps *WakuPeerstoreImpl) PeersByPubSubTopic(pubSubTopic string, specificPeers ...peer.ID) peer.IDSlice
PeersByPubSubTopic Returns list of peers that support a single pubSubTopic If specifiPeers are listed, filtering is done from them otherwise from all peers in peerstore
func (*WakuPeerstoreImpl) PeersByPubSubTopics ¶ added in v0.9.0
func (ps *WakuPeerstoreImpl) PeersByPubSubTopics(pubSubTopics []string, specificPeers ...peer.ID) peer.IDSlice
PeersByPubSubTopic Returns list of peers that support list of pubSubTopics If specifiPeers are listed, filtering is done from them otherwise from all peers in peerstore
func (*WakuPeerstoreImpl) PeersWithAddrs ¶
func (ps *WakuPeerstoreImpl) PeersWithAddrs() peer.IDSlice
func (*WakuPeerstoreImpl) PeersWithKeys ¶
func (ps *WakuPeerstoreImpl) PeersWithKeys() peer.IDSlice
func (*WakuPeerstoreImpl) PubSubTopics ¶
func (ps *WakuPeerstoreImpl) PubSubTopics(p peer.ID) ([]string, error)
PubSubTopics fetches list of pubSubTopics for a peer
func (*WakuPeerstoreImpl) Put ¶
func (ps *WakuPeerstoreImpl) Put(p peer.ID, key string, val interface{}) error
func (*WakuPeerstoreImpl) RecordLatency ¶
func (ps *WakuPeerstoreImpl) RecordLatency(p peer.ID, t time.Duration)
func (*WakuPeerstoreImpl) RemovePeer ¶
func (ps *WakuPeerstoreImpl) RemovePeer(p peer.ID)
func (*WakuPeerstoreImpl) RemoveProtocols ¶
func (*WakuPeerstoreImpl) RemovePubSubTopic ¶ added in v0.8.1
func (ps *WakuPeerstoreImpl) RemovePubSubTopic(p peer.ID, topic string) error
RemovePubSubTopic removes a pubSubTopic from the peer
func (*WakuPeerstoreImpl) ResetConnFailures ¶
func (ps *WakuPeerstoreImpl) ResetConnFailures(p peer.AddrInfo)
ResetConnFailures resets connectionFailures for a peer to 0
func (*WakuPeerstoreImpl) SetDirection ¶
SetDirection sets connection direction for a specific peer.
func (*WakuPeerstoreImpl) SetOrigin ¶
func (ps *WakuPeerstoreImpl) SetOrigin(p peer.ID, origin Origin) error
SetOrigin sets origin for a specific peer.
func (*WakuPeerstoreImpl) SetProtocols ¶
func (*WakuPeerstoreImpl) SetPubSubTopics ¶
func (ps *WakuPeerstoreImpl) SetPubSubTopics(p peer.ID, topics []string) error
SetPubSubTopics sets pubSubTopics for a peer, it also overrides existing ones that were set previously..