Documentation
¶
Index ¶
- Constants
- type ConnectedSessionRecord
- type CreateTokenRecord
- type Daemon
- type DisconnectedSessionRecord
- type ExpiredSession
- type HeartbeatRecord
- type MachineRecord
- type RegisteredSession
- type Repository
- type Service
- func (s *Service) Authenticate(ctx context.Context, rawToken string) (domain.Claims, error)
- func (s *Service) IssueToken(ctx context.Context, input domain.IssueInput) (domain.IssuedToken, error)
- func (s *Service) RecordConnectedSession(ctx context.Context, input ConnectedSessionRecord) (MachineRecord, error)
- func (s *Service) RecordDisconnectedSession(ctx context.Context, input DisconnectedSessionRecord) (MachineRecord, error)
- func (s *Service) RecordHeartbeat(ctx context.Context, input HeartbeatRecord) (MachineRecord, error)
- func (s *Service) RevokeToken(ctx context.Context, machineID uuid.UUID, tokenID uuid.UUID) error
- type SessionCloser
- type SessionRegistry
- func (r *SessionRegistry) CloseAll(reason string) []RegisteredSession
- func (r *SessionRegistry) Count() int
- func (r *SessionRegistry) Expire(now time.Time) []ExpiredSession
- func (r *SessionRegistry) Heartbeat(sessionID string, heartbeatAt time.Time) (RegisteredSession, bool)
- func (r *SessionRegistry) Register(machineID uuid.UUID, sessionID string, connectedAt time.Time, ...) (RegisteredSession, *RegisteredSession)
- func (r *SessionRegistry) Remove(sessionID string) (RegisteredSession, bool)
- func (r *SessionRegistry) Snapshot(machineID uuid.UUID) (RegisteredSession, bool)
- type TokenRecord
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectedSessionRecord ¶
type ConnectedSessionRecord struct {
MachineID uuid.UUID
SessionID string
ConnectedAt time.Time
SystemInfo domain.SystemInfo
ToolInventory []domain.ToolInfo
ResourceSnapshot *domain.ResourceSnapshot
WebsocketHealth *domain.WebsocketHealth
}
type CreateTokenRecord ¶
type ExpiredSession ¶
type HeartbeatRecord ¶
type HeartbeatRecord struct {
MachineID uuid.UUID
SessionID string
HeartbeatAt time.Time
SystemInfo *domain.SystemInfo
ToolInventory []domain.ToolInfo
ResourceSnapshot *domain.ResourceSnapshot
WebsocketHealth *domain.WebsocketHealth
}
type MachineRecord ¶
type RegisteredSession ¶
type Repository ¶
type Repository interface {
GetMachine(ctx context.Context, machineID uuid.UUID) (MachineRecord, error)
IssueToken(ctx context.Context, input CreateTokenRecord) (TokenRecord, error)
TokenByHash(ctx context.Context, tokenHash string) (TokenRecord, error)
TouchTokenLastUsed(ctx context.Context, tokenID uuid.UUID, usedAt time.Time) error
RevokeToken(ctx context.Context, machineID uuid.UUID, tokenID uuid.UUID, revokedAt time.Time) error
RecordConnectedSession(ctx context.Context, input ConnectedSessionRecord) (MachineRecord, error)
RecordHeartbeat(ctx context.Context, input HeartbeatRecord) (MachineRecord, error)
RecordDisconnectedSession(ctx context.Context, input DisconnectedSessionRecord) (MachineRecord, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository) *Service
func (*Service) Authenticate ¶
func (*Service) IssueToken ¶
func (s *Service) IssueToken(ctx context.Context, input domain.IssueInput) (domain.IssuedToken, error)
func (*Service) RecordConnectedSession ¶
func (s *Service) RecordConnectedSession(ctx context.Context, input ConnectedSessionRecord) (MachineRecord, error)
func (*Service) RecordDisconnectedSession ¶
func (s *Service) RecordDisconnectedSession(ctx context.Context, input DisconnectedSessionRecord) (MachineRecord, error)
func (*Service) RecordHeartbeat ¶
func (s *Service) RecordHeartbeat(ctx context.Context, input HeartbeatRecord) (MachineRecord, error)
type SessionCloser ¶
type SessionRegistry ¶
type SessionRegistry struct {
// contains filtered or unexported fields
}
func NewSessionRegistry ¶
func NewSessionRegistry(timeout time.Duration) *SessionRegistry
func (*SessionRegistry) CloseAll ¶
func (r *SessionRegistry) CloseAll(reason string) []RegisteredSession
func (*SessionRegistry) Count ¶
func (r *SessionRegistry) Count() int
func (*SessionRegistry) Expire ¶
func (r *SessionRegistry) Expire(now time.Time) []ExpiredSession
func (*SessionRegistry) Heartbeat ¶
func (r *SessionRegistry) Heartbeat(sessionID string, heartbeatAt time.Time) (RegisteredSession, bool)
func (*SessionRegistry) Register ¶
func (r *SessionRegistry) Register(machineID uuid.UUID, sessionID string, connectedAt time.Time, closer SessionCloser) (RegisteredSession, *RegisteredSession)
func (*SessionRegistry) Remove ¶
func (r *SessionRegistry) Remove(sessionID string) (RegisteredSession, bool)
func (*SessionRegistry) Snapshot ¶
func (r *SessionRegistry) Snapshot(machineID uuid.UUID) (RegisteredSession, bool)
Click to show internal directories.
Click to hide internal directories.