libp2pwebrtc

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 41 Imported by: 5

Documentation

Overview

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

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

func IsWebRTCDirectMultiaddr added in v0.34.0

func IsWebRTCDirectMultiaddr(addr ma.Multiaddr) (bool, int)

IsWebRTCDirectMultiaddr returns whether addr is a /webrtc-direct multiaddr with the count of certhashes in addr

Types

type ListenUDPFn added in v0.36.0

type ListenUDPFn func(network string, laddr *net.UDPAddr) (net.PacketConn, error)

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, listenUDP ListenUDPFn, opts ...Option) (*WebRTCTransport, error)

func (*WebRTCTransport) AddCertHashes added in v0.34.0

func (t *WebRTCTransport) AddCertHashes(addr ma.Multiaddr) (ma.Multiaddr, bool)

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/libp2p/go-libp2p/issues/2446 for details.

func (*WebRTCTransport) ListenOrder added in v0.36.0

func (t *WebRTCTransport) ListenOrder() int

func (*WebRTCTransport) Protocols

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

func (*WebRTCTransport) Proxy

func (t *WebRTCTransport) Proxy() bool

Directories

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

Jump to

Keyboard shortcuts

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