new MemberProfile & session refactor.

This commit is contained in:
Miroslav Šedivý
2020-12-02 17:29:38 +01:00
parent 220e162f42
commit 0d2f3405bb
4 changed files with 122 additions and 62 deletions

View File

@ -3,29 +3,41 @@ package types
import "net/http"
type MemberProfile struct {
ID string
Secret string
Name string
IsAdmin bool
//Enabled bool
//CanControl bool
//CanWatch bool
//ClipboardAccess bool
Secret string
Name string
IsAdmin bool
CanLogin bool
CanConnect bool
CanWatch bool
CanHost bool
CanAccessClipboard bool
}
type Session interface {
ID() string
VerifySecret(secret string) bool
Name() string
IsAdmin() bool
CanLogin() bool
CanConnect() bool
CanWatch() bool
CanHost() bool
CanAccessClipboard() bool
SetProfile(profile MemberProfile)
IsHost() bool
IsConnected() bool
VerifySecret(secret string) bool
IsReceiving() bool
Disconnect(reason string) error
SetWebSocketPeer(websocket_peer WebSocketPeer)
SetWebSocketConnected(connected bool)
Send(v interface{}) error
SetWebRTCPeer(webrtc_peer WebRTCPeer)
SetWebRTCConnected(connected bool)
Disconnect(reason string) error
Send(v interface{}) error
SignalAnswer(sdp string) error
}
@ -47,8 +59,8 @@ type SessionManager interface {
OnHostCleared(listener func(session Session))
OnConnected(listener func(session Session))
OnDisconnected(listener func(session Session))
ImplicitHosting() bool
// auth
Authenticate(r *http.Request) (Session, error)
}