Versions in this module Expand all Collapse all v0 v0.20.5 Aug 11, 2022 v0.20.4 Jun 28, 2022 Changes in this version + const ConcurrentFdDials + const DefaultPerPeerRateLimit + const DialAttempts + var BackoffBase = time.Second * 5 + var BackoffCoef = time.Second + var BackoffMax = time.Minute * 5 + var ErrAddrFiltered = errors.New("address filtered") + var ErrAllDialsFailed = errors.New("all dials failed") + var ErrConnClosed = errors.New("connection closed") + var ErrDialBackoff = errors.New("dial backoff") + var ErrDialTimeout = errors.New("dial timed out") + var ErrDialToSelf = errors.New("dial to self attempted") + var ErrGaterDisallowedConnection = errors.New("gater disallows connection to peer") + var ErrNoAddresses = errors.New("no addresses") + var ErrNoGoodAddresses = errors.New("no good addresses") + var ErrNoTransport = errors.New("no transport for protocol") + var ErrSwarmClosed = errors.New("swarm closed") + type Conn struct + func (c *Conn) Close() error + func (c *Conn) GetStreams() []network.Stream + func (c *Conn) ID() string + func (c *Conn) LocalMultiaddr() ma.Multiaddr + func (c *Conn) LocalPeer() peer.ID + func (c *Conn) LocalPrivateKey() ic.PrivKey + func (c *Conn) NewStream(ctx context.Context) (network.Stream, error) + func (c *Conn) RemoteMultiaddr() ma.Multiaddr + func (c *Conn) RemotePeer() peer.ID + func (c *Conn) RemotePublicKey() ic.PubKey + func (c *Conn) Scope() network.ConnScope + func (c *Conn) Stat() network.ConnStats + func (c *Conn) String() string + type DialBackoff struct + func (db *DialBackoff) AddBackoff(p peer.ID, addr ma.Multiaddr) + func (db *DialBackoff) Backoff(p peer.ID, addr ma.Multiaddr) (backoff bool) + func (db *DialBackoff) Clear(p peer.ID) + type DialError struct + Cause error + DialErrors []TransportError + Peer peer.ID + Skipped int + func (e *DialError) Error() string + func (e *DialError) Timeout() bool + func (e *DialError) Unwrap() error + type Option func(*Swarm) error + func WithConnectionGater(gater connmgr.ConnectionGater) Option + func WithDialTimeout(t time.Duration) Option + func WithDialTimeoutLocal(t time.Duration) Option + func WithMetrics(reporter metrics.Reporter) Option + func WithResourceManager(m network.ResourceManager) Option + type Stream struct + func (s *Stream) Close() error + func (s *Stream) CloseRead() error + func (s *Stream) CloseWrite() error + func (s *Stream) Conn() network.Conn + func (s *Stream) ID() string + func (s *Stream) Protocol() protocol.ID + func (s *Stream) Read(p []byte) (int, error) + func (s *Stream) Reset() error + func (s *Stream) Scope() network.StreamScope + func (s *Stream) SetDeadline(t time.Time) error + func (s *Stream) SetProtocol(p protocol.ID) error + func (s *Stream) SetReadDeadline(t time.Time) error + func (s *Stream) SetWriteDeadline(t time.Time) error + func (s *Stream) Stat() network.Stats + func (s *Stream) String() string + func (s *Stream) Write(p []byte) (int, error) + type Swarm struct + func NewSwarm(local peer.ID, peers peerstore.Peerstore, opts ...Option) (*Swarm, error) + func (s *Swarm) AddListenAddr(a ma.Multiaddr) error + func (s *Swarm) AddTransport(t transport.Transport) error + func (s *Swarm) Backoff() *DialBackoff + func (s *Swarm) Close() error + func (s *Swarm) ClosePeer(p peer.ID) error + func (s *Swarm) Connectedness(p peer.ID) network.Connectedness + func (s *Swarm) Conns() []network.Conn + func (s *Swarm) ConnsToPeer(p peer.ID) []network.Conn + func (s *Swarm) DialPeer(ctx context.Context, p peer.ID) (network.Conn, error) + func (s *Swarm) InterfaceListenAddresses() ([]ma.Multiaddr, error) + func (s *Swarm) Listen(addrs ...ma.Multiaddr) error + func (s *Swarm) ListenAddresses() []ma.Multiaddr + func (s *Swarm) LocalPeer() peer.ID + func (s *Swarm) NewStream(ctx context.Context, p peer.ID) (network.Stream, error) + func (s *Swarm) Notify(f network.Notifiee) + func (s *Swarm) Peers() []peer.ID + func (s *Swarm) Peerstore() peerstore.Peerstore + func (s *Swarm) ResourceManager() network.ResourceManager + func (s *Swarm) SetStreamHandler(handler network.StreamHandler) + func (s *Swarm) StopNotify(f network.Notifiee) + func (s *Swarm) StreamHandler() network.StreamHandler + func (s *Swarm) String() string + func (s *Swarm) TransportForDialing(a ma.Multiaddr) transport.Transport + func (s *Swarm) TransportForListening(a ma.Multiaddr) transport.Transport + type TransportError struct + Address ma.Multiaddr + Cause error + func (e *TransportError) Error() string