juju: github.com/juju/juju/network/debinterfaces Index | Files

package debinterfaces

import "github.com/juju/juju/network/debinterfaces"

Index

Package Files

activate.go bridge.go format.go parser.go scanner.go stanza.go wordexp.go

func FormatDefinition Uses

func FormatDefinition(definition []string, count int) string

FormatDefinition formats the complete stanza, indenting any options with count leading spaces.

func FormatStanzas Uses

func FormatStanzas(stanzas []Stanza, count int) string

FormatStanzas returns a string representing all stanzas definitions, recursively expanding stanzas found in both source and source-directory definitions.

type ActivationParams Uses

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 Uses

type ActivationResult struct {
    Stdout []byte
    Stderr []byte
    Code   int
}

ActivationResult captures the result of actively bridging the interfaces using ifup/ifdown.

func BridgeAndActivate Uses

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 Uses

type AllowStanza struct {
    DeviceNames []string
    // contains filtered or unexported fields
}

AllowStanza are lines beginning with the word 'allow-*'.

func (AllowStanza) Definition Uses

func (s AllowStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (AllowStanza) Location Uses

func (s AllowStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type AutoStanza Uses

type AutoStanza struct {
    DeviceNames []string
    // contains filtered or unexported fields
}

AutoStanza are lines beginning with the word "auto".

func (AutoStanza) Definition Uses

func (s AutoStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (AutoStanza) Location Uses

func (s AutoStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type IfaceStanza Uses

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 Uses

func (s IfaceStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (IfaceStanza) Location Uses

func (s IfaceStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type Location Uses

type Location struct {
    Filename string
    LineNum  int
}

Location represents source file and line number information

type MappingStanza Uses

type MappingStanza struct {
    DeviceNames []string
    Options     []string
    // contains filtered or unexported fields
}

MappingStanza are lines beginning with the word "mapping".

func (MappingStanza) Definition Uses

func (s MappingStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (MappingStanza) Location Uses

func (s MappingStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type NoAutoDownStanza Uses

type NoAutoDownStanza struct {
    DeviceNames []string
    // contains filtered or unexported fields
}

NoAutoDownStanza are lines beginning with "no-auto-down".

func (NoAutoDownStanza) Definition Uses

func (s NoAutoDownStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (NoAutoDownStanza) Location Uses

func (s NoAutoDownStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type NoScriptsStanza Uses

type NoScriptsStanza struct {
    DeviceNames []string
    // contains filtered or unexported fields
}

NoScriptsStanza are lines beginning with "no-scripts".

func (NoScriptsStanza) Definition Uses

func (s NoScriptsStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (NoScriptsStanza) Location Uses

func (s NoScriptsStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type ParseError Uses

type ParseError struct {
    Filename string
    Line     string
    LineNum  int
    Message  string
}

ParseError represents an error when parsing a line of a Debian-style interfaces definition. This only covers top-level definitions.

func (*ParseError) Error Uses

func (p *ParseError) Error() string

Error returns the parsing error.

type SourceDirectoryStanza Uses

type SourceDirectoryStanza struct {
    Path    string
    Sources []string
    Stanzas []Stanza
    // contains filtered or unexported fields
}

SourceDirectoryStanza are lines beginning with "source-directory".

func (SourceDirectoryStanza) Definition Uses

func (s SourceDirectoryStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (SourceDirectoryStanza) Location Uses

func (s SourceDirectoryStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type SourceStanza Uses

type SourceStanza struct {
    Path    string
    Sources []string
    Stanzas []Stanza
    // contains filtered or unexported fields
}

SourceStanza are lines beginning with "source".

func (SourceStanza) Definition Uses

func (s SourceStanza) Definition() []string

Definition returns all the lines that define the stanza. The individual lines are trimmed of leading and trailing whitespace.

func (SourceStanza) Location Uses

func (s SourceStanza) Location() Location

Location returns the filename and line number of the first line of the definition, if any.

type Stanza Uses

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 Bridge Uses

func Bridge(stanzas []Stanza, devices map[string]string) []Stanza

Bridge turns existing devices into bridged devices.

func FlattenStanzas Uses

func FlattenStanzas(stanzas []Stanza) []Stanza

FlattenStanzas flattens all stanzas, and recursively for all 'source' and 'source-directory' stanzas, returning a single slice.

func Parse Uses

func Parse(filename string) ([]Stanza, error)

Parse parses the definitions of a single Debian style network interfaces(5) file and returns the corresponding set of stanza definitions.

type WordExpander Uses

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.

Package debinterfaces imports 16 packages (graph) and is imported by 6 packages. Updated 2018-10-03. Refresh now. Tools for package owners.