Documentation
¶
Overview ¶
Package control implements Astra Admin Control WebSocket protocol v1.
Index ¶
- Constants
- Variables
- type AuditFunc
- type Config
- type RevisionSource
- type Revisions
- type Server
- func (s *Server) Attach(revisions RevisionSource, audit AuditFunc)
- func (s *Server) AttachOperations(executor *operations.Executor)
- func (s *Server) CloseSession(sessionID string)
- func (s *Server) Discovery() map[string]any
- func (s *Server) Issue(ctx context.Context, authentication *auth.IdentityAuthentication) (*auth.IssuedControlTicket, error)
- func (s *Server) NotifyModules(revision uint64)
- func (s *Server) NotifyPluginChanged(name string)
- func (s *Server) NotifyUI(revision uint64)
- func (s *Server) NotifyUISourceChanged(provider, source, key string) error
- func (s *Server) PrepareSessionRevocation(sessionID string) *SessionRevocation
- func (s *Server) RegisterUISource(provider, source, requiredPermission string) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Shutdown(ctx context.Context) error
- type SessionRevocation
- type TicketService
Constants ¶
const ( ProtocolVersion = 1 CloseProtocol = 4400 CloseForbidden = 4403 )
Variables ¶
var ErrRateLimited = errors.New("control ticket rate limited")
Functions ¶
This section is empty.
Types ¶
type RevisionSource ¶
type RevisionSource func() Revisions
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Attach ¶
func (s *Server) Attach(revisions RevisionSource, audit AuditFunc)
func (*Server) AttachOperations ¶
func (s *Server) AttachOperations(executor *operations.Executor)
AttachOperations enables the explicitly negotiated Operations v1 extension. A nil executor leaves base Control v1 behavior unchanged.
func (*Server) CloseSession ¶
CloseSession is retained for trusted callers that already completed an authoritative revoke. New mutation paths should prepare before storage.
func (*Server) Issue ¶
func (s *Server) Issue(ctx context.Context, authentication *auth.IdentityAuthentication) (*auth.IssuedControlTicket, error)
func (*Server) NotifyModules ¶
func (*Server) NotifyPluginChanged ¶
NotifyPluginChanged tells authenticated clients to refetch plugin state.
func (*Server) NotifyUISourceChanged ¶
NotifyUISourceChanged publishes a server-authorized source invalidation.
func (*Server) PrepareSessionRevocation ¶
func (s *Server) PrepareSessionRevocation(sessionID string) *SessionRevocation
PrepareSessionRevocation marks a session before its authoritative storage mutation, preventing reconcile from independently auditing the same revoke.
func (*Server) RegisterUISource ¶
RegisterUISource installs the trusted audience for one declarative source. Registration is startup-only and becomes immutable on the first ServeHTTP.
type SessionRevocation ¶
type SessionRevocation struct {
// contains filtered or unexported fields
}
SessionRevocation is a single-use two-phase marker around an authoritative session revocation. Prepare must happen before storage mutation.
func (*SessionRevocation) Commit ¶
func (r *SessionRevocation) Commit()
Commit closes the exact marked session after durable revocation succeeds.
func (*SessionRevocation) Rollback ¶
func (r *SessionRevocation) Rollback()
Rollback removes this attempt's marker after durable revocation fails or is a no-op. Concurrent prepared/committed attempts retain their protection.
type TicketService ¶
type TicketService interface {
Issue(context.Context, *auth.IdentityAuthentication) (*auth.IssuedControlTicket, error)
Consume(context.Context, string) (*auth.IdentityAuthentication, error)
RevalidateSession(context.Context, string) (*auth.IdentityAuthentication, error)
}