Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnswerStream ¶
AnswerStream is stream of responses to a discovery request.
type Local ¶ added in v0.2.3
type Local struct {
// contains filtered or unexported fields
}
Local represents an information about local peer.
func New ¶ added in v0.2.3
func New(uid string, s Signalling) *Local
New creates a new local peer with a given ID that will use a specific server for peer discovery.
type OfferStream ¶
OfferStream is a stream of discovery messages coming from other peers.
type Peer ¶ added in v0.2.3
type Peer interface { // UID returns a optional user ID of this peer. UID() string // Dial establishes a new connection to this peer. Dial() (net.Conn, error) }
Peer represents an information about a potential peer.
type Peers ¶ added in v0.2.3
type Peers interface { // Accept queries an information about next available peer. It won't connect to it automatically. Accept() (Peer, error) // Close ends a peer discovery process. Close() error }
Peers represents a dynamic list of peers that were discovered via signalling.
type Signal ¶
type Signal struct { UID string // optional user identifier to distinguish peers Data []byte // payload generated by WebRTC to establish connection }
Signal describes a message that will be sent via signalling channel to discover peers.
type Signalling ¶
type Signalling interface { // Broadcast sends a peer discovery request. Broadcast(s Signal) (AnswerStream, error) // Listen starts listening for incoming peer discovery requests. Listen(uid string) (OfferStream, error) }
Signalling is an interface for a signalling connection that helps to establish P2P connections.
Click to show internal directories.
Click to hide internal directories.