netplan

package
v0.3.9-2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bond

type Bond struct {
	EthernetConfig
	Interfaces []string        `json:"interfaces"`
	Parameters IBondModeParams `json:"parameters"`
}

func NewBondMode0

func NewBondMode0(conf *EthernetConfig, interfaces []string) *Bond

func NewBondMode1

func NewBondMode1(conf *EthernetConfig, interfaces []string) *Bond

func NewBondMode4

func NewBondMode4(conf *EthernetConfig, interfaces []string) *Bond

func (*Bond) YAMLString

func (b *Bond) YAMLString() string

type BondMode

type BondMode string

type BondMode4Params

type BondMode4Params struct {
	*BondModeBaseParams
}

func NewBondMode4Params

func NewBondMode4Params() *BondMode4Params

type BondModeActiveBackupParams

type BondModeActiveBackupParams struct {
	*BondModeBaseParams

	Primary string `json:"primary"`
}

func NewBondModeActiveBackupParams

func NewBondModeActiveBackupParams(primary string) *BondModeActiveBackupParams

type BondModeBaseParams

type BondModeBaseParams struct {
	Mode               string `json:"mode"`
	MiiMonitorInterval int    `json:"mii-monitor-interval,omitzero"`
	GratuitiousArp     int    `json:"gratuitiousi-arp,omitzero"`
}

func NewBondMode0Params

func NewBondMode0Params() *BondModeBaseParams

func (BondModeBaseParams) GetMode

func (c BondModeBaseParams) GetMode() string

func (*BondModeBaseParams) SetGratutiousArp

func (c *BondModeBaseParams) SetGratutiousArp(g int)

func (*BondModeBaseParams) SetMiiMonitorInterval

func (c *BondModeBaseParams) SetMiiMonitorInterval(i int)

type Configuration

type Configuration struct {
	Network *Network `json:"network"`
}

Configuration examples reference from https://netplan.io/examples/ manpage: http://manpages.ubuntu.com/manpages/cosmic/man5/netplan.5.html

func NewConfiguration

func NewConfiguration(network *Network) *Configuration

func (*Configuration) YAMLString

func (c *Configuration) YAMLString() string

type EthernetConfig

type EthernetConfig struct {
	DHCP4       bool                 `json:"dhcp4"`
	Addresses   []string             `json:"addresses"`
	Match       *EthernetConfigMatch `json:"match"`
	MacAddress  string               `json:"macaddress"`
	Gateway4    string               `json:"gateway4"`
	Routes      []*Route             `json:"routes"`
	Nameservers *Nameservers         `json:"nameservers"`
	Mtu         int                  `json:"mtu,omitzero"`
}

func NewDHCP4EthernetConfig

func NewDHCP4EthernetConfig() *EthernetConfig

func NewStaticEthernetConfig

func NewStaticEthernetConfig(
	addr string,
	gateway string,
	search []string,
	nameservers []string,
	routes []*Route,
) *EthernetConfig

func (*EthernetConfig) YAMLString

func (c *EthernetConfig) YAMLString() string

type EthernetConfigMatch

type EthernetConfigMatch struct {
	MacAddress string `json:"macaddress"`
}

func NewEthernetConfigMatchMac

func NewEthernetConfigMatchMac(macAddr string) *EthernetConfigMatch

type IBondModeParams

type IBondModeParams interface {
	GetMode() string
}

type Nameservers

type Nameservers struct {
	Search    []string `json:"search"`
	Addresses []string `json:"addresses"`
}

type Network

type Network struct {
	Version   uint                       `json:"version"`
	Renderer  NetworkRenderer            `json:"renderer"`
	Ethernets map[string]*EthernetConfig `json:"ethernets"`
	Bonds     map[string]*Bond           `json:"bonds"`
}

func NewNetwork

func NewNetwork() *Network

func (*Network) AddBond

func (n *Network) AddBond(name string, bond *Bond) *Network

func (*Network) AddEthernet

func (n *Network) AddEthernet(name string, ether *EthernetConfig) *Network

func (*Network) YAMLString

func (n *Network) YAMLString() string

type NetworkRenderer

type NetworkRenderer string
const (
	VERSION2                                = 2
	NetworkRendererNetworkd NetworkRenderer = "networkd"
)

type Route

type Route struct {
	To     string `json:"to"`
	Via    string `json:"via"`
	Metric uint   `json:"metric"`
}

Jump to

Keyboard shortcuts

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