Documentation ¶
Index ¶
- Variables
- type DiscoveryClient
- type 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
- type GossiperOptions
- type 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
- 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
- type SyncerOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultSubnet = id.Hash{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} DefaultAlpha = 5 DefaultTimeout = time.Second DefaultGossipTimeout = 3 * time.Second )
View Source
var (
ErrPeerNotFound = errors.New("peer not found")
)
Functions ¶
This section is empty.
Types ¶
type DiscoveryClient ¶
type DiscoveryClient struct {
// contains filtered or unexported fields
}
func NewDiscoveryClient ¶
func NewDiscoveryClient(opts DiscoveryOptions, transport *transport.Transport) *DiscoveryClient
func (*DiscoveryClient) DidReceiveMessage ¶
func (*DiscoveryClient) DiscoverPeers ¶
func (dc *DiscoveryClient) DiscoverPeers(ctx context.Context)
type DiscoveryOptions ¶
type DiscoveryOptions struct { Logger *zap.Logger Alpha int MaxExpectedPeers int PingTimePeriod time.Duration }
func DefaultDiscoveryOptions ¶
func DefaultDiscoveryOptions() DiscoveryOptions
func (DiscoveryOptions) WithAlpha ¶
func (opts DiscoveryOptions) WithAlpha(alpha int) DiscoveryOptions
func (DiscoveryOptions) WithLogger ¶
func (opts DiscoveryOptions) WithLogger(logger *zap.Logger) DiscoveryOptions
func (DiscoveryOptions) WithMaxExpectedPeers ¶
func (opts DiscoveryOptions) WithMaxExpectedPeers(max int) DiscoveryOptions
func (DiscoveryOptions) WithPingTimePeriod ¶
func (opts DiscoveryOptions) WithPingTimePeriod(period time.Duration) DiscoveryOptions
type Gossiper ¶
type Gossiper struct {
// contains filtered or unexported fields
}
func NewGossiper ¶
func NewGossiper(opts GossiperOptions, filter *channel.SyncFilter, transport *transport.Transport) *Gossiper
func (*Gossiper) DidReceiveMessage ¶
func (*Gossiper) Resolve ¶
func (g *Gossiper) Resolve(resolver dht.ContentResolver)
type GossiperOptions ¶
func DefaultGossiperOptions ¶
func DefaultGossiperOptions() GossiperOptions
func (GossiperOptions) WithAlpha ¶
func (opts GossiperOptions) WithAlpha(alpha int) GossiperOptions
func (GossiperOptions) WithLogger ¶
func (opts GossiperOptions) WithLogger(logger *zap.Logger) GossiperOptions
func (GossiperOptions) WithTimeout ¶
func (opts GossiperOptions) WithTimeout(timeout time.Duration) GossiperOptions
type Options ¶
type Options struct { SyncerOptions GossiperOptions DiscoveryOptions Logger *zap.Logger PrivKey *id.PrivKey }
func DefaultOptions ¶
func DefaultOptions() Options
func (Options) WithDiscoveryOptions ¶
func (opts Options) WithDiscoveryOptions(discoveryOptions DiscoveryOptions) Options
func (Options) WithGossiperOptions ¶
func (opts Options) WithGossiperOptions(gossiperOptions GossiperOptions) Options
func (Options) WithSyncerOptions ¶
func (opts Options) WithSyncerOptions(syncerOptions SyncerOptions) Options
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) DiscoverPeers ¶
func (*Peer) Resolve ¶
func (p *Peer) Resolve(ctx context.Context, contentResolver dht.ContentResolver)
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
func NewSyncer ¶
func NewSyncer(opts SyncerOptions, filter *channel.SyncFilter, transport *transport.Transport) *Syncer
func (*Syncer) DidReceiveMessage ¶
type SyncerOptions ¶
func DefaultSyncerOptions ¶
func DefaultSyncerOptions() SyncerOptions
func (SyncerOptions) WithAlpha ¶
func (opts SyncerOptions) WithAlpha(alpha int) SyncerOptions
func (SyncerOptions) WithLogger ¶
func (opts SyncerOptions) WithLogger(logger *zap.Logger) SyncerOptions
func (SyncerOptions) WithWiggleTimeout ¶
func (opts SyncerOptions) WithWiggleTimeout(timeout time.Duration) SyncerOptions
Click to show internal directories.
Click to hide internal directories.