mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move shared code to pkg.
This commit is contained in:
42
pkg/types/webrtc.go
Normal file
42
pkg/types/webrtc.go
Normal file
@ -0,0 +1,42 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrWebRTCVideoNotFound = errors.New("webrtc video not found")
|
||||
ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found")
|
||||
ErrWebRTCConnectionNotFound = errors.New("webrtc connection not found")
|
||||
)
|
||||
|
||||
type ICEServer struct {
|
||||
URLs []string `mapstructure:"urls" json:"urls"`
|
||||
Username string `mapstructure:"username" json:"username,omitempty"`
|
||||
Credential string `mapstructure:"credential" json:"credential,omitempty"`
|
||||
}
|
||||
|
||||
type WebRTCPeer interface {
|
||||
CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error)
|
||||
CreateAnswer() (*webrtc.SessionDescription, error)
|
||||
SetOffer(sdp string) error
|
||||
SetAnswer(sdp string) error
|
||||
SetCandidate(candidate webrtc.ICECandidateInit) error
|
||||
|
||||
SetVideoID(videoID string) error
|
||||
SendCursorPosition(x, y int) error
|
||||
SendCursorImage(cur *CursorImage, img []byte) error
|
||||
|
||||
Destroy()
|
||||
}
|
||||
|
||||
type WebRTCManager interface {
|
||||
Start()
|
||||
Shutdown() error
|
||||
|
||||
ICEServers() []ICEServer
|
||||
|
||||
CreatePeer(session Session, videoID string) (*webrtc.SessionDescription, error)
|
||||
}
|
Reference in New Issue
Block a user