relay

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoID = "/libp2p/circuit/relay/0.1.0"

	ServiceName = "libp2p.relay/v1"

	StreamTimeout    = time.Minute
	ConnectTimeout   = 30 * time.Second
	HandshakeTimeout = time.Minute
)

Variables

This section is empty.

Functions

func CanHop

func CanHop(ctx context.Context, host host.Host, id peer.ID) (bool, error)

Queries a peer for support of hop relay

Types

type ACLFilter

type ACLFilter interface {
	AllowHop(src, dest peer.ID) bool
}

type Option

type Option func(r *Relay) error

func WithACL

func WithACL(acl ACLFilter) Option

WithACL specifies an ACLFilter for access control

func WithResources

func WithResources(rc Resources) Option

WithResources specifies resource limits for the relay

type Relay

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

func NewRelay

func NewRelay(h host.Host, opts ...Option) (*Relay, error)

func (*Relay) Close

func (r *Relay) Close() error

type Resources

type Resources struct {
	// MaxCircuits is the maximum number of active relay connections
	MaxCircuits int

	// MaxCircuitsPerPeer is the maximum number of active relay connections per peer
	MaxCircuitsPerPeer int

	// BufferSize is the buffer size for relaying in each direction
	BufferSize int
}

func DefaultResources

func DefaultResources() Resources

Jump to

Keyboard shortcuts

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