Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidTURNServerAddr = errors.New("invalid TURN server address") // The specified TURN server address is invalid ErrMissingTURNCredentials = errors.New("missing TURN server credentials") // The specified TURN server is missing credentials ErrMissingForcedTURNServer = errors.New("TURN is forced, but no TURN server has been configured") // All connections must use TURN, but no TURN server has been configured )
View Source
var (
ErrAllNamesClaimed = errors.New("all available names have been claimed") // All specified usernames have already been claimed by other peers
)
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
NamedAdapter provides a connection service without name conflict prevention
func NewAdapter ¶
func NewAdapter( signaler string, key string, ice []string, channels []string, config *AdapterConfig, ctx context.Context, ) *Adapter
NewAdapter creates the adapter
type AdapterConfig ¶
type AdapterConfig struct { Timeout time.Duration // Time to wait before retrying to connect to the signaler ID string // ID to claim without conflict resolution (default is UUID) ForceRelay bool // Whether to block P2P connections OnSignalerReconnect func() // Handler to be called when the adapter has reconnected to the signaler }
AdapterConfig configures the adapter
type NamedAdapter ¶
type NamedAdapter struct {
// contains filtered or unexported fields
}
NamedAdapter provides a connection service with name conflict prevention
func NewNamedAdapter ¶
func NewNamedAdapter( signaler string, key string, ice []string, channels []string, config *NamedAdapterConfig, ctx context.Context, ) *NamedAdapter
NewNamedAdapter creates the adapter
func (*NamedAdapter) Accept ¶
func (a *NamedAdapter) Accept() chan *Peer
Accept returns a channel on which peers will be sent when they connect
func (*NamedAdapter) Close ¶
func (a *NamedAdapter) Close() error
Close disconnects the adapter from the signaler
func (*NamedAdapter) Err ¶
func (a *NamedAdapter) Err() chan error
Err returns a channel on which all fatal errors will be sent
func (*NamedAdapter) Open ¶
func (a *NamedAdapter) Open() (chan string, error)
Open connects the adapter to the signaler
type NamedAdapterConfig ¶
type NamedAdapterConfig struct { *AdapterConfig IDChannel string // Channel to use for ID negotiation Names []string // Names to try and claim one of Kicks time.Duration // Time to wait for kicks before claiming names IsIDClaimed func(theirs map[string]struct{}, ours string) bool // Handler to be called when asked to compare own ID with an incoming greeting }
NamedAdapterConfig configures the adapter
Click to show internal directories.
Click to hide internal directories.