Documentation
¶
Index ¶
Constants ¶
const ( AttachProtocol = "ptyd-attach" FrameOutput = 'o' FrameSnapshot = 's' FrameInput = 'i' FrameResize = 'r' )
The attach protocol. A client sends GET /terminals/{id}/attach with "Connection: Upgrade" and "Upgrade: ptyd-attach" (plus the token header), and optionally ?cols=&rows= (its window size) and ?readonly=1. The server answers 101 Switching Protocols (with "X-Ptyd-Readonly: 1" for a read-only attachment, such as a ghost) and the connection carries:
- server to client: raw terminal output, starting with a repaint of the screen and its scrollback. EOF means the terminal's output ended.
- client to server: frames of one type byte, a 4-byte big-endian length and a payload. FrameInput carries keystrokes; FrameResize carries cols and rows as two big-endian uint16s.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Native NativeService // optional; defaults to the local native CLIs
Addr string // host:port to listen on
Token string // if non-empty, required as X-Ptyd-Token on every request
}
Config holds server-level options.
type NativeService ¶ added in v0.5.0
type NativeService interface {
native.Discovery
terminal.NativeLookup
}
NativeService provides discovery and fresh import authority.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP API for ptyd.
func (*Server) Handler ¶
Handler exposes the wrapped http.Handler (with middleware applied) so tests can drive routes via httptest without binding a real port.
func (*Server) Listen ¶
Listen binds the configured address. Separating this from Serve lets the caller surface bind errors synchronously before logging "listening on …".