ipcmd

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ipcmd provides a wrapper around the "ip" command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(execer exec.Interface, link string) *Transaction

NewTransaction begins a new transaction for a given interface. If an error occurs at any step in the transaction, it will be recorded until EndTransaction(), and any further calls on the transaction will be ignored.

func (*Transaction) AddAddress

func (tx *Transaction) AddAddress(cidr string, args ...string)

AddAddress adds an address to the interface.

func (tx *Transaction) AddLink(args ...string)

AddLink creates the interface associated with the transaction, optionally with additional properties.

func (*Transaction) AddRoute

func (tx *Transaction) AddRoute(cidr string, args ...string)

AddRoute adds a route to the interface.

func (*Transaction) AddSlave

func (tx *Transaction) AddSlave(slave string)

AddSlave adds the indicated slave interface to the bridge, bond, or team interface associated with the transaction.

func (*Transaction) DeleteAddress

func (tx *Transaction) DeleteAddress(cidr string, args ...string)

DeleteAddress deletes an address from the interface. (It is an error if the address does not exist.)

func (tx *Transaction) DeleteLink()

DeleteLink deletes the interface associated with the transaction. (It is an error if the interface does not exist.)

func (*Transaction) DeleteRoute

func (tx *Transaction) DeleteRoute(cidr string, args ...string)

DeleteRoute deletes a route from the interface. (It is an error if the route does not exist.)

func (*Transaction) DeleteSlave

func (tx *Transaction) DeleteSlave(slave string)

AddSlave remotes the indicated slave interface from the bridge, bond, or team interface associated with the transaction. (No error occurs if the interface is not actually a slave of the transaction interface.)

func (*Transaction) EndTransaction

func (tx *Transaction) EndTransaction() error

EndTransaction ends a transaction and returns any error that occurred during the transaction. You should not use the transaction again after calling this function.

func (*Transaction) GetAddresses

func (tx *Transaction) GetAddresses() ([]string, error)

GetAddresses returns the IPv4 addresses associated with the interface. Since this function has a return value, it also returns an error immediately if an error occurs.

func (*Transaction) GetRoutes

func (tx *Transaction) GetRoutes() ([]string, error)

GetRoutes returns the IPv4 routes associated with the interface (as an array of route descriptions in the format output by "ip route show"). Since this function has a return value, it also returns an error immediately if an error occurs.

func (*Transaction) IgnoreError

func (tx *Transaction) IgnoreError()

IgnoreError causes any error on the transaction to be discarded, in case you don't care about errors from a particular command and want further commands to be executed regardless.

func (tx *Transaction) SetLink(args ...string)

SetLink sets the indicated properties on the interface.

Jump to

Keyboard shortcuts

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