Documentation ¶
Index ¶
- Constants
- Variables
- func AddRelayTransport(h host.Host, upgrader transport.Upgrader, opts ...RelayOpt) error
- func CanHop(ctx context.Context, host host.Host, id peer.ID) (bool, error)
- func GenUpgrader(n *swarm.Swarm, connGater connmgr.ConnectionGater, opts ...tptu.Option) (transport.Upgrader, error)
- 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) Write(buf []byte) (int, error)
- type NetAddr
- type Relay
- func (r *Relay) CanHop(ctx context.Context, id peer.ID) (bool, error)
- func (r *Relay) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (*Conn, error)
- func (r *Relay) DialPeer(ctx context.Context, relay peer.AddrInfo, dest peer.AddrInfo) (*Conn, error)
- func (r *Relay) GetActiveHops() int32
- func (r *Relay) Listener() *RelayListener
- func (r *Relay) Matches(addr ma.Multiaddr) bool
- func (r *Relay) Transport() *RelayTransport
- type RelayError
- type RelayListener
- type RelayOpt
- type RelayTransport
- func (t *RelayTransport) CanDial(raddr ma.Multiaddr) bool
- func (r *RelayTransport) Close() error
- func (d *RelayTransport) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
- func (t *RelayTransport) Listen(laddr ma.Multiaddr) (transport.Listener, error)
- func (t *RelayTransport) Protocols() []int
- func (t *RelayTransport) Proxy() bool
- func (t *RelayTransport) Relay() *Relay
Constants ¶
View Source
const ProtoID = "/libp2p/circuit/relay/0.1.0"
Variables ¶
View Source
var ( RelayAcceptTimeout = 10 * time.Second HopConnectTimeout = 30 * time.Second StopHandshakeTimeout = 1 * time.Minute HopStreamBufferSize = 4096 HopStreamLimit = 1 << 19 // 512K hops for 1M goroutines )
View Source
var ( // OptActive configures the relay transport to actively establish // outbound connections on behalf of clients. You probably don't want to // enable this unless you know what you're doing. OptActive = RelayOpt(0) // OptHop configures the relay transport to accept requests to relay // traffic on behalf of third-parties. Unless OptActive is specified, // this will only relay traffic between peers already connected to this // node. OptHop = RelayOpt(1) // OptDiscovery is a no-op. It was introduced as a way to probe new // peers to see if they were willing to act as a relays. However, in // practice, it's useless. While it does test to see if these peers are // relays, it doesn't (and can't), check to see if these peers are // _active_ relays (i.e., will actively dial the target peer). // // This option may be re-enabled in the future but for now you shouldn't // use it. OptDiscovery = RelayOpt(2) )
View Source
var HopTagWeight = 5
HopTagWeight is the connection manager weight for connections carrying relay hop streams
Functions ¶
func AddRelayTransport ¶
AddRelayTransport constructs a relay and adds it as a transport to the host network.
Types ¶
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 Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
Relay is the relay transport and service.
func (*Relay) GetActiveHops ¶
func (*Relay) Listener ¶
func (r *Relay) Listener() *RelayListener
func (*Relay) Transport ¶
func (r *Relay) Transport() *RelayTransport
type RelayError ¶
type RelayError struct {
Code pb.CircuitRelay_Status
}
func (RelayError) Error ¶
func (e RelayError) Error() string
type RelayListener ¶
type RelayListener Relay
func (*RelayListener) Addr ¶
func (l *RelayListener) Addr() net.Addr
func (*RelayListener) Close ¶
func (l *RelayListener) Close() error
func (*RelayListener) Multiaddr ¶
func (l *RelayListener) Multiaddr() ma.Multiaddr
func (*RelayListener) Relay ¶
func (l *RelayListener) Relay() *Relay
type RelayTransport ¶
type RelayTransport Relay
func (*RelayTransport) Close ¶
func (r *RelayTransport) Close() error
func (*RelayTransport) Dial ¶
func (d *RelayTransport) Dial(ctx context.Context, a ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
func (*RelayTransport) Protocols ¶
func (t *RelayTransport) Protocols() []int
func (*RelayTransport) Proxy ¶
func (t *RelayTransport) Proxy() bool
func (*RelayTransport) Relay ¶
func (t *RelayTransport) Relay() *Relay
Click to show internal directories.
Click to hide internal directories.