mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00

Rename the Transient state on connection to Limited. This is more appropriate and also doesn't conflict with the transient resource manager scope. Adds a Limited connectedness state for peers connected to us over Limited connections. This allows users to ignore such peers if they are interested in only peers connected to us over Unlimited connections. For some peers who disconnect before we sent a Connectedness event, we will now only send a Disconnected event. --------- Co-authored-by: guillaumemichel <guillaume@michel.id> Co-authored-by: sukun <sukunrt@gmail.com> Co-authored-by: Marco Munizaga <git@marcopolo.io>
40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package network
|
|
|
|
import (
|
|
"errors"
|
|
"net"
|
|
)
|
|
|
|
type temporaryError string
|
|
|
|
func (e temporaryError) Error() string { return string(e) }
|
|
func (e temporaryError) Temporary() bool { return true }
|
|
func (e temporaryError) Timeout() bool { return false }
|
|
|
|
var _ net.Error = temporaryError("")
|
|
|
|
// ErrNoRemoteAddrs is returned when there are no addresses associated with a peer during a dial.
|
|
var ErrNoRemoteAddrs = errors.New("no remote addresses")
|
|
|
|
// ErrNoConn is returned when attempting to open a stream to a peer with the NoDial
|
|
// option and no usable connection is available.
|
|
var ErrNoConn = errors.New("no usable connection to peer")
|
|
|
|
// ErrTransientConn is returned when attempting to open a stream to a peer with only a transient
|
|
// connection, without specifying the UseTransient option.
|
|
//
|
|
// Deprecated: Use ErrLimitedConn instead.
|
|
var ErrTransientConn = ErrLimitedConn
|
|
|
|
// ErrLimitedConn is returned when attempting to open a stream to a peer with only a conn
|
|
// connection, without specifying the AllowLimitedConn option.
|
|
var ErrLimitedConn = errors.New("limited connection to peer")
|
|
|
|
// ErrResourceLimitExceeded is returned when attempting to perform an operation that would
|
|
// exceed system resource limits.
|
|
var ErrResourceLimitExceeded = temporaryError("resource limit exceeded")
|
|
|
|
// ErrResourceScopeClosed is returned when attempting to reserve resources in a closed resource
|
|
// scope.
|
|
var ErrResourceScopeClosed = errors.New("resource scope closed")
|