Versions in this module Expand all Collapse all v0 v0.6.2 Dec 11, 2021 v0.6.1 Dec 11, 2021 Changes in this version + var DefaultAlpha = 5 + var DefaultGossipTimeout = 3 * time.Second + var DefaultSubnet = id.Hash + var DefaultTimeout = time.Second + var ErrPeerNotFound = errors.New("peer not found") + type DiscoveryClient struct + func NewDiscoveryClient(opts DiscoveryOptions, transport *transport.Transport) *DiscoveryClient + func (dc *DiscoveryClient) DidReceiveMessage(from id.Signatory, ipAddr net.Addr, msg wire.Msg) error + func (dc *DiscoveryClient) DiscoverPeers(ctx context.Context) + type DiscoveryOptions struct + Alpha int + Logger *zap.Logger + MaxExpectedPeers int + PingTimePeriod time.Duration + func DefaultDiscoveryOptions() DiscoveryOptions + func (opts DiscoveryOptions) WithAlpha(alpha int) DiscoveryOptions + func (opts DiscoveryOptions) WithLogger(logger *zap.Logger) DiscoveryOptions + func (opts DiscoveryOptions) WithMaxExpectedPeers(max int) DiscoveryOptions + func (opts DiscoveryOptions) WithPingTimePeriod(period time.Duration) DiscoveryOptions + type Gossiper struct + func NewGossiper(opts GossiperOptions, filter *channel.SyncFilter, ...) *Gossiper + func (g *Gossiper) DidReceiveMessage(from id.Signatory, msg wire.Msg) error + func (g *Gossiper) Gossip(ctx context.Context, contentID []byte, subnet *id.Hash) + func (g *Gossiper) Resolve(resolver dht.ContentResolver) + type GossiperOptions struct + Alpha int + Logger *zap.Logger + Timeout time.Duration + func DefaultGossiperOptions() GossiperOptions + func (opts GossiperOptions) WithAlpha(alpha int) GossiperOptions + func (opts GossiperOptions) WithLogger(logger *zap.Logger) GossiperOptions + func (opts GossiperOptions) WithTimeout(timeout time.Duration) GossiperOptions + type Options struct + Logger *zap.Logger + PrivKey *id.PrivKey + func DefaultOptions() Options + func (opts Options) WithDiscoveryOptions(discoveryOptions DiscoveryOptions) Options + func (opts Options) WithGossiperOptions(gossiperOptions GossiperOptions) Options + func (opts Options) WithLogger(logger *zap.Logger) Options + func (opts Options) WithPrivKey(privKey *id.PrivKey) Options + func (opts Options) WithSyncerOptions(syncerOptions SyncerOptions) Options + type Peer struct + func New(opts Options, transport *transport.Transport) *Peer + func (p *Peer) DiscoverPeers(ctx context.Context) + func (p *Peer) Gossip(ctx context.Context, contentID []byte, subnet *id.Hash) + func (p *Peer) Gossiper() *Gossiper + func (p *Peer) ID() id.Signatory + func (p *Peer) Link(remote id.Signatory) + func (p *Peer) Ping(ctx context.Context) error + func (p *Peer) Receive(ctx context.Context, f func(id.Signatory, wire.Packet) error) + func (p *Peer) Resolve(ctx context.Context, contentResolver dht.ContentResolver) + func (p *Peer) Run(ctx context.Context) + func (p *Peer) Send(ctx context.Context, to id.Signatory, msg wire.Msg) error + func (p *Peer) Sync(ctx context.Context, contentID []byte, hint *id.Signatory) ([]byte, error) + func (p *Peer) Syncer() *Syncer + func (p *Peer) Transport() *transport.Transport + func (p *Peer) Unlink(remote id.Signatory) + type Syncer struct + func NewSyncer(opts SyncerOptions, filter *channel.SyncFilter, transport *transport.Transport) *Syncer + func (syncer *Syncer) DidReceiveMessage(from id.Signatory, msg wire.Msg) error + func (syncer *Syncer) Sync(ctx context.Context, contentID []byte, hint *id.Signatory) ([]byte, error) + type SyncerOptions struct + Alpha int + Logger *zap.Logger + WiggleTimeout time.Duration + func DefaultSyncerOptions() SyncerOptions + func (opts SyncerOptions) WithAlpha(alpha int) SyncerOptions + func (opts SyncerOptions) WithLogger(logger *zap.Logger) SyncerOptions + func (opts SyncerOptions) WithWiggleTimeout(timeout time.Duration) SyncerOptions