Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllDataGetter ¶
type AllDataGetter interface {
GetAllData(id peer.ID) *PeerAllData
}
type DynamicPeerstore ¶
type DynamicPeerstore interface {
ExtendedPeerstore
// Initialized if the peerstore is ready for use
Initialized() bool
// The current ID of the store, may be empty
PeerstoreID() PeerstoreID
// Replace the store.
// If a previous store is available, the local peer details (incl priv key)
// for the "retainPeer" are copied to the new store.
// The "retainPeer" is optional.
Switch(retainPeer peer.ID, id PeerstoreID, newInner ExtendedPeerstore)
}
func NewDynamicPeerstore ¶
func NewDynamicPeerstore() DynamicPeerstore
type ExtendedPeerstore ¶
type ExtendedPeerstore interface {
peerstore.Peerstore
StatusBook
MetadataBook
ENRBook
AllDataGetter
}
type IdentifyBook ¶
type IdentifyBook interface {
ProtocolVersion(id peer.ID) (string, error)
UserAgent(id peer.ID) (string, error)
}
IdentifyBook exposes the peer libp2p-identify info. Libp2p stores this data in the misc-data book
type MetadataBook ¶
type PeerAllData ¶
type PeerAllData struct {
PeerID peer.ID `json:"peer_id"`
NodeID enode.ID `json:"node_id"`
Pubkey string `json:"pubkey"`
Addrs []string `json:"addrs"`
Protocols []string `json:"protocols"`
Latency time.Duration `json:"latency"`
UserAgent string `json:"user_agent"`
ProtocolVersion string `json:"protocol_version"`
// Metadata with highest sequence number
MetaData *methods.MetaData `json:"metadata"`
// Highest claimed seq nr, we may not have the actual corresponding metadata yet.
ClaimedSeq methods.SeqNr `json:"claimed_seq"`
// Latest status
Status *methods.Status `json:"status"`
// Latest ENR
ENR *enode.Node `json:"enr"`
}
type PeerstoreID ¶
type PeerstoreID string
type Peerstores ¶
type Peerstores interface {
List() (out []PeerstoreID)
Find(id PeerstoreID) (pi ExtendedPeerstore, ok bool)
Create(id PeerstoreID, store ExtendedPeerstore) error
Remove(id PeerstoreID) (existed bool)
}
type PeerstoresMap ¶
type PeerstoresMap struct {
// contains filtered or unexported fields
}
func (*PeerstoresMap) Create ¶
func (cs *PeerstoresMap) Create(id PeerstoreID, store ExtendedPeerstore) error
func (*PeerstoresMap) Find ¶
func (cs *PeerstoresMap) Find(id PeerstoreID) (pi ExtendedPeerstore, ok bool)
func (*PeerstoresMap) List ¶
func (cs *PeerstoresMap) List() (out []PeerstoreID)
func (*PeerstoresMap) Remove ¶
func (cs *PeerstoresMap) Remove(id PeerstoreID) (existed bool)
Click to show internal directories.
Click to hide internal directories.