ask

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ask answers the protocol's password, question, cached-password and keystroke requests from what is typed: prompts queue and show one at a time, oldest first, every password typed is cached for the next disk, and every buffer that held a secret is zeroed once it is no longer needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asker

type Asker struct {
	// contains filtered or unexported fields
}

Asker is the queue of prompts, the text typed into the one showing, the cached passwords and the keystroke watches. It is not safe for concurrent use.

func (*Asker) Cached

func (a *Asker) Cached(r Replier) error

Cached answers r with every password typed so far, or NO_ANSWER when there is none.

func (*Asker) Close

func (a *Asker) Close() error

Close answers every prompt and watch still waiting NO_ANSWER and zeroes the text typed and every cached password, as the daemon quits.

func (*Asker) HangUp

func (a *Asker) HangUp(c Conn)

HangUp drops every prompt and watch of c, whose client is gone. A prompt showing closes and what was typed into it is zeroed.

func (*Asker) Ignore

func (a *Asker) Ignore(keys string) error

Ignore drops the watches for exactly keys, answering each NO_ANSWER.

func (*Asker) Key

func (a *Asker) Key(k key.Key) error

Key applies a key press: to the prompt showing, or else to the first watch it matches. Escape belongs to the boot messages and is ignored here.

func (*Asker) Password

func (a *Asker) Password(r Replier, c Conn, prompt string)

Password queues a password prompt answered by r.

func (*Asker) Prompt

func (a *Asker) Prompt() theme.Prompt

Prompt is what the splash shows of the prompt in front: its question and a bullet per character typed for a password, or the text for a question.

func (*Asker) Question

func (a *Asker) Question(r Replier, c Conn, prompt string)

Question queues a question, whose answer is echoed, answered by r.

func (*Asker) Watch

func (a *Asker) Watch(r Replier, c Conn, keys string)

Watch waits for one of keys, any key when keys is empty, while no prompt shows, and answers r with it.

type Conn

type Conn any

Conn identifies the connection a request came in on, so a hang-up drops every request of that connection.

type Replier

type Replier interface {
	Reply(r protocol.Response) error
}

Replier answers one request; *server.Call is one.

type Secret

type Secret []byte

Secret is bytes that must not be printed: every fmt verb shows it redacted.

func (Secret) Format

func (Secret) Format(f fmt.State, _ rune)

Format prints a redaction in place of the secret, whatever the verb.

func (Secret) GoString

func (Secret) GoString() string

GoString prints a redaction in place of the secret for %#v.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL