Documentation
¶
Index ¶
- func FormatDefinition(definition []string, count int) string
- func FormatStanzas(stanzas []Stanza, count int) string
- type ActivationParams
- type ActivationResult
- type AllowStanza
- type AutoStanza
- type IfaceStanza
- type Location
- type MappingStanza
- type NoAutoDownStanza
- type NoScriptsStanza
- type ParseError
- type SourceDirectoryStanza
- type SourceStanza
- type Stanza
- type WordExpander
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDefinition ¶
FormatDefinition formats the complete stanza, indenting any options with count leading spaces.
func FormatStanzas ¶
FormatStanzas returns a string representing all stanzas definitions, recursively expanding stanzas found in both source and source-directory definitions.
Types ¶
type ActivationParams ¶
type ActivationParams struct { Clock clock.Clock // map deviceName -> bridgeName Devices map[string]string DryRun bool Filename string ReconfigureDelay int Timeout time.Duration }
ActivationParams contains options to use when bridging interfaces
type ActivationResult ¶
ActivationResult captures the result of actively bridging the interfaces using ifup/ifdown.
func BridgeAndActivate ¶
func BridgeAndActivate(params ActivationParams) (*ActivationResult, error)
BridgeAndActivate will parse a debian-styled interfaces(5) file, change the stanza definitions of the requested devices to be bridged, then reconfigure the network using the ifupdown package for the new bridges.
type AllowStanza ¶
type AllowStanza struct { DeviceNames []string // contains filtered or unexported fields }
AllowStanza are lines beginning with the word 'allow-*'.
func (AllowStanza) Definition ¶
func (s AllowStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type AutoStanza ¶
type AutoStanza struct { DeviceNames []string // contains filtered or unexported fields }
AutoStanza are lines beginning with the word "auto".
func (AutoStanza) Definition ¶
func (s AutoStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type IfaceStanza ¶
type IfaceStanza struct { DeviceName string HasBondMasterOption bool HasBondOptions bool IsAlias bool IsBridged bool IsVLAN bool Options []string // contains filtered or unexported fields }
IfaceStanza are lines beginning with 'iface'.
func (IfaceStanza) Definition ¶
func (s IfaceStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type MappingStanza ¶
type MappingStanza struct { DeviceNames []string Options []string // contains filtered or unexported fields }
MappingStanza are lines beginning with the word "mapping".
func (MappingStanza) Definition ¶
func (s MappingStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type NoAutoDownStanza ¶
type NoAutoDownStanza struct { DeviceNames []string // contains filtered or unexported fields }
NoAutoDownStanza are lines beginning with "no-auto-down".
func (NoAutoDownStanza) Definition ¶
func (s NoAutoDownStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type NoScriptsStanza ¶
type NoScriptsStanza struct { DeviceNames []string // contains filtered or unexported fields }
NoScriptsStanza are lines beginning with "no-scripts".
func (NoScriptsStanza) Definition ¶
func (s NoScriptsStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type ParseError ¶
ParseError represents an error when parsing a line of a Debian-style interfaces definition. This only covers top-level definitions.
type SourceDirectoryStanza ¶
type SourceDirectoryStanza struct { Path string Sources []string Stanzas []Stanza // contains filtered or unexported fields }
SourceDirectoryStanza are lines beginning with "source-directory".
func (SourceDirectoryStanza) Definition ¶
func (s SourceDirectoryStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type SourceStanza ¶
type SourceStanza struct { Path string Sources []string Stanzas []Stanza // contains filtered or unexported fields }
SourceStanza are lines beginning with "source".
func (SourceStanza) Definition ¶
func (s SourceStanza) Definition() []string
Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.
type Stanza ¶
type Stanza interface { // A definition is the top-level stanza, together with any // options. Definition() []string // The file and linenumber, if any, where the stanza was // declared. Location() Location }
Stanza represents a network definition as described by interfaces(8).
func FlattenStanzas ¶
FlattenStanzas flattens all stanzas, and recursively for all 'source' and 'source-directory' stanzas, returning a single slice.
type WordExpander ¶
type WordExpander interface { // Expand pattern into a slice of words, or an error if the // underlying implementation failed. Expand(pattern string) ([]string, error) }
WordExpander performs word expansion like a posix-shell.