signaling

package
v0.37.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySignalingID = errors.New("signaling id cannot be empty")

ErrEmptySignalingID is returned if the signaling id cannot be empty.

Functions

This section is empty.

Types

type HandleSignalPeer

type HandleSignalPeer interface {
	// Directive indicates HandleSignalPeer is a directive.
	directive.Directive

	// SignalingID returns the identifier of the signaling channel.
	// Cannot be empty.
	HandleSignalingID() string
	// HandleSignalPeerSession returns the handle to the signaling session.
	// Cannot be empty.
	HandleSignalPeerSession() SignalPeerSession
}

HandleSignalPeer is a directive to handle an incoming signaling session.

Does not expect any values to be resolved.

func NewHandleSignalPeer

func NewHandleSignalPeer(signalingID string, signalPeerSession SignalPeerSession) HandleSignalPeer

NewHandleSignalPeer constructs a new HandleSignalPeer directive.

type SignalPeer

type SignalPeer interface {
	// Directive indicates SignalPeer is a directive.
	directive.Directive

	// SignalingID returns the identifier of the signaling channel to use.
	// Can be empty to use any channel.
	SignalingID() string
	// SignalLocalPeerID returns the local peer ID to signal from.
	// Can be empty.
	SignalLocalPeerID() peer.ID
	// SignalRemotePeerID returns the remote peer ID to signal to.
	// Cannot be empty.
	SignalRemotePeerID() peer.ID
}

SignalPeer is a directive to establish a signaling channel with a remote peer.

func NewSignalPeer

func NewSignalPeer(signalingID string, localPeerID, remotePeerID peer.ID) SignalPeer

NewSignalPeer constructs a new SignalPeer directive.

type SignalPeerSession

type SignalPeerSession interface {
	// GetLocalPeerID returns the local peer ID.
	GetLocalPeerID() peer.ID
	// GetRemotePeerID returns the remote peer ID.
	GetRemotePeerID() peer.ID

	// Send transmits a message to the remote peer.
	// Blocks until the context is canceled OR the message is acked.
	Send(ctx context.Context, msg []byte) error
	// Recv waits for and acknowledges an incoming message from the remote peer.
	Recv(ctx context.Context) ([]byte, error)
}

SignalPeerSession is a handle to a Signaling session with a remote peer.

type SignalPeerValue

type SignalPeerValue = SignalPeerSession

SignalPeerValue is the value of the SignalPeer directive.

func ExSignalPeer

func ExSignalPeer(
	ctx context.Context,
	b bus.Bus,
	signalingID string,
	localPeerID, remotePeerID peer.ID,
	returnIfIdle bool,
) (SignalPeerValue, func(), error)

ExSignalPeer opens a SignalPeerSession with the remote peer ID.

signalingID and localPeerID are optional returns a release function if returnIfIdle: returns nil, nil, nil if not found (idle directive)

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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