network

package
v0.0.0-...-e542f89 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BASE_SYSTEMD_NETWORKD_CONFIG_PATH = "/etc/systemd/network/"

	NETWORKD_LINK_CONFIG_SUFFIX = ".network"
)

Variables

This section is empty.

Functions

func AddIPAddress

func AddIPAddress(linkName string, IP string) error

func AddVlan

func AddVlan(name string, parentName string, vlanID int, vlanProtocol netlink.VlanProtocol) (bool, error)

AddVlan adds a VLan with its parent link name and it configs

func CheckLinkConfigExistense

func CheckLinkConfigExistense(name string) (bool, error)

func ConfigReader

func ConfigReader(filePath string) (io.Reader, error)

func ConfigWriter

func ConfigWriter(r io.Reader, filePath string) (bool, error)

func CreateAddressSection

func CreateAddressSection(ip net.IPNet) *sdc.Section

func CreateLinkConfig

func CreateLinkConfig(link netlink.Link) io.Reader
func CreateLinkSection(mac net.HardwareAddr, mtu int, multicast bool) *sdc.Section

func CreateMatchSection

func CreateMatchSection(name string, mac net.HardwareAddr, linkType string) *sdc.Section

func DelIPAddress

func DelIPAddress(linkName string, IP string) error
func DelLink(name string) (bool, error)
func GetAllLinks() ([]netlink.Link, error)
func GetLink(name string) (netlink.Link, error)

func InitCurrentConfigs

func InitCurrentConfigs() error

func NetworkConfigWriter

func NetworkConfigWriter(r io.Reader, name string) (bool, error)

func ParseIPAddress

func ParseIPAddress(IP string) (*netlink.Addr, error)

Types

type DyaneLink struct {
	Valid        bool   `json:"valid"`
	Type         string `json:"type"`
	Index        int    `json:"index"`
	Name         string `json:"name"`
	HardwareAddr string `json:"mac"`
	Flags        string `json:"flags"`
	RawFlags     uint32 `json:"raw flags"`
	MTU          int    `json:"mtu"`
	ParentIndex  int    `json:"parent index"`
	MasterIndex  int    `json:"master index"`
	Alias        string `json:"alias"`
}

func (*DyaneLink) Set

func (dl *DyaneLink) Set(nll netlink.Link)

Jump to

Keyboard shortcuts

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