libp2pwebrtc

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Package libp2pwebrtc implements the WebRTC transport for go-libp2p, as described in https://github.com/libp2p/specs/tree/master/webrtc.

At this point, this package is EXPERIMENTAL, and the WebRTC transport is not enabled by default. While we're fairly confident that the implementation correctly implements the specification, we're not making any guarantees regarding its security (especially regarding resource exhaustion attacks). Fixes, even for security-related issues, will be conducted in the open.

Experimentation is encouraged. Please open an issue if you encounter any problems with this transport.

The udpmux subpackage contains the logic for multiplexing multiple WebRTC (ICE) connections over a single UDP socket.

Index

Constants

View Source
const (
	DefaultDisconnectedTimeout = 20 * time.Second
	DefaultFailedTimeout       = 30 * time.Second
	DefaultKeepaliveTimeout    = 15 * time.Second
)

timeout values for the peerconnection https://github.com/pion/webrtc/blob/v3.1.50/settingengine.go#L102-L109

View Source
const (
	DefaultMaxInFlightConnections = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*WebRTCTransport) error

type WebRTCTransport

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

func New

func New(privKey ic.PrivKey, psk pnet.PSK, gater connmgr.ConnectionGater, rcmgr network.ResourceManager, opts ...Option) (*WebRTCTransport, error)

func (*WebRTCTransport) CanDial

func (t *WebRTCTransport) CanDial(addr ma.Multiaddr) bool

func (*WebRTCTransport) Dial

func (t *WebRTCTransport) Dial(ctx context.Context, remoteMultiaddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)

func (*WebRTCTransport) Listen

func (t *WebRTCTransport) Listen(addr ma.Multiaddr) (tpt.Listener, error)

Listen returns a listener for addr.

The IP, Port combination for addr must be exclusive to this listener as a WebRTC listener cannot be multiplexed on the same port as other UDP based transports like QUIC and WebTransport. See https://github.com/chiangmaioneluv/go-libp2p/issues/2446 for details.

func (*WebRTCTransport) Protocols

func (t *WebRTCTransport) Protocols() []int

func (*WebRTCTransport) Proxy

func (t *WebRTCTransport) Proxy() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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