Documentation
¶
Overview ¶
Package computer adds authenticated transports to the existing workspace API. The relay sees an SSH ciphertext stream, never daemon HTTP or terminal content.
Index ¶
- Constants
- func ControlPatterns() []string
- func Lock(directory string) (func(), error)
- type ConnectionMetadata
- type Device
- type Forward
- type ForwardRequest
- type Invitation
- type Offer
- type PairRequest
- type PeerBridge
- type PeerDirectoryReader
- type PeerDirectorySource
- type PeerDiscoveryGrant
- type Route
- type Server
- func (s *Server) BotPeerDiscoveryChanged()
- func (s *Server) BotPeerIdentity() (fingerprint string, routes []Route)
- func (s *Server) BotPeerRecovery(publicKey string) (*PeerDiscoveryGrant, error)
- func (s *Server) Close()
- func (s *Server) Decide(id, requestID string, approve bool, replaceDeviceIDs ...string) (Device, error)
- func (s *Server) Fingerprint() string
- func (s *Server) ForceUpdatePending() bool
- func (s *Server) Handle(raw net.Conn)
- func (s *Server) Info() map[string]any
- func (s *Server) Invite(routes []Route) (Invitation, error)
- func (s *Server) PairHandler(offerID string) http.Handler
- func (s *Server) PendingActivity() int
- func (s *Server) Register(mux *http.ServeMux, guards ...func(http.HandlerFunc) http.HandlerFunc)
- func (s *Server) Request(offerID string, req PairRequest) (*Offer, error)
- func (s *Server) Revoke(id string) error
- func (s *Server) SetBotPeerBridge(bridge PeerBridge)
- func (s *Server) SetDesktopViewer(port int, authorize func(string) error, ...)
- func (s *Server) Start(sshAddress, websocketAddress, directory string) error
- func (s *Server) WebSocket(w http.ResponseWriter, r *http.Request)
- type Update
Constants ¶
const APIPort = 8790
const PairingPort = 8793
const PairingVersion = 3
const Version = 1
Variables ¶
This section is empty.
Functions ¶
func ControlPatterns ¶
func ControlPatterns() []string
ControlPatterns is generated from the actual registration for OpenAPI parity.
Types ¶
type ConnectionMetadata ¶
type ConnectionMetadata struct {
Provider string `json:"provider"`
Address string `json:"address"`
}
ConnectionMetadata is descriptive only. Provider credentials never cross the daemon API; phones still authenticate and pin the SSH identity for every route.
type Forward ¶
type Forward struct {
ForwardRequest
ExpiresAt time.Time `json:"expiresAt"`
}
type ForwardRequest ¶
type ForwardRequest struct {
ID string `json:"id"`
DeviceID string `json:"deviceId"`
Port int `json:"port"`
DesktopSessionID string `json:"desktopSessionId,omitempty"`
}
Port forwards are explicit, short-lived grants to an approved device. They never bind a public listener or grant access to other machines on the network.
type Invitation ¶
type PairRequest ¶
type PeerBridge ¶
type PeerBridge interface {
PeerAuthorize(user string, key ssh.PublicKey) (string, bool)
ServePeerChannel(id string, incoming ssh.NewChannel)
}
PeerBridge grants a daemon a bot-only channel. It never grants the phone's workspace API, pairing credentials, shell or port-forwarding capabilities. The bot service owns key enrollment, scope checks and revocation.
type PeerDirectoryReader ¶
type PeerDirectorySource ¶
type PeerDirectorySource interface {
PeerDirectoryReaders() []PeerDirectoryReader
}
PeerDirectorySource supplies separately enrolled bot peers with read access to encrypted address records. These readers are never computer Devices and gain no workspace API, shell, pairing or port-forwarding authorization. Callers must not hold the peer registry lock while calling back into Server.
type PeerDiscoveryGrant ¶
type PeerDiscoveryGrant struct {
Version int `json:"version"`
URL string `json:"url"`
DirectoryID string `json:"directoryId"`
ComputerID string `json:"computerId"`
RegistryID string `json:"registryId"`
DeviceID string `json:"deviceId"`
Sequence uint64 `json:"sequence"`
Secret string `json:"secret"`
HostKeyFingerprint string `json:"hostKeyFingerprint"`
}
PeerDiscoveryGrant is private recovery material for an enrolled daemon. It travels only inside the authenticated peer channel, never public descriptors, owner-facing discovery responses, prompts or model-visible tool results.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) BotPeerDiscoveryChanged ¶
func (s *Server) BotPeerDiscoveryChanged()
BotPeerDiscoveryChanged refreshes only encrypted directory reader grants. The bridge calls this after committing enrollment/revocation and releasing its own lock so publisher snapshots cannot invert the two lock orders.
func (*Server) BotPeerIdentity ¶
BotPeerIdentity returns the existing pinned computer identity and a detached route snapshot. Reading it neither changes saved phone approvals nor opens a listener. Route changes remain owned by the normal computer connection flow.
func (*Server) BotPeerRecovery ¶
func (s *Server) BotPeerRecovery(publicKey string) (*PeerDiscoveryGrant, error)
func (*Server) Fingerprint ¶
func (*Server) ForceUpdatePending ¶
Only this accepted, still-active request may bypass idle admission. The normal exclusive lease still prevents two controllers/installers replacing a service.
func (*Server) PendingActivity ¶
Active invitations reserve the service until expiry, including a lost approval acknowledgement. An idle update must not invalidate a QR halfway through pairing.
func (*Server) Register ¶
func (s *Server) Register(mux *http.ServeMux, guards ...func(http.HandlerFunc) http.HandlerFunc)
func (*Server) SetBotPeerBridge ¶
func (s *Server) SetBotPeerBridge(bridge PeerBridge)
func (*Server) SetDesktopViewer ¶
func (s *Server) SetDesktopViewer(port int, authorize func(string) error, viewer func(context.Context, string, io.ReadWriteCloser) error)
Desktop uses a virtual direct-tcpip destination on the existing SSH server. The surface service owns authentication, session lifetime and input control.