Documentation
¶
Index ¶
- Variables
- type IncomingMessage
- type ListenerOptions
- type Options
- type Peer
- func (peer *Peer) Gossip(ctx context.Context, contentID []byte, subnet *id.Hash) error
- func (peer *Peer) GossipNonBlocking(contentID []byte, subnet *id.Hash) error
- func (peer *Peer) ID() id.Signatory
- func (peer *Peer) Link(remote id.Signatory) error
- func (peer *Peer) Listen(ctx context.Context, address string) (uint16, error)
- func (peer *Peer) Run(ctx context.Context) error
- func (peer *Peer) Send(ctx context.Context, data []byte, remote id.Signatory) error
- func (peer *Peer) SendNonBlocking(data []byte, remote id.Signatory) error
- func (peer *Peer) Sync(ctx context.Context, contentID []byte, hint *id.Signatory) ([]byte, error)
- func (peer *Peer) SyncNonBlocking(ctx context.Context, contentID []byte, hint *id.Signatory) ([]byte, error)
- func (peer *Peer) Unlink(remote id.Signatory) error
- type RateLimiterOptions
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, } DefaultMaxLinkedPeers uint = 100 DefaultMaxEphemeralConnections uint = 20 DefaultMaxPendingSyncs uint = 100 DefaultMaxActiveSyncsForSameContent uint = 10 DefaultMaxGossipSubnets uint = 100 DefaultMaxMessageSize uint = 4 * 1024 * 1024 DefaultOutgoingBufferSize uint = 100 DefaultIncomingBufferSize uint = 100 DefaultEventLoopBufferSize uint = 100 DefaultOutgoingBufferTimeout time.Duration = time.Second DefaultWriteTimeout time.Duration = time.Second DefaultDialRetryInterval time.Duration = time.Second DefaultEphemeralConnectionTTL time.Duration = 10 * time.Second DefaultMinimumConnectionExpiryAge time.Duration = time.Minute DefaultGossipAlpha int = 5 DefaultGossipTimeout time.Duration = 5 * time.Second DefaultPingAlpha int = 5 DefaultPongAlpha int = 5 DefaultPeerDiscoveryInterval time.Duration = 30 * time.Second DefaultPeerExpiryTimeout time.Duration = time.Minute )
View Source
var ( ErrTooManyLinkedPeers = errors.New("too many linked peers") ErrTooManyEphemeralConnections = errors.New("too many ephemeral connections") ErrMessageBufferFull = errors.New("outgoing message buffer is full") ErrEventLoopFull = errors.New("event loop buffer is full") ErrTooManyPendingSyncs = errors.New("too many pending sync requests") ErrTooManySyncsForSameContent = errors.New("too many simultaneous syncs for the same content ID") )
View Source
var ( DefaultRateLimiterCapacity int = 10 DefaultListenerRateLimiterOptions RateLimiterOptions = RateLimiterOptions{Rate: 10, Burst: 20} DefaultRate rate.Limit = 1024 * 1024 DefaultBurst int = 4 * 1024 * 1024 )
Functions ¶
This section is empty.
Types ¶
type IncomingMessage ¶ added in v0.6.1
type ListenerOptions ¶ added in v0.6.0
type ListenerOptions struct { RateLimiterCapacity int RateLimiterOptions }
func DefaultListenerOptions ¶ added in v0.6.0
func DefaultListenerOptions() ListenerOptions
type Options ¶ added in v0.4.0
type Options struct { Logger *zap.Logger MaxLinkedPeers uint MaxEphemeralConnections uint MaxPendingSyncs uint MaxActiveSyncsForSameContent uint MaxGossipSubnets uint MaxMessageSize uint OutgoingBufferSize uint IncomingBufferSize uint EventLoopBufferSize uint OutgoingBufferTimeout time.Duration WriteTimeout time.Duration DialRetryInterval time.Duration EphemeralConnectionTTL time.Duration MinimumConnectionExpiryAge time.Duration GossipAlpha int GossipTimeout time.Duration PingAlpha int PongAlpha int PeerDiscoveryInterval time.Duration PeerExpiryTimeout time.Duration ListenerOptions ListenerOptions ConnectionRateLimiterOptions RateLimiterOptions }
func DefaultOptions ¶ added in v0.4.0
func DefaultOptions() Options
type Peer ¶
type Peer struct { Opts Options Port uint16 PeerTable dht.Table ContentResolver dht.ContentResolver IncomingMessages chan IncomingMessage // contains filtered or unexported fields }
func (*Peer) GossipNonBlocking ¶ added in v0.6.0
func (*Peer) SendNonBlocking ¶ added in v0.6.0
func (*Peer) SyncNonBlocking ¶ added in v0.6.0
type RateLimiterOptions ¶ added in v0.6.0
func DefaultRateLimiterOptions ¶ added in v0.6.0
func DefaultRateLimiterOptions() RateLimiterOptions
Click to show internal directories.
Click to hide internal directories.