relay

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const P_CIRCUIT = 290
View Source
const ProtoID = "/libp2p/circuit/relay/0.1.0"

Variables

View Source
var (
	OptActive = RelayOpt(0)
	OptHop    = RelayOpt(1)
)
View Source
var HopConnectTimeout = 10 * time.Second
View Source
var Protocol = ma.Protocol{
	Code:  P_CIRCUIT,
	Size:  0,
	Name:  "p2p-circuit",
	VCode: ma.CodeToVarint(P_CIRCUIT),
}
View Source
var RelayAcceptTimeout = time.Minute

Functions

func AddRelayTransport

func AddRelayTransport(ctx context.Context, h host.Host, opts ...RelayOpt) error

AddRelayTransport constructs a relay and adds it as a transport to the host network.

Types

type Conn

type Conn struct {
	inet.Stream
	// contains filtered or unexported fields
}

func (*Conn) ID

func (c *Conn) ID() string

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) LocalMultiaddr

func (c *Conn) LocalMultiaddr() ma.Multiaddr

func (*Conn) LocalPeer

func (c *Conn) LocalPeer() peer.ID

func (*Conn) LocalPrivateKey

func (c *Conn) LocalPrivateKey() ic.PrivKey

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) RemoteMultiaddr

func (c *Conn) RemoteMultiaddr() ma.Multiaddr

func (*Conn) RemotePeer

func (c *Conn) RemotePeer() peer.ID

func (*Conn) RemotePublicKey

func (c *Conn) RemotePublicKey() ic.PubKey

func (*Conn) Transport

func (c *Conn) Transport() tpt.Transport

type NetAddr

type NetAddr struct {
	Relay  string
	Remote string
}

func (*NetAddr) Network

func (n *NetAddr) Network() string

func (*NetAddr) String

func (n *NetAddr) String() string

type Relay

type Relay struct {
	// contains filtered or unexported fields
}

func NewRelay

func NewRelay(ctx context.Context, h host.Host, opts ...RelayOpt) (*Relay, error)

func (*Relay) CanHop

func (r *Relay) CanHop(ctx context.Context, id peer.ID) (bool, error)

func (*Relay) DialPeer

func (r *Relay) DialPeer(ctx context.Context, relay pstore.PeerInfo, dest pstore.PeerInfo) (*Conn, error)

func (*Relay) Dialer

func (r *Relay) Dialer() *RelayDialer

func (*Relay) Listener

func (r *Relay) Listener() *RelayListener

func (*Relay) Notifiee

func (r *Relay) Notifiee() inet.Notifiee

func (*Relay) Transport

func (r *Relay) Transport() *RelayTransport

type RelayDialer

type RelayDialer Relay

func (*RelayDialer) Dial

func (d *RelayDialer) Dial(a ma.Multiaddr) (tpt.Conn, error)

func (*RelayDialer) DialContext

func (d *RelayDialer) DialContext(ctx context.Context, a ma.Multiaddr) (tpt.Conn, error)

func (*RelayDialer) Matches

func (d *RelayDialer) Matches(a ma.Multiaddr) bool

func (*RelayDialer) Relay

func (d *RelayDialer) Relay() *Relay

type RelayError

type RelayError struct {
	Code pb.CircuitRelay_Status
}

func (RelayError) Error

func (e RelayError) Error() string

type RelayListener

type RelayListener Relay

func (*RelayListener) Accept

func (l *RelayListener) Accept() (tpt.Conn, error)

func (*RelayListener) Addr

func (l *RelayListener) Addr() net.Addr

func (*RelayListener) Close

func (l *RelayListener) Close() error

func (*RelayListener) LocalPeer

func (l *RelayListener) LocalPeer() peer.ID

func (*RelayListener) Multiaddr

func (l *RelayListener) Multiaddr() ma.Multiaddr

func (*RelayListener) Relay

func (l *RelayListener) Relay() *Relay

func (*RelayListener) SetAddrFilters

func (l *RelayListener) SetAddrFilters(f *filter.Filters)

type RelayNotifiee

type RelayNotifiee Relay

func (*RelayNotifiee) ClosedStream

func (n *RelayNotifiee) ClosedStream(net inet.Network, s inet.Stream)

func (*RelayNotifiee) Connected

func (n *RelayNotifiee) Connected(s inet.Network, c inet.Conn)

func (*RelayNotifiee) Disconnected

func (n *RelayNotifiee) Disconnected(s inet.Network, c inet.Conn)

func (*RelayNotifiee) Listen

func (n *RelayNotifiee) Listen(net inet.Network, a ma.Multiaddr)

func (*RelayNotifiee) ListenClose

func (n *RelayNotifiee) ListenClose(net inet.Network, a ma.Multiaddr)

func (*RelayNotifiee) OpenedStream

func (n *RelayNotifiee) OpenedStream(net inet.Network, s inet.Stream)

func (*RelayNotifiee) Relay

func (n *RelayNotifiee) Relay() *Relay

type RelayOpt

type RelayOpt int

type RelayTransport

type RelayTransport Relay

func (*RelayTransport) Dialer

func (t *RelayTransport) Dialer(laddr ma.Multiaddr, opts ...tpt.DialOpt) (tpt.Dialer, error)

func (*RelayTransport) Listen

func (t *RelayTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error)

func (*RelayTransport) Matches

func (t *RelayTransport) Matches(a ma.Multiaddr) bool

func (*RelayTransport) Relay

func (t *RelayTransport) Relay() *Relay

Directories

Path Synopsis
Package relay_pb is a generated protocol buffer package.
Package relay_pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL