Documentation
¶
Overview ¶
Package driver holds the per-vendor network-device CLI knowledge: how to classify a command (the structural read-only seal), how to disable paging, what the prompt looks like, and what error output looks like. One driver covers one vendor OS family; in-family version differences live in the pattern tables, not in new drivers (NETDEV_SPEC §4).
Index ¶
Constants ¶
const ShellMetachars = ";|&`$()<>\\"
ShellMetachars is the refusal set: pipe/command substitution/sequencing/ redirection/subshell syntax. Exec explains the rule when it fires.
Variables ¶
This section is empty.
Functions ¶
func IsShellMetacharDriver ¶
IsShellMetacharDriver reports whether a driver key runs a general shell and therefore rejects metacharacters in commands.
func Keys ¶
func Keys() []string
Keys lists registered driver keys (sorted; for error messages and UI).
func SetExtraRead ¶
SetExtraRead prefixes replaces the runtime read extensions for one driver. Prefixes are normalized (lowercased, whitespace-collapsed) and matched with the same word-boundary rule as the built-in tables.
Types ¶
type Class ¶
type Class int
Class is a command's safety classification. The exec tool refuses anything that is not Read — Write and Dangerous are proposal material (P4), Unknown defaults to the conservative Write handling per the spec's Appendix B-1.
type Driver ¶
type Driver interface {
// Key identifies the driver, e.g. "huawei-vrp", "cisco-ios".
Key() string
// Classify categorizes one CLI command line (first line, no newline).
Classify(cmd string) Class
// PagingOff returns the command(s) to run once at session start so long
// outputs are not interactively paged.
PagingOff() []string
// Prompt matches the device prompt as it appears at the end of output
// (user view, config view, etc.). The session engine anchors it to the
// final line.
Prompt() *regexp.Regexp
// Errors matches a single output line that indicates the command failed.
Errors() []*regexp.Regexp
}
Driver describes one vendor OS CLI.