mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
72 lines
1.6 KiB
Go
72 lines
1.6 KiB
Go
package types
|
|
|
|
import "net/http"
|
|
|
|
type MemberProfile struct {
|
|
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
|
|
IsReceiving() bool
|
|
Disconnect(reason string) error
|
|
|
|
SetWebSocketPeer(websocket_peer WebSocketPeer)
|
|
SetWebSocketConnected(connected bool)
|
|
Send(v interface{}) error
|
|
|
|
SetWebRTCPeer(webrtc_peer WebRTCPeer)
|
|
SetWebRTCConnected(connected bool)
|
|
SignalAnswer(sdp string) error
|
|
}
|
|
|
|
type SessionManager interface {
|
|
Create(id string, profile MemberProfile) Session
|
|
Get(id string) (Session, bool)
|
|
Delete(id string) error
|
|
|
|
HasHost() bool
|
|
SetHost(host Session)
|
|
GetHost() Session
|
|
ClearHost()
|
|
|
|
HasConnectedMembers() bool
|
|
Members() []Session
|
|
Broadcast(v interface{}, exclude interface{})
|
|
AdminBroadcast(v interface{}, exclude interface{})
|
|
|
|
OnHost(listener func(session Session))
|
|
OnHostCleared(listener func(session Session))
|
|
OnCreated(listener func(session Session))
|
|
OnDeleted(listener func(session Session))
|
|
OnConnected(listener func(session Session))
|
|
OnDisconnected(listener func(session Session))
|
|
OnProfileChanged(listener func(session Session))
|
|
OnStateChanged(listener func(session Session))
|
|
|
|
ImplicitHosting() bool
|
|
|
|
Authenticate(r *http.Request) (Session, error)
|
|
}
|