Fix all golint errors

This commit is contained in:
Sean DuBois
2018-06-12 22:24:52 -07:00
parent c21bc319d2
commit ddbb6c8ba8
14 changed files with 86 additions and 40 deletions

View File

@@ -13,20 +13,27 @@ import (
"github.com/pkg/errors"
)
type ChannelGenerator func(username string, srcAddr *stun.TransportAddr) (password string, ok bool)
// MediaType determines the type of media we are sending receiving
type MediaType int
const (
// G711 is a MediaType
G711 MediaType = iota
// G722 is a MediaType
G722 MediaType = iota
// ILBC is a MediaType
ILBC MediaType = iota
// ISAC is a MediaType
ISAC MediaType = iota
// H264 is a MediaType
H264 MediaType = iota
VP8 MediaType = iota
// VP8 is a MediaType
VP8 MediaType = iota
// Opus is a MediaType
Opus MediaType = iota
)
// RTCPeerConnection represents a WebRTC connection between itself and a remote peer
type RTCPeerConnection struct {
Ontrack func(mediaType MediaType, buffers <-chan *rtp.Packet)
LocalDescription *sdp.SessionDescription
@@ -39,10 +46,14 @@ type RTCPeerConnection struct {
// Public
// SetRemoteDescription sets the SessionDescription of the remote peer
func (r *RTCPeerConnection) SetRemoteDescription(string) error {
return nil
}
// CreateOffer starts the RTCPeerConnection and generates the localDescription
// The order of CreateOffer/SetRemoteDescription determines if we are the offerer or the answerer
// Once the RemoteDescription has been set network activity will start
func (r *RTCPeerConnection) CreateOffer() error {
if r.tlscfg != nil {
return errors.Errorf("tlscfg is already defined, CreateOffer can only be called once")
@@ -54,7 +65,7 @@ func (r *RTCPeerConnection) CreateOffer() error {
candidates := []string{}
basePriority := uint16(rand.Uint32() & (1<<16 - 1))
for id, c := range ice.HostInterfaces() {
dstPort, err := network.UdpListener(c, []byte(r.icePassword), r.tlscfg, r.generateChannel)
dstPort, err := network.UDPListener(c, []byte(r.icePassword), r.tlscfg, r.generateChannel)
if err != nil {
panic(err)
}
@@ -67,6 +78,9 @@ func (r *RTCPeerConnection) CreateOffer() error {
return nil
}
// AddStream adds a new media to the RTCPeerConnection
// This function returns a channel to push buffers on, and an error if the channel can't be added
// Closing the channel ends this stream
func (r *RTCPeerConnection) AddStream(mediaType MediaType) (buffers chan<- []byte, err error) {
return nil, nil
}