Pushing for review

This commit is contained in:
gbrian
2022-03-29 06:15:02 +00:00
parent 01b3cac48b
commit 2f723d9ce1
7 changed files with 55 additions and 18 deletions

View File

@ -22,8 +22,6 @@ type WebRTC struct {
NAT1To1IPs []string
TCPMUX int
UDPMUX int
ImplicitControl bool
}
func (WebRTC) Init(cmd *cobra.Command) error {
@ -67,12 +65,6 @@ func (WebRTC) Init(cmd *cobra.Command) error {
return err
}
// TODO: Should be moved to session config.
cmd.PersistentFlags().Bool("implicit_control", false, "if enabled members can gain control implicitly")
if err := viper.BindPFlag("implicit_control", cmd.PersistentFlags().Lookup("implicit_control")); err != nil {
return err
}
return nil
}
@ -128,7 +120,4 @@ func (s *WebRTC) Set() {
s.EphemeralMin = min
s.EphemeralMax = max
}
// TODO: Should be moved to session config.
s.ImplicitControl = viper.GetBool("implicit_control")
}

View File

@ -1,4 +1,15 @@
package types
import (
"github.com/spf13/cobra"
)
type ControlMode string
const (
None ControlMode = ""
OnClick = "on_click"
OnMove = "on_click"
)
type Member struct {
ID string `json:"id"`
@ -30,6 +41,7 @@ type Session interface {
}
type SessionManager interface {
Init(cmd *cobra.Command) error
New(id string, admin bool, socket WebSocket) Session
HasHost() bool
IsHost(id string) bool
@ -51,4 +63,6 @@ type SessionManager interface {
OnDestroy(listener func(id string, session Session))
OnCreated(listener func(id string, session Session))
OnConnected(listener func(id string, session Session))
ImplicitControl() bool
ImplicitControlMode() ControlMode
}

View File

@ -13,7 +13,6 @@ type WebRTCManager interface {
CreatePeer(id string, session Session) (Peer, error)
ICELite() bool
ICEServers() []webrtc.ICEServer
ImplicitControl() bool
}
type Peer interface {

View File

@ -18,7 +18,7 @@ type Stats struct {
LastUserLeftAt *time.Time `json:"last_user_left_at"`
ControlProtection bool `json:"control_protection"`
ImplicitControl bool `json:"implicit_control"`
ImplicitControl string `json:"implicit_control"`
}
type WebSocket interface {