package client

Import Path
	github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client (on go.dev)

Dependency Relation
	imports 18 packages, and imported by 2 packages


Package-Level Type Names (total 6)
/* sort by: | */
Client implements the client-side of the p2p-circuit/v2 protocol: - it implements dialing through v2 relays - it listens for incoming connections through v2 relays. For backwards compatibility with v1 relays and older nodes, the client will also accept relay connections through v1 relays and fallback dial peers using p2p-circuit/v1. This allows us to use the v2 code as drop in replacement for v1 in a host without breaking existing code and interoperability with older nodes. (*Client) CanDial(addr ma.Multiaddr) bool (*Client) Close() error (*Client) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (transport.CapableConn, error) (*Client) Listen(addr ma.Multiaddr) (transport.Listener, error) (*Client) Listener() *Listener (*Client) Protocols() []int (*Client) Proxy() bool SkipResolve returns true since we always defer to the inner transport for the actual connection. By skipping resolution here, we let the inner transport decide how to resolve the multiaddr Start registers the circuit (client) protocol stream handlers *Client : github.com/libp2p/go-libp2p/core/transport.SkipResolver *Client : github.com/libp2p/go-libp2p/core/transport.Transport *Client : github.com/prometheus/common/expfmt.Closer *Client : io.Closer func New(h host.Host, upgrader transport.Upgrader) (*Client, error)
(*Conn) Close() error (*Conn) LocalAddr() net.Addr (*Conn) LocalMultiaddr() ma.Multiaddr (*Conn) Read(buf []byte) (int, error) (*Conn) RemoteAddr() net.Addr TODO: is it okay to cast c.Conn().RemotePeer() into a multiaddr? might be "user input" (*Conn) SetDeadline(t time.Time) error (*Conn) SetReadDeadline(t time.Time) error (*Conn) SetWriteDeadline(t time.Time) error (*Conn) Stat() network.ConnStats (*Conn) Write(buf []byte) (int, error) *Conn : github.com/libp2p/go-libp2p/core/network.ConnMultiaddrs *Conn : github.com/libp2p/go-libp2p/core/network.ConnStat *Conn : github.com/miekg/dns.Writer *Conn : github.com/multiformats/go-multiaddr/net.Conn *Conn : github.com/pion/datachannel.ReadDeadliner *Conn : github.com/pion/datachannel.WriteDeadliner *Conn : github.com/pion/stun.Connection *Conn : github.com/pion/stun/v3.Connection *Conn : github.com/prometheus/common/expfmt.Closer *Conn : internal/bisect.Writer *Conn : io.Closer *Conn : io.ReadCloser *Conn : io.Reader *Conn : io.ReadWriteCloser *Conn : io.ReadWriter *Conn : io.WriteCloser *Conn : io.Writer *Conn : net.Conn
(*Listener) Accept() (manet.Conn, error) (*Listener) Addr() net.Addr (*Listener) Close() error (*Listener) Multiaddr() ma.Multiaddr *Listener : github.com/multiformats/go-multiaddr.Multiaddrer *Listener : github.com/multiformats/go-multiaddr/net.Listener *Listener : github.com/prometheus/common/expfmt.Closer *Listener : io.Closer func (*Client).Listener() *Listener
Relay string Remote string (*NetAddr) Network() string (*NetAddr) String() string *NetAddr : expvar.Var *NetAddr : fmt.Stringer *NetAddr : net.Addr
Reservation is a struct carrying information about a relay/v2 slot reservation. Addrs contains the vouched public addresses of the reserving peer, which can be announced to the network Expiration is the expiration time of the reservation LimitData is the number of bytes that the relay will relay in each direction before resetting a relayed connection. LimitDuration is the time limit for which the relay will keep a relayed connection open. If 0, there is no limit. Voucher is a signed reservation voucher provided by the relay func Reserve(ctx context.Context, h host.Host, ai peer.AddrInfo) (*Reservation, error)
ReservationError is the error returned on failure to reserve a slot in the relay Reason is the reason for reservation failure Status is the status returned by the relay for rejecting the reservation request. It is set to pbv2.Status_CONNECTION_FAILED on other failures ( ReservationError) Error() string ( ReservationError) Unwrap() error ReservationError : error ReservationError : golang.org/x/xerrors.Wrapper
Package-Level Functions (total 3)
AddTransport constructs a new p2p-circuit/v2 client and adds it as a transport to the host network
New constructs a new p2p-circuit/v2 client, attached to the given host and using the given upgrader to perform connection upgrades.
Reserve reserves a slot in a relay and returns the reservation information. Clients must reserve slots in order for the relay to relay connections to them.
Package-Level Variables (total 8)
HopTagWeight is the connection manager weight for connections carrying relay hop streams