Files
webrtc/internal/network/network.go
Sean DuBois bd9a6f6ca1 DTLS state should be shared by all ports
Before pion-WebRTC will fail if you bounce between STUN/Host
candidates. Our network code incorrectly failed to share SRTP/DTLS state
between all ports.
2018-07-21 12:27:38 -07:00

53 lines
1.5 KiB
Go

package network
import (
"github.com/pions/webrtc/pkg/ice"
"github.com/pions/webrtc/pkg/rtp"
)
// BufferTransportGenerator generates a new channel for the associated SSRC
// This channel is used to send RTP packets to users of pion-WebRTC
type BufferTransportGenerator func(uint32, uint8) chan<- *rtp.Packet
// ICENotifier notifies the RTCPeerConnection if ICE state has changed
type ICENotifier func(ice.ConnectionState)
// DataChannelEventHandler notifies the RTCPeerConnection of events relating to DataChannels
type DataChannelEventHandler func(DataChannelEvent)
// DataChannelEventType is the enum used to represent different types of DataChannelEvent
type DataChannelEventType int
// Enums for DataChannelEventType
const (
NewDataChannel int = iota + 1
NewMessage
)
// DataChannelEvent is the interface for all events that flow across the DataChannelEventHandler
type DataChannelEvent interface {
StreamIdentifier() uint16
}
// DataChannelCreated is emitted when a new DataChannel is created
type DataChannelCreated struct {
Label string
streamIdentifier uint16
}
// StreamIdentifier returns the streamIdentifier
func (d *DataChannelCreated) StreamIdentifier() uint16 {
return d.streamIdentifier
}
// DataChannelMessage is emitted when a DataChannel recieves a message
type DataChannelMessage struct {
Body []byte
streamIdentifier uint16
}
// StreamIdentifier returns the streamIdentifier
func (d *DataChannelMessage) StreamIdentifier() uint16 {
return d.streamIdentifier
}