Documentation ¶
Index ¶
- Variables
- func AddTransport(h host.Host, upgrader transport.Upgrader) error
- type Client
- func (c *Client) CanDial(addr ma.Multiaddr) bool
- func (c *Client) Close() error
- func (c *Client) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
- func (c *Client) Listen(addr ma.Multiaddr) (transport.Listener, error)
- func (c *Client) Listener() *Listener
- func (c *Client) Protocols() []int
- func (c *Client) Proxy() bool
- func (c *Client) Start()
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) LocalMultiaddr() ma.Multiaddr
- func (c *Conn) Read(buf []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) RemoteMultiaddr() ma.Multiaddr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Stat() network.ConnStats
- func (c *Conn) Write(buf []byte) (int, error)
- type Listener
- type NetAddr
- type Reservation
- type ReservationError
Constants ¶
This section is empty.
Variables ¶
var ( StatLimitDuration = statLimitDuration{} StatLimitData = statLimitData{} )
var ( StreamTimeout = 1 * time.Minute AcceptTimeout = 10 * time.Second )
var DialRelayTimeout = 5 * time.Second
var DialTimeout = time.Minute
var HopTagWeight = 5
HopTagWeight is the connection manager weight for connections carrying relay hop streams
var ReserveTimeout = time.Minute
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
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.
func New ¶
New constructs a new p2p-circuit/v2 client, attached to the given host and using the given upgrader to perform connection upgrades.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) LocalMultiaddr ¶
func (*Conn) RemoteAddr ¶
func (*Conn) RemoteMultiaddr ¶
TODO: is it okay to cast c.Conn().RemotePeer() into a multiaddr? might be "user input"
type Reservation ¶
type Reservation struct { // Expiration is the expiration time of the reservation Expiration time.Time // Addrs contains the vouched public addresses of the reserving peer, which can be // announced to the network Addrs []ma.Multiaddr // LimitDuration is the time limit for which the relay will keep a relayed connection // open. If 0, there is no limit. LimitDuration time.Duration // LimitData is the number of bytes that the relay will relay in each direction before // resetting a relayed connection. LimitData uint64 // Voucher is a signed reservation voucher provided by the relay Voucher *proto.ReservationVoucher }
Reservation is a struct carrying information about a relay/v2 slot reservation.
type ReservationError ¶
type ReservationError struct { // Status is the status returned by the relay for rejecting the reservation // request. It is set to pbv2.Status_CONNECTION_FAILED on other failures Status pbv2.Status // Reason is the reason for reservation failure Reason string // contains filtered or unexported fields }
ReservationError is the error returned on failure to reserve a slot in the relay
func (ReservationError) Error ¶
func (re ReservationError) Error() string
func (ReservationError) Unwrap ¶
func (re ReservationError) Unwrap() error