Documentation ¶
Overview ¶
Package dep2pwebrtc implements the WebRTC transport for dep2p, as described in https://github.com/dep2p/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
- type Option
- type WebRTCTransport
- func (t *WebRTCTransport) CanDial(addr ma.Multiaddr) bool
- func (t *WebRTCTransport) Dial(ctx context.Context, remoteMultiaddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
- func (t *WebRTCTransport) Listen(addr ma.Multiaddr) (tpt.Listener, error)
- func (t *WebRTCTransport) Protocols() []int
- func (t *WebRTCTransport) Proxy() bool
Constants ¶
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
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) Dial ¶
func (t *WebRTCTransport) Dial(ctx context.Context, remoteMultiaddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
func (*WebRTCTransport) Listen ¶
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/bpfs/dep2p/issues/2446 for details.
func (*WebRTCTransport) Protocols ¶
func (t *WebRTCTransport) Protocols() []int
func (*WebRTCTransport) Proxy ¶
func (t *WebRTCTransport) Proxy() bool