Documentation
¶
Overview ¶
Package host connects the terminal to a Greenscreen application. The application's screens come from its API (see docs/protocol.md): this package sends each AID key with the screen's input and draws the screen that comes back. Only the logon screen, which signs in through Cloudflare Access, is drawn locally.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
Host() string
Logon(ctx context.Context) (string, error)
Logoff(ctx context.Context) error
Screen(ctx context.Context, req api.ScreenRequest) (api.ScreenResponse, error)
}
Backend is the API the session talks to. *api.Client implements it.
type Config ¶
type Config struct {
SystemName string // e.g. "SYS1"
Title string // the application's name on the logon screen, e.g. "POINT OF SALE"
Tagline string // shown there instead of the title, if set
Prefix string // starts the terminal's own message IDs, e.g. "POS"; default "GSC"
Banner []string
Backend Backend
DownloadDir string // where files sent with a screen are saved
Live bool // the application serves GET /v1/live
Snapshots bool // the application serves POST /v1/snapshot
HaveInfo bool // the above came from the application (SetInfo)
}
type Downloader ¶ added in v0.2.0
Downloader is a Backend that can fetch the files screens send along, such as an invoice PDF. *api.Client implements it.
type Informer ¶ added in v0.2.1
Informer is a Backend that can say what the application calls itself and what it serves: GET /v1/screen/info. *api.Client implements it.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the terminal's connection to the application. It implements tn3270.Host.
func NewSession ¶
func (*Session) Pushes ¶ added in v0.2.0
func (s *Session) Pushes() <-chan struct{}
Pushes implements tn3270.Pusher: a value comes when the host has said the screen should be redrawn.
func (*Session) Redraw ¶
Redraw asks the application for the current screen at the terminal's new size. It returns nil, keeping the old layout, if that fails.
type SnapshotTaker ¶ added in v0.2.0
type SnapshotTaker interface {
Snapshot(ctx context.Context, req api.SnapshotRequest) ([]byte, string, error)
}
SnapshotTaker is a Backend that can draw a screen as a picture. *api.Client implements it.