type EscapeError … func (EscapeError) Error() string { … } type escapeProxy … // NewEscapeProxy returns a new TTY proxy reader which wraps the given reader // and detects when the specified escape keys are read, in which case the Read // method will return an error of type EscapeError. func NewEscapeProxy(r io.Reader, escapeKeys []byte) io.Reader { … } func (r *escapeProxy) Read(buf []byte) (n int, err error) { … }