Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertKeys(s string) [][]byte
- func MakeClientConfig(username string, auth []ssh.AuthMethod) *ssh.ClientConfig
- func PasswordKey(username, password string) *ssh.ClientConfig
- func PrivateKey(username, path string) (*ssh.ClientConfig, error)
- func PrivateKeyPassphrase(username, passphrase, path string) (*ssh.ClientConfig, error)
- type Connect
- type TryReader
Constants ¶
const ( KeyCtrlA = 1 + iota KeyCtrlB KeyCtrlC KeyCtrlD KeyCtrlE KeyCtrlF KeyCtrlG KeyCtrlH KeyCtrlI KeyCtrlJ KeyCtrlK KeyCtrlL KeyCtrlM KeyCtrlN KeyCtrlO KeyCtrlP KeyCtrlQ KeyCtrlR KeyCtrlS KeyCtrlT KeyCtrlU KeyCtrlV KeyCtrlW KeyCtrlX KeyCtrlY KeyCtrlZ KeyEscape KeyLeftBracket = '[' KeyRightBracket = ']' KeyEnter = '\n' KeyBackspace = 127 KeyUnknown = 0xd800 + iota KeyUp KeyDown KeyLeft KeyRight KeyHome KeyEnd KeyPasteStart KeyPasteEnd KeyInsert KeyDelete KeyPgUp KeyPgDn KeyPause KeyF1 KeyF2 KeyF3 KeyF4 KeyF5 KeyF6 KeyF7 KeyF8 KeyF9 KeyF10 KeyF11 KeyF12 )
Giant list of key constants. Everything above KeyUnknown matches an actual ASCII key value. After that, we have various pseudo-keys in order to represent complex byte sequences that correspond to keys like Page up, Right arrow, etc.
Variables ¶
var KeyText = map[string]rune{ "c-a": KeyCtrlA, "c-b": KeyCtrlB, "c-c": KeyCtrlC, "c-d": KeyCtrlD, "c-e": KeyCtrlE, "c-f": KeyCtrlF, "c-g": KeyCtrlG, "c-h": KeyCtrlH, "c-i": KeyCtrlI, "c-j": KeyCtrlJ, "c-k": KeyCtrlK, "c-l": KeyCtrlL, "c-m": KeyCtrlM, "c-n": KeyCtrlN, "c-o": KeyCtrlO, "c-p": KeyCtrlP, "c-q": KeyCtrlQ, "c-r": KeyCtrlR, "c-s": KeyCtrlS, "c-t": KeyCtrlT, "c-u": KeyCtrlU, "c-v": KeyCtrlV, "c-w": KeyCtrlW, "c-x": KeyCtrlX, "c-y": KeyCtrlY, "c-z": KeyCtrlZ, "CtrlA": KeyCtrlA, "CtrlB": KeyCtrlB, "CtrlC": KeyCtrlC, "CtrlD": KeyCtrlD, "CtrlE": KeyCtrlE, "CtrlF": KeyCtrlF, "CtrlG": KeyCtrlG, "CtrlH": KeyCtrlH, "CtrlI": KeyCtrlI, "CtrlJ": KeyCtrlJ, "CtrlK": KeyCtrlK, "CtrlL": KeyCtrlL, "CtrlM": KeyCtrlM, "CtrlN": KeyCtrlN, "CtrlO": KeyCtrlO, "CtrlP": KeyCtrlP, "CtrlQ": KeyCtrlQ, "CtrlR": KeyCtrlR, "CtrlS": KeyCtrlS, "CtrlT": KeyCtrlT, "CtrlU": KeyCtrlU, "CtrlV": KeyCtrlV, "CtrlW": KeyCtrlW, "CtrlX": KeyCtrlX, "CtrlY": KeyCtrlY, "CtrlZ": KeyCtrlZ, "Escape": KeyEscape, "LeftBracket": KeyLeftBracket, "RightBracket": KeyRightBracket, "Enter": KeyEnter, "N": KeyEnter, "Backspace": KeyBackspace, "Up": KeyUp, "Down": KeyDown, "Left": KeyLeft, "Right": KeyRight, "Home": KeyHome, "End": KeyEnd, "PasteStart": KeyPasteStart, "PasteEnd": KeyPasteEnd, "Insert": KeyInsert, "Del": KeyDelete, "PgUp": KeyPgUp, "PgDn": KeyPgDn, "Pause": KeyPause, "F1": KeyF1, "F2": KeyF2, "F3": KeyF3, "F4": KeyF4, "F5": KeyF5, "F6": KeyF6, "F7": KeyF7, "F8": KeyF8, "F9": KeyF9, "F10": KeyF10, "F11": KeyF11, "F12": KeyF12, }
KeyText keeps mapping a string representation to keys. https://github.com/jesseduffield/lazygit/blob/master/pkg/gui/keybindings.go https://github.com/Nerdmaster/terminal/blob/master/key_constants.go https://github.com/gdamore/tcell/blob/master/key.go
Functions ¶
func ConvertKeys ¶
func MakeClientConfig ¶
func MakeClientConfig(username string, auth []ssh.AuthMethod) *ssh.ClientConfig
MakeClientConfig makes a new ssh.ClientConfig.
func PasswordKey ¶
func PasswordKey(username, password string) *ssh.ClientConfig
PasswordKey returns the ssh.ClientConfig based on specified username and password.
func PrivateKey ¶
func PrivateKey(username, path string) (*ssh.ClientConfig, error)
PrivateKey loads a public key from "path" and returns a SSH ClientConfig to authenticate with the server.
func PrivateKeyPassphrase ¶
func PrivateKeyPassphrase(username, passphrase, path string) (*ssh.ClientConfig, error)
PrivateKeyPassphrase returns the ssh.ClientConfig based on specified username, passphrase and path.
Types ¶
type Connect ¶
Connect structure to store contents about ssh connection.
func (*Connect) CreateClient ¶
func (c *Connect) CreateClient(addr string, cc *ssh.ClientConfig) error
CreateClient connects to the remote SSH server, returns error if it couldn't establish a session to the SSH server.