Documentation
¶
Overview ¶
Package remotedesktops manages Bektinet hosts: their saved Mac passwords, encrypted like Wi-Fi passwords, sessions that exchange a password for a single-use stream ticket, and the WebSocket relay that carries a browser's stream without decoding it.
Index ¶
- Constants
- Variables
- func NormalizeFingerprint(value string) (string, error)
- type ErrUnavailable
- type PGXTransactor
- type Querier
- type Service
- func (s *Service) Create(ctx context.Context, actor db.User, input api.RemoteDesktopWrite) (db.RemoteDesktop, error)
- func (s *Service) Delete(ctx context.Context, actor db.User, id uuid.UUID) error
- func (s *Service) DialRelay(ctx context.Context, id uuid.UUID, token string) (*websocket.Conn, error)
- func (s *Service) List(ctx context.Context) ([]db.RemoteDesktop, error)
- func (s *Service) Relay(ctx context.Context, browser, host *websocket.Conn)
- func (s *Service) StartSession(ctx context.Context, actor db.User, id uuid.UUID) (Session, error)
- func (s *Service) Update(ctx context.Context, actor db.User, id uuid.UUID, patch api.RemoteDesktopPatch) (db.RemoteDesktop, error)
- type Session
- type Transactor
- type ValidationError
Constants ¶
const ( DefaultPort = 3390 // Matches the host's ticket lifetime. SessionLifetime = 30 * time.Second )
Variables ¶
var ( ErrNotFound = errors.New("remote desktop not found") ErrConflict = errors.New("remote desktop conflict") ErrKeyMissing = errors.New("remote desktop password encryption is not configured") ErrTransactorMissing = errors.New("remote desktop transactor not configured") ErrRelayToken = errors.New("invalid relay token") )
Functions ¶
func NormalizeFingerprint ¶
NormalizeFingerprint accepts 32 hex bytes with or without separators and returns the lowercase colon-separated form that Bektinet shows.
Types ¶
type ErrUnavailable ¶
ErrUnavailable wraps every reason a host could not be used: unreachable, wrong certificate, or a refused sign-in. Its message is safe to show to administrators.
func (ErrUnavailable) Error ¶
func (e ErrUnavailable) Error() string
type PGXTransactor ¶
type PGXTransactor struct {
// contains filtered or unexported fields
}
func NewPGXTransactor ¶
func NewPGXTransactor(pool *pgxpool.Pool) *PGXTransactor
type Querier ¶
type Querier interface {
ListRemoteDesktops(ctx context.Context) ([]db.RemoteDesktop, error)
GetRemoteDesktopByID(ctx context.Context, arg db.GetRemoteDesktopByIDParams) (db.RemoteDesktop, error)
CreateRemoteDesktop(ctx context.Context, arg db.CreateRemoteDesktopParams) (db.RemoteDesktop, error)
UpdateRemoteDesktop(ctx context.Context, arg db.UpdateRemoteDesktopParams) (db.RemoteDesktop, error)
DeleteRemoteDesktop(ctx context.Context, arg db.DeleteRemoteDesktopParams) error
CreateAuditLog(ctx context.Context, arg db.CreateAuditLogParams) (db.AuditLog, error)
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(queries Querier, tx Transactor, passwordKey []byte, relaySecret []byte, issuer string) (*Service, error)
NewService takes the password key (nil or empty when not configured) and the secret that signs relay tokens.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, actor db.User, input api.RemoteDesktopWrite) (db.RemoteDesktop, error)
func (*Service) DialRelay ¶
func (s *Service) DialRelay(ctx context.Context, id uuid.UUID, token string) (*websocket.Conn, error)
DialRelay checks a relay token for this host and connects to the host, ready for Relay.
func (*Service) Relay ¶
Relay carries messages between the browser and the host until either side closes.
func (*Service) StartSession ¶
StartSession signs in to the host with its saved password and returns a stream ticket.
type Session ¶
Session is what a browser needs to open a stream: the host's ticket, and a relay token that lets it open the relay for this host for a short time.
type Transactor ¶
type ValidationError ¶
type ValidationError struct{ Message string }
func (ValidationError) Error ¶
func (e ValidationError) Error() string