Initial project snapshot
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package session
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
DataPlaneCandidateDirectWorkerWSS = "direct_worker_wss"
|
||||
DataPlaneCandidateBackendGateway = "backend_gateway"
|
||||
|
||||
DataPlaneChannelControl = "control"
|
||||
DataPlaneChannelInput = "input"
|
||||
DataPlaneChannelRender = "render"
|
||||
DataPlaneChannelClipboard = "clipboard"
|
||||
DataPlaneChannelFileUpload = "file_upload"
|
||||
DataPlaneChannelFileDownload = "file_download"
|
||||
DataPlaneChannelTelemetry = "telemetry"
|
||||
)
|
||||
|
||||
type DataPlaneOffer struct {
|
||||
Preferred string `json:"preferred"`
|
||||
Token string `json:"token"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
Candidates []DataPlaneCandidate `json:"candidates"`
|
||||
}
|
||||
|
||||
type DataPlaneCandidate struct {
|
||||
Type string `json:"type"`
|
||||
URL string `json:"url"`
|
||||
WorkerID string `json:"worker_id,omitempty"`
|
||||
NodeID string `json:"node_id,omitempty"`
|
||||
ClusterID string `json:"cluster_id,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
messagecontracts "github.com/example/remote-access-platform/backend/pkg/contracts/message"
|
||||
)
|
||||
|
||||
type ControllerBinding struct {
|
||||
SessionID string `json:"session_id"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
UserID string `json:"user_id"`
|
||||
DeviceID string `json:"device_id"`
|
||||
TakeoverVersion int `json:"takeover_version"`
|
||||
BoundAt time.Time `json:"bound_at"`
|
||||
}
|
||||
|
||||
type AttachTokenClaims struct {
|
||||
Token string `json:"token"`
|
||||
SessionID string `json:"session_id"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
UserID string `json:"user_id"`
|
||||
DeviceID string `json:"device_id"`
|
||||
WorkerID string `json:"worker_id"`
|
||||
TakeoverVersion int `json:"takeover_version"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
Reconnectable bool `json:"reconnectable"`
|
||||
}
|
||||
|
||||
type TransportEnvelope struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
Payload map[string]any `json:"payload,omitempty"`
|
||||
Event *messagecontracts.Message `json:"event,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package session
|
||||
|
||||
import "time"
|
||||
|
||||
type State string
|
||||
|
||||
const (
|
||||
StateStarting State = "starting"
|
||||
StateActive State = "active"
|
||||
StateDetached State = "detached"
|
||||
StateReconnecting State = "reconnecting"
|
||||
StateTerminated State = "terminated"
|
||||
StateFailed State = "failed"
|
||||
)
|
||||
|
||||
type SessionDescriptor struct {
|
||||
ID string `json:"id"`
|
||||
ResourceID string `json:"resource_id"`
|
||||
WorkerID string `json:"worker_id"`
|
||||
State State `json:"state"`
|
||||
ControllerID string `json:"controller_id"`
|
||||
HeartbeatTTL time.Duration `json:"heartbeat_ttl"`
|
||||
DetachGraceTime time.Duration `json:"detach_grace_time"`
|
||||
}
|
||||
Reference in New Issue
Block a user