Documentation ¶
Index ¶
- func PeerInfoFromAddr(addr string) (*peer.AddrInfo, error)
- func PeerInfoFromAddrs(addrs []string) ([]*peer.AddrInfo, map[string]string)
- func PeerInfoFromDomainPort(domainPort string) (*peer.AddrInfo, error)
- type PeerStore
- func (ps *PeerStore) AddPersistentPeers(dnsAddresses []string, networkName string, role PhoneBookEntryRoles)
- func (ps *PeerStore) GetAddresses(n int, role PhoneBookEntryRoles) []string
- func (ps *PeerStore) GetConnectionWaitTime(addr string) (bool, time.Duration, time.Time)
- func (ps *PeerStore) Length() int
- func (ps *PeerStore) ReplacePeerList(addressesThey []string, networkName string, role PhoneBookEntryRoles)
- func (ps *PeerStore) UpdateConnectionTime(addr string, provisionalTime time.Time) bool
- func (ps *PeerStore) UpdateRetryAfter(addr string, retryAfter time.Time)
- type PhoneBookEntryRoles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PeerInfoFromAddr ¶
PeerInfoFromAddr extracts the AddrInfo from a multiaddr string.
func PeerInfoFromAddrs ¶
PeerInfoFromAddrs extracts the AddrInfo from a multiaddr string slice.
Types ¶
type PeerStore ¶
type PeerStore struct {
// contains filtered or unexported fields
}
PeerStore implements Peerstore and CertifiedAddrBook.
func MakePhonebook ¶
func MakePhonebook(connectionsRateLimitingCount uint, connectionsRateLimitingWindow time.Duration) (*PeerStore, error)
MakePhonebook creates a phonebook with the passed configuration values
func NewPeerStore ¶
NewPeerStore creates a new peerstore backed by a datastore.
func (*PeerStore) AddPersistentPeers ¶
func (ps *PeerStore) AddPersistentPeers(dnsAddresses []string, networkName string, role PhoneBookEntryRoles)
AddPersistentPeers stores addresses of peers which are persistent. i.e. they won't be replaced by ReplacePeerList calls
func (*PeerStore) GetAddresses ¶
func (ps *PeerStore) GetAddresses(n int, role PhoneBookEntryRoles) []string
GetAddresses returns up to N addresses, but may return fewer
func (*PeerStore) GetConnectionWaitTime ¶
GetConnectionWaitTime will calculate and return the wait time to prevent exceeding connectionsRateLimitingCount. The connection should be established when the waitTime is 0. It will register a provisional next connection time when the waitTime is 0. The provisional time should be updated after the connection with UpdateConnectionTime
func (*PeerStore) ReplacePeerList ¶
func (ps *PeerStore) ReplacePeerList(addressesThey []string, networkName string, role PhoneBookEntryRoles)
ReplacePeerList replaces the peer list for the given networkName and role.
func (*PeerStore) UpdateConnectionTime ¶
UpdateConnectionTime updates the connection time for the given address.
type PhoneBookEntryRoles ¶
type PhoneBookEntryRoles int
PhoneBookEntryRoles defines the roles that a single entry on the phonebook can take. currently, we have two roles : relay role and archiver role, which are mutually exclusive.