Initial project snapshot
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package message
|
||||
|
||||
type Message struct {
|
||||
Code string `json:"code"`
|
||||
MessageKey string `json:"message_key"`
|
||||
FallbackMessage string `json:"fallback_message"`
|
||||
Details map[string]any `json:"details,omitempty"`
|
||||
TraceID string `json:"trace_id,omitempty"`
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package worker
|
||||
|
||||
import "time"
|
||||
|
||||
type Protocol string
|
||||
|
||||
const (
|
||||
ProtocolRDP Protocol = "rdp"
|
||||
)
|
||||
|
||||
type Status string
|
||||
|
||||
const (
|
||||
StatusOnline Status = "online"
|
||||
StatusDraining Status = "draining"
|
||||
StatusOffline Status = "offline"
|
||||
)
|
||||
|
||||
type AttachRequest struct {
|
||||
ResourceID string `json:"resource_id"`
|
||||
ActorID string `json:"actor_id"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
RequiredCapabilities []string `json:"required_capabilities,omitempty"`
|
||||
RenderQualityProfile string `json:"render_quality_profile,omitempty"`
|
||||
}
|
||||
|
||||
type WorkerLease struct {
|
||||
LeaseID string `json:"lease_id"`
|
||||
WorkerID string `json:"worker_id"`
|
||||
Protocol Protocol `json:"protocol"`
|
||||
ResourceID string `json:"resource_id"`
|
||||
SessionID string `json:"session_id"`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
ControlStream string `json:"control_stream"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
RenderQualityProfile string `json:"render_quality_profile,omitempty"`
|
||||
}
|
||||
|
||||
type WorkerRegistration struct {
|
||||
WorkerID string `json:"worker_id"`
|
||||
Protocol Protocol `json:"protocol"`
|
||||
Status Status `json:"status"`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
ControlStream string `json:"control_stream"`
|
||||
LastHeartbeatAt time.Time `json:"last_heartbeat_at"`
|
||||
}
|
||||
|
||||
type WorkerHeartbeat struct {
|
||||
WorkerID string `json:"worker_id"`
|
||||
Status Status `json:"status"`
|
||||
LastHeartbeatAt time.Time `json:"last_heartbeat_at"`
|
||||
}
|
||||
|
||||
type RoutedEnvelope struct {
|
||||
SessionID string `json:"session_id"`
|
||||
AttachmentID string `json:"attachment_id"`
|
||||
Type string `json:"type"`
|
||||
Payload map[string]any `json:"payload"`
|
||||
}
|
||||
Reference in New Issue
Block a user